summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--service/java/com/android/server/wifi/hotspot2/PasspointManager.java44
-rw-r--r--tests/wifitests/src/com/android/server/wifi/hotspot2/PasspointManagerTest.java115
2 files changed, 2 insertions, 157 deletions
diff --git a/service/java/com/android/server/wifi/hotspot2/PasspointManager.java b/service/java/com/android/server/wifi/hotspot2/PasspointManager.java
index 4c2937cb5..988dd6642 100644
--- a/service/java/com/android/server/wifi/hotspot2/PasspointManager.java
+++ b/service/java/com/android/server/wifi/hotspot2/PasspointManager.java
@@ -16,20 +16,7 @@
package com.android.server.wifi.hotspot2;
-import static android.net.wifi.WifiManager.ACTION_PASSPOINT_DEAUTH_IMMINENT;
-import static android.net.wifi.WifiManager.ACTION_PASSPOINT_ICON;
-import static android.net.wifi.WifiManager.ACTION_PASSPOINT_SUBSCRIPTION_REMEDIATION;
-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_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.graphics.drawable.Icon;
import android.net.wifi.ScanResult;
import android.net.wifi.WifiConfiguration;
import android.net.wifi.WifiEnterpriseConfig;
@@ -37,7 +24,6 @@ import android.net.wifi.hotspot2.IProvisioningCallback;
import android.net.wifi.hotspot2.OsuProvider;
import android.net.wifi.hotspot2.PasspointConfiguration;
import android.os.Looper;
-import android.os.UserHandle;
import android.text.TextUtils;
import android.util.Log;
import android.util.Pair;
@@ -130,38 +116,12 @@ public class PasspointManager {
@Override
public void onIconResponse(long bssid, String fileName, byte[] data) {
- 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_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);
+ // Empty
}
@Override
public void onWnmFrameReceived(WnmData event) {
- // %012x HS20-SUBSCRIPTION-REMEDIATION "%u %s", osu_method, url
- // %012x HS20-DEAUTH-IMMINENT-NOTICE "%u %u %s", code, reauth_delay, url
- Intent intent;
- if (event.isDeauthEvent()) {
- intent = new Intent(ACTION_PASSPOINT_DEAUTH_IMMINENT);
- intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT);
- intent.putExtra(EXTRA_BSSID_LONG, event.getBssid());
- intent.putExtra(EXTRA_URL, event.getUrl());
- intent.putExtra(EXTRA_ESS, event.isEss());
- intent.putExtra(EXTRA_DELAY, event.getDelay());
- } else {
- intent = new Intent(ACTION_PASSPOINT_SUBSCRIPTION_REMEDIATION);
- intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT);
- intent.putExtra(EXTRA_BSSID_LONG, event.getBssid());
- intent.putExtra(EXTRA_SUBSCRIPTION_REMEDIATION_METHOD, event.getMethod());
- intent.putExtra(EXTRA_URL, event.getUrl());
- }
- mContext.sendBroadcastAsUser(intent, UserHandle.ALL,
- android.Manifest.permission.ACCESS_WIFI_STATE);
+ // Empty
}
}
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 abcd0bf34..284c7f9b9 100644
--- a/tests/wifitests/src/com/android/server/wifi/hotspot2/PasspointManagerTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/hotspot2/PasspointManagerTest.java
@@ -16,17 +16,6 @@
package com.android.server.wifi.hotspot2;
-import static android.net.wifi.WifiManager.ACTION_PASSPOINT_DEAUTH_IMMINENT;
-import static android.net.wifi.WifiManager.ACTION_PASSPOINT_ICON;
-import static android.net.wifi.WifiManager.ACTION_PASSPOINT_SUBSCRIPTION_REMEDIATION;
-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_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 static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNull;
@@ -47,7 +36,6 @@ import static org.mockito.MockitoAnnotations.initMocks;
import android.content.Context;
import android.content.Intent;
-import android.graphics.drawable.Icon;
import android.net.Uri;
import android.net.wifi.EAPConstants;
import android.net.wifi.ScanResult;
@@ -107,7 +95,6 @@ import java.util.Map;
@SmallTest
public class PasspointManagerTest {
private static final long BSSID = 0x112233445566L;
- private static final String ICON_FILENAME = "test";
private static final String TEST_FQDN = "test1.test.com";
private static final String TEST_FRIENDLY_NAME = "friendly name";
private static final String TEST_REALM = "realm.test.com";
@@ -180,30 +167,6 @@ public class PasspointManagerTest {
}
/**
- * Verify {@link WifiManager#ACTION_PASSPOINT_ICON} broadcast intent.
- * @param bssid BSSID of the AP
- * @param fileName Name of the icon file
- * @param data icon data byte array
- */
- private void verifyIconIntent(long bssid, String fileName, byte[] data) {
- ArgumentCaptor<Intent> intent = ArgumentCaptor.forClass(Intent.class);
- verify(mContext).sendBroadcastAsUser(intent.capture(), eq(UserHandle.ALL),
- eq(android.Manifest.permission.ACCESS_WIFI_STATE));
- 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_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));
- }
- }
-
- /**
* Verify that the given Passpoint configuration matches the one that's added to
* the PasspointManager.
*
@@ -354,84 +317,6 @@ public class PasspointManagerTest {
}
/**
- * Validate the broadcast intent when icon file retrieval succeeded.
- *
- * @throws Exception
- */
- @Test
- public void iconResponseSuccess() throws Exception {
- byte[] iconData = new byte[] {0x00, 0x11};
- mCallbacks.onIconResponse(BSSID, ICON_FILENAME, iconData);
- verifyIconIntent(BSSID, ICON_FILENAME, iconData);
- }
-
- /**
- * Validate the broadcast intent when icon file retrieval failed.
- *
- * @throws Exception
- */
- @Test
- public void iconResponseFailure() throws Exception {
- mCallbacks.onIconResponse(BSSID, ICON_FILENAME, null);
- verifyIconIntent(BSSID, ICON_FILENAME, null);
- }
-
- /**
- * Validate the broadcast intent {@link WifiManager#ACTION_PASSPOINT_DEAUTH_IMMINENT} when
- * Deauth Imminent WNM frame is received.
- *
- * @throws Exception
- */
- @Test
- public void onDeauthImminentReceived() throws Exception {
- String reasonUrl = "test.com";
- int delay = 123;
- boolean ess = true;
-
- mCallbacks.onWnmFrameReceived(new WnmData(BSSID, reasonUrl, ess, delay));
- // Verify the broadcast intent.
- ArgumentCaptor<Intent> intent = ArgumentCaptor.forClass(Intent.class);
- verify(mContext).sendBroadcastAsUser(intent.capture(), eq(UserHandle.ALL),
- eq(android.Manifest.permission.ACCESS_WIFI_STATE));
- assertEquals(ACTION_PASSPOINT_DEAUTH_IMMINENT, 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_ESS));
- assertEquals(ess, intent.getValue().getExtras().getBoolean(EXTRA_ESS));
- assertTrue(intent.getValue().getExtras().containsKey(EXTRA_DELAY));
- assertEquals(delay, intent.getValue().getExtras().getInt(EXTRA_DELAY));
- assertTrue(intent.getValue().getExtras().containsKey(EXTRA_URL));
- assertEquals(reasonUrl, intent.getValue().getExtras().getString(EXTRA_URL));
- }
-
- /**
- * Validate the broadcast intent {@link WifiManager#ACTION_PASSPOINT_SUBSCRIPTION_REMEDIATION}
- * when Subscription Remediation WNM frame is received.
- *
- * @throws Exception
- */
- @Test
- public void onSubscriptionRemediationReceived() throws Exception {
- int serverMethod = 1;
- String serverUrl = "testUrl";
-
- mCallbacks.onWnmFrameReceived(new WnmData(BSSID, serverUrl, serverMethod));
- // Verify the broadcast intent.
- ArgumentCaptor<Intent> intent = ArgumentCaptor.forClass(Intent.class);
- verify(mContext).sendBroadcastAsUser(intent.capture(), eq(UserHandle.ALL),
- eq(android.Manifest.permission.ACCESS_WIFI_STATE));
- assertEquals(ACTION_PASSPOINT_SUBSCRIPTION_REMEDIATION, 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_SUBSCRIPTION_REMEDIATION_METHOD));
- assertEquals(serverMethod, intent.getValue().getExtras().getInt(
- EXTRA_SUBSCRIPTION_REMEDIATION_METHOD));
- assertTrue(intent.getValue().getExtras().containsKey(EXTRA_URL));
- assertEquals(serverUrl, intent.getValue().getExtras().getString(EXTRA_URL));
- }
-
- /**
* Verify that adding a provider with a null configuration will fail.
*
* @throws Exception