diff options
-rw-r--r-- | service/java/com/android/server/wifi/hotspot2/PasspointManager.java | 10 | ||||
-rw-r--r-- | tests/wifitests/src/com/android/server/wifi/hotspot2/PasspointManagerTest.java | 18 |
2 files changed, 19 insertions, 9 deletions
diff --git a/service/java/com/android/server/wifi/hotspot2/PasspointManager.java b/service/java/com/android/server/wifi/hotspot2/PasspointManager.java index 0e4620673..f472d86db 100644 --- a/service/java/com/android/server/wifi/hotspot2/PasspointManager.java +++ b/service/java/com/android/server/wifi/hotspot2/PasspointManager.java @@ -22,13 +22,14 @@ import static android.net.wifi.WifiManager.ACTION_PASSPOINT_SUBSCRIPTION_REMEDIA import static android.net.wifi.WifiManager.EXTRA_BSSID_LONG; import static android.net.wifi.WifiManager.EXTRA_DELAY; import static android.net.wifi.WifiManager.EXTRA_ESS; -import static android.net.wifi.WifiManager.EXTRA_ICON_INFO; +import static android.net.wifi.WifiManager.EXTRA_FILENAME; +import static android.net.wifi.WifiManager.EXTRA_ICON; import static android.net.wifi.WifiManager.EXTRA_SUBSCRIPTION_REMEDIATION_METHOD; import static android.net.wifi.WifiManager.EXTRA_URL; import android.content.Context; import android.content.Intent; -import android.net.wifi.IconInfo; +import android.graphics.drawable.Icon; import android.net.wifi.ScanResult; import android.net.wifi.WifiConfiguration; import android.net.wifi.WifiEnterpriseConfig; @@ -123,7 +124,10 @@ public class PasspointManager { Intent intent = new Intent(ACTION_PASSPOINT_ICON); intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT); intent.putExtra(EXTRA_BSSID_LONG, bssid); - intent.putExtra(EXTRA_ICON_INFO, new IconInfo(fileName, data)); + intent.putExtra(EXTRA_FILENAME, fileName); + if (data != null) { + intent.putExtra(EXTRA_ICON, Icon.createWithData(data, 0, data.length)); + } mContext.sendBroadcastAsUser(intent, UserHandle.ALL, android.Manifest.permission.ACCESS_WIFI_STATE); } diff --git a/tests/wifitests/src/com/android/server/wifi/hotspot2/PasspointManagerTest.java b/tests/wifitests/src/com/android/server/wifi/hotspot2/PasspointManagerTest.java index bdaf733c1..32209a357 100644 --- a/tests/wifitests/src/com/android/server/wifi/hotspot2/PasspointManagerTest.java +++ b/tests/wifitests/src/com/android/server/wifi/hotspot2/PasspointManagerTest.java @@ -22,7 +22,8 @@ import static android.net.wifi.WifiManager.ACTION_PASSPOINT_SUBSCRIPTION_REMEDIA import static android.net.wifi.WifiManager.EXTRA_BSSID_LONG; import static android.net.wifi.WifiManager.EXTRA_DELAY; import static android.net.wifi.WifiManager.EXTRA_ESS; -import static android.net.wifi.WifiManager.EXTRA_ICON_INFO; +import static android.net.wifi.WifiManager.EXTRA_FILENAME; +import static android.net.wifi.WifiManager.EXTRA_ICON; import static android.net.wifi.WifiManager.EXTRA_SUBSCRIPTION_REMEDIATION_METHOD; import static android.net.wifi.WifiManager.EXTRA_URL; @@ -44,8 +45,8 @@ import static org.mockito.MockitoAnnotations.initMocks; import android.content.Context; import android.content.Intent; +import android.graphics.drawable.Icon; import android.net.wifi.EAPConstants; -import android.net.wifi.IconInfo; import android.net.wifi.ScanResult; import android.net.wifi.WifiConfiguration; import android.net.wifi.WifiEnterpriseConfig; @@ -151,10 +152,15 @@ public class PasspointManagerTest { assertEquals(ACTION_PASSPOINT_ICON, intent.getValue().getAction()); assertTrue(intent.getValue().getExtras().containsKey(EXTRA_BSSID_LONG)); assertEquals(bssid, intent.getValue().getExtras().getLong(EXTRA_BSSID_LONG)); - assertTrue(intent.getValue().getExtras().containsKey(EXTRA_ICON_INFO)); - IconInfo expectedInfo = new IconInfo(fileName, data); - assertEquals(new IconInfo(fileName, data), - (IconInfo) intent.getValue().getExtras().getParcelable(EXTRA_ICON_INFO)); + assertTrue(intent.getValue().getExtras().containsKey(EXTRA_FILENAME)); + assertEquals(fileName, intent.getValue().getExtras().getString(EXTRA_FILENAME)); + if (data != null) { + assertTrue(intent.getValue().getExtras().containsKey(EXTRA_ICON)); + Icon icon = (Icon) intent.getValue().getExtras().getParcelable(EXTRA_ICON); + assertTrue(Arrays.equals(data, icon.getDataBytes())); + } else { + assertFalse(intent.getValue().getExtras().containsKey(EXTRA_ICON)); + } } /** |