cts: unregister softap callback after finish the test
Bug: 150307166
Test: atest android.net.wifi.cts.WifiManagerTest
Change-Id: If189be91217f4f94e358fc0aedd2bfcc36f96c84
diff --git a/tests/cts/net/src/android/net/wifi/cts/WifiManagerTest.java b/tests/cts/net/src/android/net/wifi/cts/WifiManagerTest.java
index ae5ef75..12db025 100644
--- a/tests/cts/net/src/android/net/wifi/cts/WifiManagerTest.java
+++ b/tests/cts/net/src/android/net/wifi/cts/WifiManagerTest.java
@@ -1447,11 +1447,11 @@
*/
public void testSetGetSoftApConfigurationAndSoftApCapabilityCallback() throws Exception {
UiAutomation uiAutomation = InstrumentationRegistry.getInstrumentation().getUiAutomation();
+ TestExecutor executor = new TestExecutor();
+ TestSoftApCallback callback = new TestSoftApCallback(mLock);
try {
uiAutomation.adoptShellPermissionIdentity();
turnOffWifiAndTetheredHotspotIfEnabled();
- TestExecutor executor = new TestExecutor();
- TestSoftApCallback callback = new TestSoftApCallback(mLock);
verifyRegisterSoftApCallback(executor, callback);
SoftApConfiguration.Builder softApConfigBuilder = new SoftApConfiguration.Builder()
@@ -1490,6 +1490,7 @@
verifySetGetSoftApConfig(softApConfigBuilder.build());
}
} finally {
+ mWifiManager.unregisterSoftApCallback(callback);
uiAutomation.dropShellPermissionIdentity();
}
}
@@ -1501,11 +1502,11 @@
public void testStartTetheredHotspotWithChannelConfigAndSoftApStateAndInfoCallback()
throws Exception {
UiAutomation uiAutomation = InstrumentationRegistry.getInstrumentation().getUiAutomation();
+ TestExecutor executor = new TestExecutor();
+ TestSoftApCallback callback = new TestSoftApCallback(mLock);
try {
uiAutomation.adoptShellPermissionIdentity();
turnOffWifiAndTetheredHotspotIfEnabled();
- TestExecutor executor = new TestExecutor();
- TestSoftApCallback callback = new TestSoftApCallback(mLock);
verifyRegisterSoftApCallback(executor, callback);
SoftApConfiguration testSoftApConfig = new SoftApConfiguration.Builder()
@@ -1544,6 +1545,7 @@
0 == callback.getCurrentSoftApInfo().getFrequency();
});
} finally {
+ mWifiManager.unregisterSoftApCallback(callback);
uiAutomation.dropShellPermissionIdentity();
}
}