Merge "wifi: use android.graphics.drawable.Icon for Passpoint icon data"

am: 44ef19d131

Change-Id: I65b22e41ae62172cc7b241fe68c6d1c92c782a69
This commit is contained in:
Peter Qiu
2017-03-23 23:00:06 +00:00
committed by android-build-merger
7 changed files with 20 additions and 292 deletions

View File

@ -24809,16 +24809,6 @@ package android.net.sip {
package android.net.wifi {
public final class IconInfo implements android.os.Parcelable {
ctor public IconInfo(java.lang.String, byte[]);
ctor public IconInfo(android.net.wifi.IconInfo);
method public int describeContents();
method public byte[] getData();
method public java.lang.String getFilename();
method public void writeToParcel(android.os.Parcel, int);
field public static final android.os.Parcelable.Creator<android.net.wifi.IconInfo> CREATOR;
}
public class ScanResult implements android.os.Parcelable {
method public int describeContents();
method public boolean is80211mcResponder();
@ -25067,7 +25057,8 @@ package android.net.wifi {
field public static final java.lang.String EXTRA_BSSID_LONG = "android.net.wifi.extra.BSSID_LONG";
field public static final java.lang.String EXTRA_DELAY = "android.net.wifi.extra.DELAY";
field public static final java.lang.String EXTRA_ESS = "android.net.wifi.extra.ESS";
field public static final java.lang.String EXTRA_ICON_INFO = "android.net.wifi.extra.ICON_INFO";
field public static final java.lang.String EXTRA_FILENAME = "android.net.wifi.extra.FILENAME";
field public static final java.lang.String EXTRA_ICON = "android.net.wifi.extra.ICON";
field public static final java.lang.String EXTRA_NETWORK_INFO = "networkInfo";
field public static final java.lang.String EXTRA_NEW_RSSI = "newRssi";
field public static final java.lang.String EXTRA_NEW_STATE = "newState";

View File

@ -26961,16 +26961,6 @@ package android.net.wifi {
field public boolean truncated;
}
public final class IconInfo implements android.os.Parcelable {
ctor public IconInfo(java.lang.String, byte[]);
ctor public IconInfo(android.net.wifi.IconInfo);
method public int describeContents();
method public byte[] getData();
method public java.lang.String getFilename();
method public void writeToParcel(android.os.Parcel, int);
field public static final android.os.Parcelable.Creator<android.net.wifi.IconInfo> CREATOR;
}
public class RttManager {
method public void disableResponder(android.net.wifi.RttManager.ResponderCallback);
method public void enableResponder(android.net.wifi.RttManager.ResponderCallback);
@ -27465,7 +27455,8 @@ package android.net.wifi {
field public static final java.lang.String EXTRA_CHANGE_REASON = "changeReason";
field public static final java.lang.String EXTRA_DELAY = "android.net.wifi.extra.DELAY";
field public static final java.lang.String EXTRA_ESS = "android.net.wifi.extra.ESS";
field public static final java.lang.String EXTRA_ICON_INFO = "android.net.wifi.extra.ICON_INFO";
field public static final java.lang.String EXTRA_FILENAME = "android.net.wifi.extra.FILENAME";
field public static final java.lang.String EXTRA_ICON = "android.net.wifi.extra.ICON";
field public static final java.lang.String EXTRA_MULTIPLE_NETWORKS_CHANGED = "multipleChanges";
field public static final java.lang.String EXTRA_NETWORK_INFO = "networkInfo";
field public static final java.lang.String EXTRA_NEW_RSSI = "newRssi";

View File

@ -24883,16 +24883,6 @@ package android.net.sip {
package android.net.wifi {
public final class IconInfo implements android.os.Parcelable {
ctor public IconInfo(java.lang.String, byte[]);
ctor public IconInfo(android.net.wifi.IconInfo);
method public int describeContents();
method public byte[] getData();
method public java.lang.String getFilename();
method public void writeToParcel(android.os.Parcel, int);
field public static final android.os.Parcelable.Creator<android.net.wifi.IconInfo> CREATOR;
}
public class ScanResult implements android.os.Parcelable {
method public int describeContents();
method public boolean is80211mcResponder();
@ -25141,7 +25131,8 @@ package android.net.wifi {
field public static final java.lang.String EXTRA_BSSID_LONG = "android.net.wifi.extra.BSSID_LONG";
field public static final java.lang.String EXTRA_DELAY = "android.net.wifi.extra.DELAY";
field public static final java.lang.String EXTRA_ESS = "android.net.wifi.extra.ESS";
field public static final java.lang.String EXTRA_ICON_INFO = "android.net.wifi.extra.ICON_INFO";
field public static final java.lang.String EXTRA_FILENAME = "android.net.wifi.extra.FILENAME";
field public static final java.lang.String EXTRA_ICON = "android.net.wifi.extra.ICON";
field public static final java.lang.String EXTRA_NETWORK_INFO = "networkInfo";
field public static final java.lang.String EXTRA_NEW_RSSI = "newRssi";
field public static final java.lang.String EXTRA_NEW_STATE = "newState";

View File

@ -1,19 +0,0 @@
/**
* Copyright (c) 2017, The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package android.net.wifi;
parcelable IconInfo;

View File

@ -1,111 +0,0 @@
/*
* Copyright (C) 2017 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package android.net.wifi;
import android.os.Parcelable;
import android.text.TextUtils;
import android.os.Parcel;
import java.util.Arrays;
import java.util.Objects;
/**
* A class representing icon information.
*/
public final class IconInfo implements Parcelable {
/**
* Name of the icon file.
*/
private final String mFilename;
/**
* Raw binary data of the icon.
*/
private final byte[] mData;
public IconInfo(String filename, byte[] data) {
mFilename = filename;
mData = data;
}
public IconInfo(IconInfo source) {
if (source == null) {
mFilename = null;
mData = null;
return;
}
mFilename = source.mFilename;
if (source.mData != null) {
mData = Arrays.copyOf(source.mData, source.mData.length);
} else {
mData = null;
}
}
public String getFilename() {
return mFilename;
}
public byte[] getData() {
return mData;
}
@Override
public boolean equals(Object thatObject) {
if (this == thatObject) {
return true;
}
if (!(thatObject instanceof IconInfo)) {
return false;
}
IconInfo that = (IconInfo) thatObject;
return TextUtils.equals(mFilename, that.mFilename)
&& Arrays.equals(mData, that.mData);
}
@Override
public int hashCode() {
return Objects.hash(mFilename, mData);
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeString(mFilename);
dest.writeByteArray(mData);
}
public static final Creator<IconInfo> CREATOR =
new Creator<IconInfo>() {
@Override
public IconInfo createFromParcel(Parcel in) {
String filename = in.readString();
byte[] data = in.createByteArray();
return new IconInfo(filename, data);
}
@Override
public IconInfo[] newArray(int size) {
return new IconInfo[size];
}
};
}

View File

@ -120,7 +120,8 @@ public class WifiManager {
*
* Included extras:
* {@link #EXTRA_BSSID_LONG}
* {@link #EXTRA_ICON_INFO}
* {@link #EXTRA_FILENAME}
* {@link #EXTRA_ICON}
*
* Receiver Required Permission: android.Manifest.permission.ACCESS_WIFI_STATE
*
@ -136,12 +137,18 @@ public class WifiManager {
*/
public static final String EXTRA_BSSID_LONG = "android.net.wifi.extra.BSSID_LONG";
/**
* Icon information.
* Icon data.
*
* Retrieve with {@link android.content.Intent#getParcelableExtra(String)} and cast into
* {@link IconInfo}.
* {@link android.graphics.drawable.Icon}.
*/
public static final String EXTRA_ICON_INFO = "android.net.wifi.extra.ICON_INFO";
public static final String EXTRA_ICON = "android.net.wifi.extra.ICON";
/**
* Name of a file.
*
* Retrieve with {@link android.content.Intent#getStringExtra(String)}.
*/
public static final String EXTRA_FILENAME = "android.net.wifi.extra.FILENAME";
/**
* Broadcast intent action indicating a Passpoint OSU Providers List element has been received.
@ -984,9 +991,9 @@ public class WifiManager {
/**
* Query for a Hotspot 2.0 release 2 OSU icon file. An {@link #ACTION_PASSPOINT_ICON} intent
* will be broadcasted once the request is completed. The return value of
* {@link IconInfo#getData} from the intent extra will indicate the result of the request.
* A value of {@code null} will indicate a failure.
* will be broadcasted once the request is completed. The presence of the intent extra
* {@link #EXTRA_ICON} will indicate the result of the request.
* A missing intent extra {@link #EXTRA_ICON} will indicate a failure.
*
* @param bssid The BSSID of the AP
* @param fileName Name of the icon file (remote file) to query from the AP

View File

@ -1,122 +0,0 @@
/*
* Copyright (C) 2017 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License
*/
package android.net.wifi;
import static org.junit.Assert.assertEquals;
import android.net.wifi.IconInfo;
import android.os.Parcel;
import android.test.suitebuilder.annotation.SmallTest;
import org.junit.Test;
/**
* Unit tests for {@link android.net.wifi.IconInfo}.
*/
@SmallTest
public class IconInfoTest {
private static final String TEST_FILENAME = "testIcon";
private static final byte[] TEST_DATA = new byte[] {0x12, 0x23, 0x34, 0x45, 0x56, 0x67};
/**
* Verify parcel write and read consistency for the given {@link IconInfo}
*
* @param writeIcon the {@link IconInfo} to write and verify
* @throws Exception
*/
private static void verifyParcel(IconInfo writeIcon) throws Exception {
Parcel parcel = Parcel.obtain();
writeIcon.writeToParcel(parcel, 0);
parcel.setDataPosition(0); // Rewind data position back to the beginning for read.
IconInfo readIcon = IconInfo.CREATOR.createFromParcel(parcel);
assertEquals(writeIcon, readIcon);
}
/**
* Verify parcel serialization for a {@link IconInfo} with null data.
*
* @throws Exception
*/
@Test
public void verifyParcelWithNullData() throws Exception {
verifyParcel(new IconInfo(TEST_FILENAME, (byte[]) null));
}
/**
* Verify parcel serialization for a {@link IconInfo} with zero length data.
*
* @throws Exception
*/
@Test
public void verifyParcelWithZeroLengthData() throws Exception {
verifyParcel(new IconInfo(TEST_FILENAME, new byte[0]));
}
/**
* Verify parcel serialization for a {@link IconInfo} with non-zero length data.
*
* @throws Exception
*/
@Test
public void verifyParcelWithNonZeroLengthData() throws Exception {
verifyParcel(new IconInfo(TEST_FILENAME, TEST_DATA));
}
/**
* Verify parcel serialization for a {@link IconInfo} with a null filename.
*
* @throws Exception
*/
@Test
public void verifyParcelWithNullFilename() throws Exception {
verifyParcel(new IconInfo(null, TEST_DATA));
}
/**
* Verify the copy constructor with non-null filename and data.
*
* @throws Exception
*/
@Test
public void verifyCopyConstructor() throws Exception {
IconInfo source = new IconInfo(TEST_FILENAME, TEST_DATA);
assertEquals(source, new IconInfo(source));
}
/**
* Verify the copy constructor with null data.
*
* @throws Exception
*/
@Test
public void verifyCopyConstructorWithNullData() throws Exception {
IconInfo source = new IconInfo(TEST_FILENAME, (byte[]) null);
assertEquals(source, new IconInfo(source));
}
/**
* Verify the copy constructor with null file name.
*
* @throws Exception
*/
@Test
public void verifyCopyConstructorWithNullFilename() throws Exception {
IconInfo source = new IconInfo(null, TEST_DATA);
assertEquals(source, new IconInfo(source));
}
}