summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Wale Ogunwale <ogunwale@google.com> 2016-09-06 10:37:56 -0700
committer Wale Ogunwale <ogunwale@google.com> 2016-09-07 13:16:57 -0700
commit3e99736b61dae559314ce90db68ee40602fa84e5 (patch)
treedf6c949f7ec4cf6a033835fc9bb734ef54675096
parent57e29b4b9e576dd60b7b5fe166186105cb003a9d (diff)
Moved activity to stopped state if relaunched while device is asleep
- If an activity is done relaunching and the device is sleeping or shutting down, go ahead and force the activity to sleep which will transition it into the stopped state. We do this after the activity is relaunched as activities can currently only relaunch into the resumed or paused state both of which are visible state. However, the activity should be in the stopped state while the device is sleeping. - Also removed previous fix for b/28518380 that prevents activities from relaunching due to configuration changes while the device is sleeping. We need to allow relaunches due to configuration changes while the device is sleeping so the things are responsive when you wake-up the device. And, it is no longer a big deal since we are transitioning the activity to the stop state when the relaunch is complete. Bug: 30253333 Bug: 28518380 Change-Id: I5313c13a13c2d2f9bb43831797918d9e67a30cda
-rwxr-xr-xservices/core/java/com/android/server/am/ActivityRecord.java8
-rw-r--r--services/core/java/com/android/server/am/ActivityStack.java9
-rw-r--r--services/core/java/com/android/server/am/ActivityStackSupervisor.java6
3 files changed, 12 insertions, 11 deletions
diff --git a/services/core/java/com/android/server/am/ActivityRecord.java b/services/core/java/com/android/server/am/ActivityRecord.java
index 489eb77729e3..f374c09db285 100755
--- a/services/core/java/com/android/server/am/ActivityRecord.java
+++ b/services/core/java/com/android/server/am/ActivityRecord.java
@@ -1309,8 +1309,12 @@ final class ActivityRecord {
state == ActivityState.RESUMED;
}
- public void setSleeping(boolean _sleeping) {
- if (sleeping == _sleeping) {
+ void setSleeping(boolean _sleeping) {
+ setSleeping(_sleeping, false);
+ }
+
+ void setSleeping(boolean _sleeping, boolean force) {
+ if (!force && sleeping == _sleeping) {
return;
}
if (app != null && app.thread != null) {
diff --git a/services/core/java/com/android/server/am/ActivityStack.java b/services/core/java/com/android/server/am/ActivityStack.java
index 2722e275c00d..b4303c50296c 100644
--- a/services/core/java/com/android/server/am/ActivityStack.java
+++ b/services/core/java/com/android/server/am/ActivityStack.java
@@ -4512,15 +4512,6 @@ final class ActivityStack {
return true;
}
- // TODO: We could probably make the condition below just check that the activity state is
- // stopped, but also checking the sleep state for now to reduce change impact late in
- // development cycle.
- if (mService.isSleepingOrShuttingDownLocked() && r.state == ActivityState.STOPPED) {
- if (DEBUG_SWITCH || DEBUG_CONFIGURATION) Slog.v(TAG_CONFIGURATION,
- "Skipping config check (stopped while sleeping): " + r);
- return true;
- }
-
if (DEBUG_SWITCH || DEBUG_CONFIGURATION) Slog.v(TAG_CONFIGURATION,
"Ensuring correct configuration: " + r);
diff --git a/services/core/java/com/android/server/am/ActivityStackSupervisor.java b/services/core/java/com/android/server/am/ActivityStackSupervisor.java
index 1cb83d282c4c..c559b84bd7fd 100644
--- a/services/core/java/com/android/server/am/ActivityStackSupervisor.java
+++ b/services/core/java/com/android/server/am/ActivityStackSupervisor.java
@@ -3708,6 +3708,12 @@ public final class ActivityStackSupervisor implements DisplayListener {
void activityRelaunchedLocked(IBinder token) {
mWindowManager.notifyAppRelaunchingFinished(token);
+ if (mService.isSleepingOrShuttingDownLocked()) {
+ final ActivityRecord r = ActivityRecord.isInStackLocked(token);
+ if (r != null) {
+ r.setSleeping(true, true);
+ }
+ }
}
void activityRelaunchingLocked(ActivityRecord r) {