summaryrefslogtreecommitdiffstats
path: root/services/core/java/com/android/server/Watchdog.java
diff options
context:
space:
mode:
Diffstat (limited to 'services/core/java/com/android/server/Watchdog.java')
-rw-r--r--services/core/java/com/android/server/Watchdog.java17
1 files changed, 15 insertions, 2 deletions
diff --git a/services/core/java/com/android/server/Watchdog.java b/services/core/java/com/android/server/Watchdog.java
index 794e1b0..772a15c 100644
--- a/services/core/java/com/android/server/Watchdog.java
+++ b/services/core/java/com/android/server/Watchdog.java
@@ -46,7 +46,6 @@ import java.util.ArrayList;
/** This class calls its monitor every minute. Killing this process if they don't return **/
public class Watchdog extends Thread {
static final String TAG = "Watchdog";
- static final boolean localLOGV = false || false;
// Set this to true to use debug default values.
static final boolean DB = false;
@@ -73,7 +72,7 @@ public class Watchdog extends Thread {
static Watchdog sWatchdog;
/* This handler will be used to post message back onto the main thread */
- final ArrayList<HandlerChecker> mHandlerCheckers = new ArrayList<HandlerChecker>();
+ final ArrayList<HandlerChecker> mHandlerCheckers = new ArrayList<>();
final HandlerChecker mMonitorChecker;
ContentResolver mResolver;
ActivityManagerService mActivity;
@@ -191,6 +190,17 @@ public class Watchdog extends Thread {
}
}
+ /** Monitor for checking the availability of binder threads. The monitor will block until
+ * there is a binder thread available to process in coming IPCs to make sure other processes
+ * can still communicate with the service.
+ */
+ private static final class BinderThreadMonitor implements Watchdog.Monitor {
+ @Override
+ public void monitor() {
+ Binder.blockUntilThreadAvailable();
+ }
+ }
+
public interface Monitor {
void monitor();
}
@@ -228,6 +238,9 @@ public class Watchdog extends Thread {
// And the display thread.
mHandlerCheckers.add(new HandlerChecker(DisplayThread.getHandler(),
"display thread", DEFAULT_TIMEOUT));
+
+ // Initialize monitor for Binder threads.
+ addMonitor(new BinderThreadMonitor());
}
public void init(Context context, ActivityManagerService activity) {