Loading core/java/android/app/TaskInfo.java +13 −2 Original line number Diff line number Diff line Loading @@ -254,6 +254,12 @@ public class TaskInfo { */ public boolean isUserFullscreenOverrideEnabled; /** * Whether the top activity fillsParent() is false * @hide */ public boolean isTopActivityTransparent; /** * Hint about the letterbox state of the top activity. * @hide Loading Loading @@ -551,7 +557,8 @@ public class TaskInfo { && Objects.equals(mTopActivityLocusId, that.mTopActivityLocusId) && parentTaskId == that.parentTaskId && Objects.equals(topActivity, that.topActivity) && isUserFullscreenOverrideEnabled == that.isUserFullscreenOverrideEnabled; && isUserFullscreenOverrideEnabled == that.isUserFullscreenOverrideEnabled && isTopActivityTransparent == that.isTopActivityTransparent; } /** Loading Loading @@ -584,7 +591,8 @@ public class TaskInfo { && (!hasCompatUI() || configuration.uiMode == that.configuration.uiMode) && (!hasCompatUI() || isVisible == that.isVisible) && isFocused == that.isFocused && isUserFullscreenOverrideEnabled == that.isUserFullscreenOverrideEnabled; && isUserFullscreenOverrideEnabled == that.isUserFullscreenOverrideEnabled && isTopActivityTransparent == that.isTopActivityTransparent; } /** Loading Loading @@ -641,6 +649,7 @@ public class TaskInfo { topActivityLetterboxWidth = source.readInt(); topActivityLetterboxHeight = source.readInt(); isUserFullscreenOverrideEnabled = source.readBoolean(); isTopActivityTransparent = source.readBoolean(); } /** Loading Loading @@ -698,6 +707,7 @@ public class TaskInfo { dest.writeInt(topActivityLetterboxWidth); dest.writeInt(topActivityLetterboxHeight); dest.writeBoolean(isUserFullscreenOverrideEnabled); dest.writeBoolean(isTopActivityTransparent); } @Override Loading Loading @@ -745,6 +755,7 @@ public class TaskInfo { + " topActivityLetterboxWidth=" + topActivityLetterboxWidth + " topActivityLetterboxHeight=" + topActivityLetterboxHeight + " isUserFullscreenOverrideEnabled=" + isUserFullscreenOverrideEnabled + " isTopActivityTransparent=" + isTopActivityTransparent + " locusId=" + mTopActivityLocusId + " displayAreaFeatureId=" + displayAreaFeatureId + " cameraCompatControlState=" Loading libs/WindowManager/Shell/src/com/android/wm/shell/compatui/CompatUIController.java +2 −1 Original line number Diff line number Diff line Loading @@ -348,7 +348,8 @@ public class CompatUIController implements OnDisplaysChangedListener, // as they are still relevant. Else, if the activity is visible and focused (the one the // user can see and is using), the user aspect ratio button can potentially be displayed so // start tracking the buttons visibility for this task. if (mTopActivityTaskId != taskInfo.taskId && taskInfo.isVisible && taskInfo.isFocused) { if (mTopActivityTaskId != taskInfo.taskId && !taskInfo.isTopActivityTransparent && taskInfo.isVisible && taskInfo.isFocused) { mTopActivityTaskId = taskInfo.taskId; setHasShownUserAspectRatioSettingsButton(false); } Loading libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/compatui/CompatUIControllerTest.java +45 −1 Original line number Diff line number Diff line Loading @@ -633,15 +633,58 @@ public class CompatUIControllerTest extends ShellTestCase { Assert.assertTrue(mController.hasShownUserAspectRatioSettingsButton()); } @Test public void testUpdateActiveTaskInfo_transparentTask_notUpdated() { // Create new task final TaskInfo taskInfo = createTaskInfo(DISPLAY_ID, TASK_ID, /* hasSizeCompat= */ true, CAMERA_COMPAT_CONTROL_HIDDEN, /* isVisible */ true, /* isFocused */ true); // Simulate new task being shown mController.updateActiveTaskInfo(taskInfo); // Check topActivityTaskId is updated to the taskId of the new task and // hasShownUserAspectRatioSettingsButton has been reset to false Assert.assertEquals(TASK_ID, mController.getTopActivityTaskId()); Assert.assertFalse(mController.hasShownUserAspectRatioSettingsButton()); // Simulate user aspect ratio button being shown mController.setHasShownUserAspectRatioSettingsButton(true); Assert.assertTrue(mController.hasShownUserAspectRatioSettingsButton()); final int newTaskId = TASK_ID + 1; // Create transparent task final TaskInfo taskInfo1 = createTaskInfo(DISPLAY_ID, newTaskId, /* hasSizeCompat= */ true, CAMERA_COMPAT_CONTROL_HIDDEN, /* isVisible */ true, /* isFocused */ true, /* isTopActivityTransparent */ true); // Simulate new task being shown mController.updateActiveTaskInfo(taskInfo1); // Check topActivityTaskId is NOT updated and hasShownUserAspectRatioSettingsButton // remains true Assert.assertEquals(TASK_ID, mController.getTopActivityTaskId()); Assert.assertTrue(mController.hasShownUserAspectRatioSettingsButton()); } private static TaskInfo createTaskInfo(int displayId, int taskId, boolean hasSizeCompat, @CameraCompatControlState int cameraCompatControlState) { return createTaskInfo(displayId, taskId, hasSizeCompat, cameraCompatControlState, /* isVisible */ false, /* isFocused */ false); /* isVisible */ false, /* isFocused */ false, /* isTopActivityTransparent */ false); } private static TaskInfo createTaskInfo(int displayId, int taskId, boolean hasSizeCompat, @CameraCompatControlState int cameraCompatControlState, boolean isVisible, boolean isFocused) { return createTaskInfo(displayId, taskId, hasSizeCompat, cameraCompatControlState, isVisible, isFocused, /* isTopActivityTransparent */ false); } private static TaskInfo createTaskInfo(int displayId, int taskId, boolean hasSizeCompat, @CameraCompatControlState int cameraCompatControlState, boolean isVisible, boolean isFocused, boolean isTopActivityTransparent) { RunningTaskInfo taskInfo = new RunningTaskInfo(); taskInfo.taskId = taskId; taskInfo.displayId = displayId; Loading @@ -649,6 +692,7 @@ public class CompatUIControllerTest extends ShellTestCase { taskInfo.cameraCompatControlState = cameraCompatControlState; taskInfo.isVisible = isVisible; taskInfo.isFocused = isFocused; taskInfo.isTopActivityTransparent = isTopActivityTransparent; return taskInfo; } } services/core/java/com/android/server/wm/Task.java +1 −0 Original line number Diff line number Diff line Loading @@ -3461,6 +3461,7 @@ class Task extends TaskFragment { info.topActivityLetterboxHeight = TaskInfo.PROPERTY_VALUE_UNSET; info.isUserFullscreenOverrideEnabled = top != null && top.mLetterboxUiController.shouldApplyUserFullscreenOverride(); info.isTopActivityTransparent = top != null && !top.fillsParent(); info.isFromLetterboxDoubleTap = top != null && top.mLetterboxUiController.isFromDoubleTap(); if (info.isLetterboxDoubleTapEnabled) { info.topActivityLetterboxWidth = top.getBounds().width(); Loading Loading
core/java/android/app/TaskInfo.java +13 −2 Original line number Diff line number Diff line Loading @@ -254,6 +254,12 @@ public class TaskInfo { */ public boolean isUserFullscreenOverrideEnabled; /** * Whether the top activity fillsParent() is false * @hide */ public boolean isTopActivityTransparent; /** * Hint about the letterbox state of the top activity. * @hide Loading Loading @@ -551,7 +557,8 @@ public class TaskInfo { && Objects.equals(mTopActivityLocusId, that.mTopActivityLocusId) && parentTaskId == that.parentTaskId && Objects.equals(topActivity, that.topActivity) && isUserFullscreenOverrideEnabled == that.isUserFullscreenOverrideEnabled; && isUserFullscreenOverrideEnabled == that.isUserFullscreenOverrideEnabled && isTopActivityTransparent == that.isTopActivityTransparent; } /** Loading Loading @@ -584,7 +591,8 @@ public class TaskInfo { && (!hasCompatUI() || configuration.uiMode == that.configuration.uiMode) && (!hasCompatUI() || isVisible == that.isVisible) && isFocused == that.isFocused && isUserFullscreenOverrideEnabled == that.isUserFullscreenOverrideEnabled; && isUserFullscreenOverrideEnabled == that.isUserFullscreenOverrideEnabled && isTopActivityTransparent == that.isTopActivityTransparent; } /** Loading Loading @@ -641,6 +649,7 @@ public class TaskInfo { topActivityLetterboxWidth = source.readInt(); topActivityLetterboxHeight = source.readInt(); isUserFullscreenOverrideEnabled = source.readBoolean(); isTopActivityTransparent = source.readBoolean(); } /** Loading Loading @@ -698,6 +707,7 @@ public class TaskInfo { dest.writeInt(topActivityLetterboxWidth); dest.writeInt(topActivityLetterboxHeight); dest.writeBoolean(isUserFullscreenOverrideEnabled); dest.writeBoolean(isTopActivityTransparent); } @Override Loading Loading @@ -745,6 +755,7 @@ public class TaskInfo { + " topActivityLetterboxWidth=" + topActivityLetterboxWidth + " topActivityLetterboxHeight=" + topActivityLetterboxHeight + " isUserFullscreenOverrideEnabled=" + isUserFullscreenOverrideEnabled + " isTopActivityTransparent=" + isTopActivityTransparent + " locusId=" + mTopActivityLocusId + " displayAreaFeatureId=" + displayAreaFeatureId + " cameraCompatControlState=" Loading
libs/WindowManager/Shell/src/com/android/wm/shell/compatui/CompatUIController.java +2 −1 Original line number Diff line number Diff line Loading @@ -348,7 +348,8 @@ public class CompatUIController implements OnDisplaysChangedListener, // as they are still relevant. Else, if the activity is visible and focused (the one the // user can see and is using), the user aspect ratio button can potentially be displayed so // start tracking the buttons visibility for this task. if (mTopActivityTaskId != taskInfo.taskId && taskInfo.isVisible && taskInfo.isFocused) { if (mTopActivityTaskId != taskInfo.taskId && !taskInfo.isTopActivityTransparent && taskInfo.isVisible && taskInfo.isFocused) { mTopActivityTaskId = taskInfo.taskId; setHasShownUserAspectRatioSettingsButton(false); } Loading
libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/compatui/CompatUIControllerTest.java +45 −1 Original line number Diff line number Diff line Loading @@ -633,15 +633,58 @@ public class CompatUIControllerTest extends ShellTestCase { Assert.assertTrue(mController.hasShownUserAspectRatioSettingsButton()); } @Test public void testUpdateActiveTaskInfo_transparentTask_notUpdated() { // Create new task final TaskInfo taskInfo = createTaskInfo(DISPLAY_ID, TASK_ID, /* hasSizeCompat= */ true, CAMERA_COMPAT_CONTROL_HIDDEN, /* isVisible */ true, /* isFocused */ true); // Simulate new task being shown mController.updateActiveTaskInfo(taskInfo); // Check topActivityTaskId is updated to the taskId of the new task and // hasShownUserAspectRatioSettingsButton has been reset to false Assert.assertEquals(TASK_ID, mController.getTopActivityTaskId()); Assert.assertFalse(mController.hasShownUserAspectRatioSettingsButton()); // Simulate user aspect ratio button being shown mController.setHasShownUserAspectRatioSettingsButton(true); Assert.assertTrue(mController.hasShownUserAspectRatioSettingsButton()); final int newTaskId = TASK_ID + 1; // Create transparent task final TaskInfo taskInfo1 = createTaskInfo(DISPLAY_ID, newTaskId, /* hasSizeCompat= */ true, CAMERA_COMPAT_CONTROL_HIDDEN, /* isVisible */ true, /* isFocused */ true, /* isTopActivityTransparent */ true); // Simulate new task being shown mController.updateActiveTaskInfo(taskInfo1); // Check topActivityTaskId is NOT updated and hasShownUserAspectRatioSettingsButton // remains true Assert.assertEquals(TASK_ID, mController.getTopActivityTaskId()); Assert.assertTrue(mController.hasShownUserAspectRatioSettingsButton()); } private static TaskInfo createTaskInfo(int displayId, int taskId, boolean hasSizeCompat, @CameraCompatControlState int cameraCompatControlState) { return createTaskInfo(displayId, taskId, hasSizeCompat, cameraCompatControlState, /* isVisible */ false, /* isFocused */ false); /* isVisible */ false, /* isFocused */ false, /* isTopActivityTransparent */ false); } private static TaskInfo createTaskInfo(int displayId, int taskId, boolean hasSizeCompat, @CameraCompatControlState int cameraCompatControlState, boolean isVisible, boolean isFocused) { return createTaskInfo(displayId, taskId, hasSizeCompat, cameraCompatControlState, isVisible, isFocused, /* isTopActivityTransparent */ false); } private static TaskInfo createTaskInfo(int displayId, int taskId, boolean hasSizeCompat, @CameraCompatControlState int cameraCompatControlState, boolean isVisible, boolean isFocused, boolean isTopActivityTransparent) { RunningTaskInfo taskInfo = new RunningTaskInfo(); taskInfo.taskId = taskId; taskInfo.displayId = displayId; Loading @@ -649,6 +692,7 @@ public class CompatUIControllerTest extends ShellTestCase { taskInfo.cameraCompatControlState = cameraCompatControlState; taskInfo.isVisible = isVisible; taskInfo.isFocused = isFocused; taskInfo.isTopActivityTransparent = isTopActivityTransparent; return taskInfo; } }
services/core/java/com/android/server/wm/Task.java +1 −0 Original line number Diff line number Diff line Loading @@ -3461,6 +3461,7 @@ class Task extends TaskFragment { info.topActivityLetterboxHeight = TaskInfo.PROPERTY_VALUE_UNSET; info.isUserFullscreenOverrideEnabled = top != null && top.mLetterboxUiController.shouldApplyUserFullscreenOverride(); info.isTopActivityTransparent = top != null && !top.fillsParent(); info.isFromLetterboxDoubleTap = top != null && top.mLetterboxUiController.isFromDoubleTap(); if (info.isLetterboxDoubleTapEnabled) { info.topActivityLetterboxWidth = top.getBounds().width(); Loading