Merge "Move stack dump off of InputDispatcher thread" into jb-mr2-dev
diff --git a/services/java/com/android/server/am/ActivityManagerService.java b/services/java/com/android/server/am/ActivityManagerService.java
index f226683..a766bad 100644
--- a/services/java/com/android/server/am/ActivityManagerService.java
+++ b/services/java/com/android/server/am/ActivityManagerService.java
@@ -7419,7 +7419,7 @@
         SystemProperties.set("ctl.start", "bugreport");
     }
 
-    public long inputDispatchingTimedOut(int pid, boolean aboveSystem) {
+    public long inputDispatchingTimedOut(int pid, final boolean aboveSystem) {
         if (checkCallingPermission(android.Manifest.permission.FILTER_EVENTS)
                 != PackageManager.PERMISSION_GRANTED) {
             throw new SecurityException("Requires permission "
@@ -7455,7 +7455,13 @@
         }
 
         if (proc != null) {
-            appNotResponding(proc, null, null, aboveSystem, "keyDispatchingTimedOut");
+            final ProcessRecord pr = proc;
+            mHandler.post(new Runnable() {
+                @Override
+                public void run() {
+                    appNotResponding(pr, null, null, aboveSystem, "keyDispatchingTimedOut");
+                }
+            });
             if (proc.instrumentationClass != null || proc.usingWrapper) {
                 return INSTRUMENTATION_KEY_DISPATCHING_TIMEOUT;
             }