From c8733b818d9e7eef0d986128f16d12145486b69f Mon Sep 17 00:00:00 2001 From: Martin Wallgren Date: Wed, 31 Aug 2011 12:39:31 +0200 Subject: [PATCH] Keydispatching timeout while finish Activity If there is input to be handled during finish activity we can get a keydispatching timeout ANR. The reason is that finish activity is some times not possible, and the activity is instead put on a finish queue. The activity will then be finished sometime in the future. When we add the activity to the finish queue, key dispatching is paused, and there is an ANR timer waiting for it to be resumed again. Since it can take a long time before the activity is actually finished, we need to resume the key dispatching to avoid the ANR. Change-Id: Icea4ab3b5ad05c8bfbadf8f5cece1a59ec621469 --- services/java/com/android/server/am/ActivityStack.java | 1 + 1 file changed, 1 insertion(+) diff --git a/services/java/com/android/server/am/ActivityStack.java b/services/java/com/android/server/am/ActivityStack.java index 47593f27a77f4..37f4cd7a32af3 100644 --- a/services/java/com/android/server/am/ActivityStack.java +++ b/services/java/com/android/server/am/ActivityStack.java @@ -2526,6 +2526,7 @@ final class ActivityStack { // activity into the stopped state and then finish it. if (localLOGV) Slog.v(TAG, "Enqueueing pending finish: " + r); mStackSupervisor.mFinishingActivities.add(r); + r.resumeKeyDispatchingLocked(); mStackSupervisor.getFocusedStack().resumeTopActivityLocked(null); return r; }