From e9c1c319c70ab30aa53c029b6d54342230df3725 Mon Sep 17 00:00:00 2001 From: Yunfan Chen Date: Thu, 18 Apr 2019 14:49:15 +0900 Subject: [PATCH] Restore window to undefined instead of freeform windowing mode On freeform display, this will act in the exact same way as before. When click the restore button to switch windowing mode, it will get into freeform windowing mode. This patch makes a difference when the display runtime changes from freeform to fullscreen. If the window restored to undefined, when the runtime change happens, it can properly match the parent's windowing mode. Otherwise, we will see a freeform window on fullscreen display without any explicit user action. Bug: 128853293 Test: manual Test: go/wm-smoke Change-Id: I12480dedbdea3da65f7fa925eed0fa5664c76f5b --- .../com/android/server/wm/ActivityTaskManagerService.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/services/core/java/com/android/server/wm/ActivityTaskManagerService.java b/services/core/java/com/android/server/wm/ActivityTaskManagerService.java index 3fa0268739537..3cab3d8b1d45c 100644 --- a/services/core/java/com/android/server/wm/ActivityTaskManagerService.java +++ b/services/core/java/com/android/server/wm/ActivityTaskManagerService.java @@ -3372,6 +3372,11 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { if (stack.inFreeformWindowingMode()) { stack.setWindowingMode(WINDOWING_MODE_FULLSCREEN); + } else if (stack.getParent().inFreeformWindowingMode()) { + // If the window is on a freeform display, set it to undefined. It will be + // resolved to freeform and it can adjust windowing mode when the display mode + // changes in runtime. + stack.setWindowingMode(WINDOWING_MODE_UNDEFINED); } else { stack.setWindowingMode(WINDOWING_MODE_FREEFORM); }