Cleanup on async disconnect and finalize
Bug: 7326726
Change-Id: I6cca47a70cc0f29c68f922618cdcc181fb919a05
diff --git a/wifi/java/android/net/wifi/WifiManager.java b/wifi/java/android/net/wifi/WifiManager.java
index 75b8bcf..e913d10 100644
--- a/wifi/java/android/net/wifi/WifiManager.java
+++ b/wifi/java/android/net/wifi/WifiManager.java
@@ -1274,6 +1274,7 @@
// 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 @@
mService.captivePortalCheckComplete();
} catch (RemoteException e) {}
}
+
+ protected void finalize() throws Throwable {
+ try {
+ mHandler.getLooper().quit();
+ } finally {
+ super.finalize();
+ }
+ }
}