Add getAdjacentTaskFragment check for the split screen case

Previously, the root task created by kids mode would be treated the same
as split screen to return SCREEN_ORIENTATION_UNSPECIFIED.

Now, also check getAdjacentTaskFragment != null for the split
screen case, so that apps in the kids mode root task will work as
expect.

Bug: 231575466
Test: - Enter kids mode -> rotate device
        - apps should follow their request orientations
      - Enter split screen(not in kids mode) -> rotate device
        - tasks should be rotated
Change-Id: I930e162ef74d114ba2375eae03e13f7ccdd34baa
This commit is contained in:
Shawn Lin
2022-05-13 09:35:17 +00:00
parent e563a237aa
commit 84289d3985

View File

@@ -654,12 +654,14 @@ final class TaskDisplayArea extends DisplayArea<WindowContainer> {
}
// 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.
// visible tasks created by organizer and that has an adjacent task.
final Task nonFloatingTopTask =
getRootTask(t -> !t.getWindowConfiguration().tasksAreFloating());
if (nonFloatingTopTask != null && nonFloatingTopTask.mCreatedByOrganizer
&& nonFloatingTopTask.isVisible()) {
return SCREEN_ORIENTATION_UNSPECIFIED;
getTask(t -> !t.getWindowConfiguration().tasksAreFloating());
if (nonFloatingTopTask != null) {
final Task task = nonFloatingTopTask.getCreatedByOrganizerTask();
if (task != null && task.getAdjacentTaskFragment() != null && task.isVisible()) {
return SCREEN_ORIENTATION_UNSPECIFIED;
}
}
final int orientation = super.getOrientation(candidate);