More multi-window fixes

- When exiting multi-window (taskOverride gets EMPTY), emulate
the same task configuration so we don't end up with unnecessary
relaunches.
- Fix flicker by not calling WM.setAppVisibility if the app is
already visible. setAppVisibility makes a dummy transition,
which sets the transformation's alpha to zero if we think that
the app is not visible, which is the case because the app is in
DRAW_PENDING state because we are waiting for it to exit the
dragResize mode, but it's really visible.

Change-Id: Ieb4f586ae86e1185b21a901c57883a1f19d58fee
diff --git a/services/core/java/com/android/server/am/ActivityStack.java b/services/core/java/com/android/server/am/ActivityStack.java
index 5a0c1c1..c352fc8 100644
--- a/services/core/java/com/android/server/am/ActivityStack.java
+++ b/services/core/java/com/android/server/am/ActivityStack.java
@@ -2168,7 +2168,9 @@
             if (DEBUG_SWITCH) Slog.v(TAG_SWITCH, "Resume running: " + next);
 
             // This activity is now becoming visible.
-            mWindowManager.setAppVisibility(next.appToken, true);
+            if (!next.visible) {
+                mWindowManager.setAppVisibility(next.appToken, true);
+            }
 
             // schedule launch ticks to collect information about slow apps.
             next.startLaunchTickingLocked();
@@ -4304,6 +4306,12 @@
             oldTaskOverride = record.task.extractOverrideConfig(record.configuration);
         }
 
+        // Conversely, do the same when going the other direction.
+        if (Configuration.EMPTY.equals(taskConfig)
+                && !Configuration.EMPTY.equals(oldTaskOverride)) {
+            taskConfig = record.task.extractOverrideConfig(record.configuration);
+        }
+
         // Determine what has changed.  May be nothing, if this is a config
         // that has come back from the app after going idle.  In that case
         // we just want to leave the official config object now in the