From f25df0d381c27936d75994268f355537e150d927 Mon Sep 17 00:00:00 2001 From: lesl Date: Fri, 20 Mar 2020 17:47:43 +0800 Subject: [PATCH] cts: unregister softap callback after finish the test Bug: 150307166 Test: atest android.net.wifi.cts.WifiManagerTest Change-Id: If189be91217f4f94e358fc0aedd2bfcc36f96c84 --- .../net/src/android/net/wifi/cts/WifiManagerTest.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) 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 ae5ef75af6..12db0257be 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 class WifiManagerTest extends AndroidTestCase { */ 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 @@ public class WifiManagerTest extends AndroidTestCase { verifySetGetSoftApConfig(softApConfigBuilder.build()); } } finally { + mWifiManager.unregisterSoftApCallback(callback); uiAutomation.dropShellPermissionIdentity(); } } @@ -1501,11 +1502,11 @@ public class WifiManagerTest extends AndroidTestCase { 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 @@ public class WifiManagerTest extends AndroidTestCase { 0 == callback.getCurrentSoftApInfo().getFrequency(); }); } finally { + mWifiManager.unregisterSoftApCallback(callback); uiAutomation.dropShellPermissionIdentity(); } }