diff options
| author | 2015-04-15 20:49:03 +0000 | |
|---|---|---|
| committer | 2015-04-15 20:49:04 +0000 | |
| commit | 019f13c48cc1f32ad4d1c6c9644fa0eecc6f497e (patch) | |
| tree | 77f0e2acfcbfaa66f7ec387de7aecf581063e7a2 | |
| parent | 472574f5a0f5aa4caf5a6e41509c00187113bb61 (diff) | |
| parent | 517daeccb29ce42b1ec4b366e7807088cad3f5ed (diff) | |
Merge "Moved SystemServer binder thread monitor from AMS to Monitor class."
| -rw-r--r-- | services/core/java/com/android/server/Watchdog.java | 14 | ||||
| -rw-r--r-- | services/core/java/com/android/server/am/ActivityManagerService.java | 10 |
2 files changed, 14 insertions, 10 deletions
diff --git a/services/core/java/com/android/server/Watchdog.java b/services/core/java/com/android/server/Watchdog.java index 69e61f67eb74..772a15c1bf64 100644 --- a/services/core/java/com/android/server/Watchdog.java +++ b/services/core/java/com/android/server/Watchdog.java @@ -190,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(); } @@ -227,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) { diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java index 37f0e351785a..b606353be7b4 100644 --- a/services/core/java/com/android/server/am/ActivityManagerService.java +++ b/services/core/java/com/android/server/am/ActivityManagerService.java @@ -2179,15 +2179,6 @@ public final class ActivityManagerService extends ActivityManagerNative } } - public static final class BinderThreadMonitor implements Watchdog.Monitor { - /** This method 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. - */ - @Override - public void monitor() { - Binder.blockUntilThreadAvailable(); - } - } // Note: This method is invoked on the main thread but may need to attach various // handlers to other threads. So take care to be explicit about the looper. public ActivityManagerService(Context systemContext) { @@ -2282,7 +2273,6 @@ public final class ActivityManagerService extends ActivityManagerNative }; Watchdog.getInstance().addMonitor(this); - Watchdog.getInstance().addMonitor(new BinderThreadMonitor()); Watchdog.getInstance().addThread(mHandler); } |