From 823af6ed267e1c9989c5a293007577b8479e4ad4 Mon Sep 17 00:00:00 2001 From: Andrii Kulian Date: Wed, 28 Feb 2018 18:51:36 -0800 Subject: DO NOT MERGE Don't send config change when display is removed When a private display is removed, we're finishing all activities that were on that display. But because the display will not be available during activity finish process, we're fist moving all stacks to the back of the default display, so that the removed display won't be referenced accidentally. This, however, can cause an additional resize message to the client from the WindowManager if the size of the default display is different, which will cause a configuration change. To avoid that this CL freezes the config of the stacks being finished by overriding to their current configs. Bug: 73379938 Test: ActivityManagerMultiDisplayTests#testContentDestroyOnDisplayRemoved Change-Id: I20e0becab097075ccb84e471e366a2ace37ab7cc (cherry picked from commit dce1da45cadda2c9278b7fa57731e8a854e44cc6) --- services/core/java/com/android/server/am/ActivityDisplay.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/services/core/java/com/android/server/am/ActivityDisplay.java b/services/core/java/com/android/server/am/ActivityDisplay.java index bac81e7cd4a2..dd83a36b99d8 100644 --- a/services/core/java/com/android/server/am/ActivityDisplay.java +++ b/services/core/java/com/android/server/am/ActivityDisplay.java @@ -664,6 +664,10 @@ class ActivityDisplay extends ConfigurationContainer while (getChildCount() > 0) { final ActivityStack stack = getChildAt(0); if (destroyContentOnRemoval) { + // Override the stack configuration to make it equal to the current applied one, so + // that we don't accidentally report configuration change to activities that are + // going to be finished. + stack.onOverrideConfigurationChanged(stack.getConfiguration()); mSupervisor.moveStackToDisplayLocked(stack.mStackId, DEFAULT_DISPLAY, false /* onTop */); stack.finishAllActivitiesLocked(true /* immediately */); -- cgit v1.2.3-59-g8ed1b