From c64f73e7785507152358fbfa89be0ce7a0196692 Mon Sep 17 00:00:00 2001 From: Craig Mautner Date: Wed, 24 Apr 2013 16:44:56 -0700 Subject: Fix startActivityAndWait bugs - Send timeout message with a delay. The delay got lost when moving from ActivityStack to ActivityStackSupervisor. Fixes bug 8687083. - Remove waiting activities from list after they have been awoken. Previously the list just got bigger and bigger. Change-Id: Icb9e394db1eefa444e58c5416472017cac32298c --- services/java/com/android/server/am/ActivityStackSupervisor.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/services/java/com/android/server/am/ActivityStackSupervisor.java b/services/java/com/android/server/am/ActivityStackSupervisor.java index 528bf6fb2a6b..82944a96f717 100644 --- a/services/java/com/android/server/am/ActivityStackSupervisor.java +++ b/services/java/com/android/server/am/ActivityStackSupervisor.java @@ -438,7 +438,7 @@ public class ActivityStackSupervisor { void reportActivityLaunchedLocked(boolean timeout, ActivityRecord r, long thisTime, long totalTime) { for (int i = mWaitingActivityLaunched.size() - 1; i >= 0; i--) { - WaitResult w = mWaitingActivityLaunched.get(i); + WaitResult w = mWaitingActivityLaunched.remove(i); w.timeout = timeout; if (r != null) { w.who = new ComponentName(r.info.packageName, r.info.name); @@ -2182,7 +2182,8 @@ public class ActivityStackSupervisor { } void scheduleIdleTimeoutLocked(ActivityRecord next) { - mHandler.obtainMessage(IDLE_TIMEOUT_MSG, next).sendToTarget(); + Message msg = mHandler.obtainMessage(IDLE_TIMEOUT_MSG, next); + mHandler.sendMessageDelayed(msg, IDLE_TIMEOUT); } final void scheduleIdleLocked() { -- cgit v1.2.3-59-g8ed1b