diff --git a/wifi/java/android/net/wifi/WifiManager.java b/wifi/java/android/net/wifi/WifiManager.java index 75b8bcf94d74e..e913d10c52b4f 100644 --- a/wifi/java/android/net/wifi/WifiManager.java +++ b/wifi/java/android/net/wifi/WifiManager.java @@ -1274,6 +1274,7 @@ public class WifiManager { // This will cause all further async API calls on the WifiManager // to fail and throw an exception mAsyncChannel = null; + getLooper().quit(); break; /* ActionListeners grouped together */ case WifiManager.CONNECT_NETWORK_FAILED: @@ -1979,4 +1980,12 @@ public class WifiManager { mService.captivePortalCheckComplete(); } catch (RemoteException e) {} } + + protected void finalize() throws Throwable { + try { + mHandler.getLooper().quit(); + } finally { + super.finalize(); + } + } }