summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
authorTreeHugger Robot <treehugger-gerrit@google.com>2020-04-27 18:56:35 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2020-04-27 18:56:35 +0000
commit1498232e66ddee8fb5e1c15f4e8f65063be3b66b (patch)
tree19a222dd8d59785cba63c6c297f1afa5587c9051 /service
parent9a111367bfd5f557c080f0c70d6723a067bdc84f (diff)
parent80895919e8c96c15ee4f7f6e59a3065fb5fad46f (diff)
Merge "Skip self recovery and bug report capture during SHUTDOWN" into rvc-dev am: fb2e4f6bbe am: 80895919e8
Change-Id: I313ea49912def7115f6ad1f099dec2dece695d44
Diffstat (limited to 'service')
-rw-r--r--service/java/com/android/server/wifi/ActiveModeWarden.java12
-rw-r--r--service/java/com/android/server/wifi/WifiServiceImpl.java16
2 files changed, 22 insertions, 6 deletions
diff --git a/service/java/com/android/server/wifi/ActiveModeWarden.java b/service/java/com/android/server/wifi/ActiveModeWarden.java
index 457b68773..03334584b 100644
--- a/service/java/com/android/server/wifi/ActiveModeWarden.java
+++ b/service/java/com/android/server/wifi/ActiveModeWarden.java
@@ -79,6 +79,7 @@ public class ActiveModeWarden {
private boolean mCanRequestMoreClientModeManagers = false;
private boolean mCanRequestMoreSoftApManagers = false;
+ private boolean mIsShuttingdown = false;
/**
* Called from WifiServiceImpl to register a callback for notifications from SoftApManager
@@ -122,7 +123,7 @@ public class ActiveModeWarden {
mWifiController = new WifiController();
wifiNative.registerStatusListener(isReady -> {
- if (!isReady) {
+ if (!isReady && !mIsShuttingdown) {
mHandler.post(() -> {
Log.e(TAG, "One of the native daemons died. Triggering recovery");
wifiDiagnostics.captureBugReportData(
@@ -149,6 +150,15 @@ public class ActiveModeWarden {
}
/**
+ * Notify that device is shutting down
+ * Keep it simple and don't add collection access codes
+ * to avoid concurrentModificationException when it is directly called from a different thread
+ */
+ public void notifyShuttingDown() {
+ mIsShuttingdown = true;
+ }
+
+ /**
* @return Returns whether we can create more client mode managers or not.
*/
public boolean canRequestMoreClientModeManagers() {
diff --git a/service/java/com/android/server/wifi/WifiServiceImpl.java b/service/java/com/android/server/wifi/WifiServiceImpl.java
index 436cb94f3..73fb306f9 100644
--- a/service/java/com/android/server/wifi/WifiServiceImpl.java
+++ b/service/java/com/android/server/wifi/WifiServiceImpl.java
@@ -571,11 +571,17 @@ public class WifiServiceImpl extends BaseWifiService {
}
private void handleShutDown() {
- // There is no explicit disconnection event in clientModeImpl during shutdown.
- // Call resetConnectionState() so that connection duration is calculated correctly
- // before memory store write triggered by mMemoryStoreImpl.stop().
- mWifiScoreCard.resetConnectionState();
- mMemoryStoreImpl.stop();
+ // Direct call to notify ActiveModeWarden as soon as possible with the assumption that
+ // notifyShuttingDown() doesn't have codes that may cause concurrentModificationException,
+ // e.g., access to a collection.
+ mActiveModeWarden.notifyShuttingDown();
+ mWifiThreadRunner.post(()-> {
+ // There is no explicit disconnection event in clientModeImpl during shutdown.
+ // Call resetConnectionState() so that connection duration is calculated
+ // before memory store write triggered by mMemoryStoreImpl.stop().
+ mWifiScoreCard.resetConnectionState();
+ mMemoryStoreImpl.stop();
+ });
}
private boolean checkNetworkSettingsPermission(int pid, int uid) {