From ada1029eb89a052c4fac159764cac363dd1933ef Mon Sep 17 00:00:00 2001 From: Andrii Kulian Date: Thu, 9 Feb 2017 23:19:29 -0800 Subject: [PATCH] Update visibility logic in realStartActivityLocked ActivityStackSupervisor#realStartActivityLocked method is updated to perform some actions regardless of whether we're making acitivity resumed or not. This is possible because at the end in either way activity will be visible. Bug: 29619461 Test: Manual Change-Id: If83ee38683e7ece52a0ae0a70bec0bdce6a195d3 --- .../server/am/ActivityStackSupervisor.java | 25 ++++++++----------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/services/core/java/com/android/server/am/ActivityStackSupervisor.java b/services/core/java/com/android/server/am/ActivityStackSupervisor.java index da7dc7d8b0ee6..51d9179c92a00 100644 --- a/services/core/java/com/android/server/am/ActivityStackSupervisor.java +++ b/services/core/java/com/android/server/am/ActivityStackSupervisor.java @@ -1221,13 +1221,11 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D return false; } - if (andResume) { - r.startFreezingScreenLocked(app, 0); - r.setVisibility(true); + r.startFreezingScreenLocked(app, 0); + r.setVisibility(true); - // schedule launch ticks to collect information about slow apps. - r.startLaunchTickingLocked(); - } + // schedule launch ticks to collect information about slow apps. + r.startLaunchTickingLocked(); // Have the window manager re-evaluate the orientation of the screen based on the new // activity order. Note that as a result of this, it can call back into the activity @@ -1277,17 +1275,16 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D List results = null; List newIntents = null; if (andResume) { + // We don't need to deliver new intents and/or set results if activity is going + // to pause immediately after launch. results = r.results; newIntents = r.newIntents; } if (DEBUG_SWITCH) Slog.v(TAG_SWITCH, "Launching: " + r + " icicle=" + r.icicle + " with results=" + results + " newIntents=" + newIntents + " andResume=" + andResume); - if (andResume) { - EventLog.writeEvent(EventLogTags.AM_RESTART_ACTIVITY, - r.userId, System.identityHashCode(r), - task.taskId, r.shortComponentName); - } + EventLog.writeEvent(EventLogTags.AM_RESTART_ACTIVITY, r.userId, + System.identityHashCode(r), task.taskId, r.shortComponentName); if (r.isHomeActivity()) { // Home process is the root process of the task. mService.mHomeProcess = task.mActivities.get(0).app; @@ -1327,10 +1324,8 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D } } - if (andResume) { - app.hasShownUi = true; - app.pendingUiClean = true; - } + app.hasShownUi = true; + app.pendingUiClean = true; app.forceProcessStateUpTo(mService.mTopProcessState); // Because we could be starting an Activity in the system process this may not go across // a Binder interface which would create a new Configuration. Consequently we have to