Merge "Merge "wifi: use android.graphics.drawable.Icon for Passpoint icon data" am: 44ef19d131 am: aadbb2d45e" into nyc-mr2-dev-plus-aosp
am: 3f57a273d2

Change-Id: Ie314289ce69f07c872c7a16ddc90d36be25c777f
diff --git a/api/current.txt b/api/current.txt
index e87c613..5018ecf 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -26278,16 +26278,6 @@
 
 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();
@@ -26536,7 +26526,8 @@
     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";
diff --git a/api/system-current.txt b/api/system-current.txt
index 0737299..2bf01d1 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -28561,16 +28561,6 @@
     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);
@@ -29066,7 +29056,8 @@
     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";
diff --git a/api/test-current.txt b/api/test-current.txt
index 84d97fb..da25aa9 100644
--- a/api/test-current.txt
+++ b/api/test-current.txt
@@ -26389,16 +26389,6 @@
 
 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();
@@ -26647,7 +26637,8 @@
     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";
diff --git a/wifi/java/android/net/wifi/IconInfo.aidl b/wifi/java/android/net/wifi/IconInfo.aidl
deleted file mode 100644
index a7bb2ef..0000000
--- a/wifi/java/android/net/wifi/IconInfo.aidl
+++ /dev/null
@@ -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;
diff --git a/wifi/java/android/net/wifi/IconInfo.java b/wifi/java/android/net/wifi/IconInfo.java
deleted file mode 100644
index 0eae363..0000000
--- a/wifi/java/android/net/wifi/IconInfo.java
+++ /dev/null
@@ -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];
-            }
-        };
-}
diff --git a/wifi/java/android/net/wifi/WifiManager.java b/wifi/java/android/net/wifi/WifiManager.java
index 4f2881b..824c436 100644
--- a/wifi/java/android/net/wifi/WifiManager.java
+++ b/wifi/java/android/net/wifi/WifiManager.java
@@ -120,7 +120,8 @@
      *
      * 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 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 @@
 
     /**
      * 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
diff --git a/wifi/tests/src/android/net/wifi/IconInfoTest.java b/wifi/tests/src/android/net/wifi/IconInfoTest.java
deleted file mode 100644
index 2fdb484..0000000
--- a/wifi/tests/src/android/net/wifi/IconInfoTest.java
+++ /dev/null
@@ -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));
-    }
-}