Update configuration of all visible activities in a stack when resizing

Previously we were only updating configuration for the top activity in
the stack during resizing. This caused an activity behind the top
translucent activity to continue to display in the old configuration
and also get relaunched without window preservation when the top
translucent activity is finished.
We now make sure all activities at all below a translucent activity
have their configuration updated during resizing.

Bug: 28762547
Change-Id: I0926ac6db088cdf3f6a225c552dbfbe944830f68
diff --git a/services/core/java/com/android/server/am/ActivityStackSupervisor.java b/services/core/java/com/android/server/am/ActivityStackSupervisor.java
index 4bf28b2..a0e2512 100644
--- a/services/core/java/com/android/server/am/ActivityStackSupervisor.java
+++ b/services/core/java/com/android/server/am/ActivityStackSupervisor.java
@@ -2014,8 +2014,8 @@
         try {
             resizeStackUncheckedLocked(stack, bounds, tempTaskBounds, tempTaskInsetBounds);
             if (!deferResume) {
-                ensureConfigurationAndResume(
-                        stack, stack.topRunningActivityLocked(), preserveWindows);
+                stack.ensureVisibleActivitiesConfigurationLocked(
+                        stack.topRunningActivityLocked(), preserveWindows);
             }
         } finally {
             mWindowManager.continueSurfaceLayout();
@@ -2091,18 +2091,6 @@
         stack.setBounds(bounds);
     }
 
-    private void ensureConfigurationAndResume(ActivityStack stack, ActivityRecord r,
-            boolean preserveWindows) {
-        if (r == null || !r.visible) {
-            return;
-        }
-        final boolean updated = stack.ensureActivityConfigurationLocked(r, 0,
-                preserveWindows);
-        if (!updated) {
-            resumeFocusedStackTopActivityLocked();
-        }
-    }
-
     void moveTasksToFullscreenStackLocked(int fromStackId, boolean onTop) {
         final ActivityStack stack = getStack(fromStackId);
         if (stack == null) {
@@ -2204,7 +2192,7 @@
                     }
                 }
             }
-            ensureConfigurationAndResume(stack, r, preserveWindows);
+            stack.ensureVisibleActivitiesConfigurationLocked(r, preserveWindows);
         } finally {
             mAllowDockedStackResize = true;
             mWindowManager.continueSurfaceLayout();
@@ -2230,7 +2218,7 @@
             ActivityRecord r = stack.topRunningActivityLocked();
             resizeStackUncheckedLocked(stack, pinnedBounds, tempPinnedTaskBounds,
                     null);
-            ensureConfigurationAndResume(stack, r, false);
+            stack.ensureVisibleActivitiesConfigurationLocked(r, false);
         } finally {
             mWindowManager.continueSurfaceLayout();
             Trace.traceEnd(TRACE_TAG_ACTIVITY_MANAGER);