Merge "Update visibility logic in realStartActivityLocked"
diff --git a/services/core/java/com/android/server/am/ActivityStackSupervisor.java b/services/core/java/com/android/server/am/ActivityStackSupervisor.java
index 4a29872..65c768f 100644
--- a/services/core/java/com/android/server/am/ActivityStackSupervisor.java
+++ b/services/core/java/com/android/server/am/ActivityStackSupervisor.java
@@ -1225,13 +1225,11 @@
             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
@@ -1281,17 +1279,16 @@
             List<ResultInfo> results = null;
             List<ReferrerIntent> 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;
@@ -1331,10 +1328,8 @@
                 }
             }
 
-            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