Skip to content

Commit dbad287

Browse files
committed
Issue: Foreground activity performs [Resume] and [Pause] when any process died in sleep mode.
Step to Reproduce 1) Turn off device’s screen. (Sleep mode) 2) Kill any process. A. Engineer Version: kill [PID] B. User Version: am force-stop [Package Name] 3) Foreground activity proceed [Resume] and [Pause] consecutively. Reason: Since ICS version, activity goes to stopped status when screen turns off. stopIfSleepingLocked( ) makes activity to stopped status but, pauseIfSleepingLocked( ) was used in GB and, activity keep paused status and, this problem did not occur. This change give effect to resuming activity when any process was killed. Because, resume is proceed without exception for activity status. The exception only filtered for [ActivityState.PAUSED] in sleep or shutdown mode. and, resume complete flow when activity status was [ActivityState.STOPPED]. Solution for this issue: We think that exception’s condition have to change if stopped activity status is intended in sleep mode. According to activity life cycle, activity can not resume from stop status. Also check [ActivityState.STOPPING]. :) Change-Id: Icca3366ac30ffa3b18f6e2393e4d7309089ef26a
1 parent 544f89a commit dbad287

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

services/java/com/android/server/am/ActivityStack.java

100644100755
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1314,7 +1314,10 @@ final boolean resumeTopActivityLocked(ActivityRecord prev) {
13141314
// If we are sleeping, and there is no resumed activity, and the top
13151315
// activity is paused, well that is the state we want.
13161316
if ((mService.mSleeping || mService.mShuttingDown)
1317-
&& mLastPausedActivity == next && next.state == ActivityState.PAUSED) {
1317+
&& mLastPausedActivity == next
1318+
&& (next.state == ActivityState.PAUSED
1319+
|| next.state == ActivityState.STOPPED
1320+
|| next.state == ActivityState.STOPPING)) {
13181321
// Make sure we have executed any pending transitions, since there
13191322
// should be nothing left to do at this point.
13201323
mService.mWindowManager.executeAppTransition();

0 commit comments

Comments
 (0)