Add NativeDaemonConnector users to watchdog.
To catch instances where NativeDaemonConnector hangs while executing
commands, add users to system_server watchdog. Also moved qtaguid
enabler to separate thread to prevent blocking systemReady().
Bug: 5145437
Change-Id: I4c6c1dc09864a1c05f9486a31faa1b366548e911
diff --git a/services/java/com/android/server/MountService.java b/services/java/com/android/server/MountService.java
index 7f61c635..fd03201 100644
--- a/services/java/com/android/server/MountService.java
+++ b/services/java/com/android/server/MountService.java
@@ -89,7 +89,8 @@
* @hide - Applications should use android.os.storage.StorageManager
* to access the MountService.
*/
-class MountService extends IMountService.Stub implements INativeDaemonConnectorCallbacks {
+class MountService extends IMountService.Stub
+ implements INativeDaemonConnectorCallbacks, Watchdog.Monitor {
private static final boolean LOCAL_LOGD = false;
private static final boolean DEBUG_UNMOUNT = false;
@@ -474,7 +475,8 @@
// it is not safe to call vold with mVolumeStates locked
// so we make a copy of the paths and states and process them
// outside the lock
- String[] paths, states;
+ String[] paths;
+ String[] states;
int count;
synchronized (mVolumeStates) {
Set<String> keys = mVolumeStates.keySet();
@@ -1179,6 +1181,9 @@
mReady = false;
Thread thread = new Thread(mConnector, VOLD_TAG);
thread.start();
+
+ // Add ourself to the Watchdog monitors.
+ Watchdog.getInstance().addMonitor(this);
}
/**
@@ -2379,5 +2384,11 @@
}
}
}
-}
+ /** {@inheritDoc} */
+ public void monitor() {
+ if (mConnector != null) {
+ mConnector.monitor();
+ }
+ }
+}