From 5c494547af1e4558aea5994b60afaadefef971e1 Mon Sep 17 00:00:00 2001 From: Craig Mautner Date: Fri, 6 Sep 2013 11:59:38 -0700 Subject: [PATCH] When waiting for activity to finish don't reset In cases where the client is waiting for an activity to launch (startActivityMayWait()) it is a bad idea to clear ActivityRecord.displayStartTime when going into the pause state. If displayStartTime is cleared before the activity is displayed, the client will never be released. This fix keeps pause from clearing displayStartTime if any client is waiting for the activity to be displayed. Fixes bug 10095558. But not a permanent fix, startActivityMayWait() should not be called by any production code. Change-Id: I7cbdcb04256f4a26233867c52aedd3bc4151adc3 --- services/java/com/android/server/am/ActivityStack.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/services/java/com/android/server/am/ActivityStack.java b/services/java/com/android/server/am/ActivityStack.java index 8d27c5cb39b42..3571b40915513 100644 --- a/services/java/com/android/server/am/ActivityStack.java +++ b/services/java/com/android/server/am/ActivityStack.java @@ -620,7 +620,13 @@ final class ActivityStack { } void clearLaunchTime(ActivityRecord r) { - r.displayStartTime = r.fullyDrawnStartTime = 0; + // Make sure that there is no activity waiting for this to launch. + if (mStackSupervisor.mWaitingActivityLaunched.isEmpty()) { + r.displayStartTime = r.fullyDrawnStartTime = 0; + } else { + mStackSupervisor.removeTimeoutsForActivityLocked(r); + mStackSupervisor.scheduleIdleTimeoutLocked(r); + } } void awakeFromSleepingLocked() {