From 8dc8bdaae5e27c6501805370c826eead2f6c741b Mon Sep 17 00:00:00 2001 From: Tony Huang Date: Tue, 20 Jul 2021 10:50:53 +0800 Subject: [PATCH] Fix stage split rotation On current implementation, it will use DC.getLastOrientation in TDA#getOrientation, it will got SCREEN_ORIENTATION_NOSENSOR so it didn't rotate. Fix this by adding checking if TDA non floating root task is visible and creadted by organize, it should all use SCREEN_ORIENTATION_UNSPECIFIED. Fix: 194158966 Test: active stage split and rotate divice Change-Id: Id78ebae24150e5d5f901b0f85c5a86cefe1d453f --- .../java/com/android/server/wm/TaskDisplayArea.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/services/core/java/com/android/server/wm/TaskDisplayArea.java b/services/core/java/com/android/server/wm/TaskDisplayArea.java index 10c16ff96a164..6c8cde433481f 100644 --- a/services/core/java/com/android/server/wm/TaskDisplayArea.java +++ b/services/core/java/com/android/server/wm/TaskDisplayArea.java @@ -780,10 +780,12 @@ final class TaskDisplayArea extends DisplayArea { } return SCREEN_ORIENTATION_UNSPECIFIED; } else { - // Apps and their containers are not allowed to specify an orientation of full screen - // tasks created by organizer. The organizer handles the orientation instead. - final Task task = getTopRootTaskInWindowingMode(WINDOWING_MODE_FULLSCREEN); - if (task != null && task.isVisible() && task.mCreatedByOrganizer) { + // Apps and their containers are not allowed to specify an orientation of non floating + // visible tasks created by organizer. The organizer handles the orientation instead. + final Task nonFloatingTopTask = + getRootTask(t -> !t.getWindowConfiguration().tasksAreFloating()); + if (nonFloatingTopTask != null && nonFloatingTopTask.mCreatedByOrganizer + && nonFloatingTopTask.isVisible()) { return SCREEN_ORIENTATION_UNSPECIFIED; } }