From 1fe1065da82165183fa057ddbbd2e33bc5708c1b Mon Sep 17 00:00:00 2001 From: Robin Lee Date: Thu, 1 Dec 2016 20:44:57 +0000 Subject: Send CMD_DISCONNECT after removing app/user configs Otherwise they might linger in wpa_supplicant longer than they were supposed to. This is already done by every other callsite for removing networks which might still be in use. Test: runtest -x tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java Bug: 32660379 Change-Id: I45b0bcc87129be02bcce940f07f7c48543207bf0 --- .../src/com/android/server/wifi/WifiConfigManagerTest.java | 8 ++++---- .../src/com/android/server/wifi/WifiConfigurationTestUtil.java | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'tests') diff --git a/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java b/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java index 6ea309a7c..c94d6f8c8 100644 --- a/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java +++ b/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java @@ -69,7 +69,7 @@ public class WifiConfigManagerTest { private static final long TEST_WALLCLOCK_CREATION_TIME_MILLIS = 9845637; private static final long TEST_WALLCLOCK_UPDATE_TIME_MILLIS = 75455637; private static final long TEST_ELAPSED_UPDATE_NETWORK_SELECTION_TIME_MILLIS = 29457631; - private static final int TEST_CREATOR_UID = 5; + private static final int TEST_CREATOR_UID = WifiConfigurationTestUtil.TEST_UID; private static final int TEST_UPDATE_UID = 4; private static final int TEST_SYSUI_UID = 56; private static final int TEST_DEFAULT_USER = UserHandle.USER_SYSTEM; @@ -144,7 +144,7 @@ public class WifiConfigManagerTest { // default. This maybe modified for particular tests if needed. doAnswer(new AnswerWithArguments() { public int answer(String permName, int uid) throws Exception { - if (uid == TEST_CREATOR_UID || uid == TEST_UPDATE_UID) { + if (uid == TEST_CREATOR_UID || uid == TEST_UPDATE_UID || uid == TEST_SYSUI_UID) { return PackageManager.PERMISSION_GRANTED; } return PackageManager.PERMISSION_DENIED; @@ -2280,7 +2280,7 @@ public class WifiConfigManagerTest { ApplicationInfo app = new ApplicationInfo(); app.uid = TEST_CREATOR_UID; app.packageName = TEST_CREATOR_NAME; - assertTrue(mWifiConfigManager.removeNetworksForApp(app)); + assertEquals(3, mWifiConfigManager.removeNetworksForApp(app).size()); // Ensure all the networks are removed now. assertTrue(mWifiConfigManager.getConfiguredNetworks().isEmpty()); @@ -2298,7 +2298,7 @@ public class WifiConfigManagerTest { assertFalse(mWifiConfigManager.getConfiguredNetworks().isEmpty()); - assertTrue(mWifiConfigManager.removeNetworksForUser(TEST_DEFAULT_USER)); + assertEquals(3, mWifiConfigManager.removeNetworksForUser(TEST_DEFAULT_USER).size()); // Ensure all the networks are removed now. assertTrue(mWifiConfigManager.getConfiguredNetworks().isEmpty()); diff --git a/tests/wifitests/src/com/android/server/wifi/WifiConfigurationTestUtil.java b/tests/wifitests/src/com/android/server/wifi/WifiConfigurationTestUtil.java index 3f71b1f46..e6727a0b4 100644 --- a/tests/wifitests/src/com/android/server/wifi/WifiConfigurationTestUtil.java +++ b/tests/wifitests/src/com/android/server/wifi/WifiConfigurationTestUtil.java @@ -58,7 +58,7 @@ public class WifiConfigurationTestUtil { * These are constants used to generate predefined WifiConfiguration objects. */ public static final int TEST_NETWORK_ID = -1; - public static final int TEST_UID = 1; + public static final int TEST_UID = 5; public static final String TEST_SSID = "WifiConfigurationTestUtilSSID"; public static final String TEST_PSK = "WifiConfigurationTestUtilPsk"; public static final String[] TEST_WEP_KEYS = -- cgit v1.2.3