summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecoration.java12
-rw-r--r--libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecorationTests.java62
2 files changed, 67 insertions, 7 deletions
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecoration.java b/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecoration.java
index bd84cccc4e0b..e7985dea61c8 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecoration.java
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecoration.java
@@ -543,9 +543,9 @@ public class DesktopModeWindowDecoration extends WindowDecoration<WindowDecorLin
final boolean inFullImmersive = mDesktopUserRepositories.getProfile(taskInfo.userId)
.isTaskInFullImmersiveState(taskInfo.taskId);
- updateRelayoutParams(mRelayoutParams, mContext, taskInfo, applyStartTransactionOnDraw,
- shouldSetTaskVisibilityPositionAndCrop, mIsStatusBarVisible,
- mIsKeyguardVisibleAndOccluded, inFullImmersive,
+ updateRelayoutParams(mRelayoutParams, mContext, taskInfo, mSplitScreenController,
+ applyStartTransactionOnDraw, shouldSetTaskVisibilityPositionAndCrop,
+ mIsStatusBarVisible, mIsKeyguardVisibleAndOccluded, inFullImmersive,
mDisplayController.getInsetsState(taskInfo.displayId), hasGlobalFocus,
displayExclusionRegion);
@@ -877,6 +877,7 @@ public class DesktopModeWindowDecoration extends WindowDecoration<WindowDecorLin
RelayoutParams relayoutParams,
Context context,
ActivityManager.RunningTaskInfo taskInfo,
+ SplitScreenController splitScreenController,
boolean applyStartTransactionOnDraw,
boolean shouldSetTaskVisibilityPositionAndCrop,
boolean isStatusBarVisible,
@@ -918,7 +919,10 @@ public class DesktopModeWindowDecoration extends WindowDecoration<WindowDecorLin
|| (isStatusBarVisible && !isKeyguardVisibleAndOccluded);
}
relayoutParams.mIsCaptionVisible = showCaption;
- relayoutParams.mIsInsetSource = isAppHeader && !inFullImmersiveMode;
+ final boolean isBottomSplit = !splitScreenController.isLeftRightSplit()
+ && splitScreenController.getSplitPosition(taskInfo.taskId)
+ == SPLIT_POSITION_BOTTOM_OR_RIGHT;
+ relayoutParams.mIsInsetSource = (isAppHeader && !inFullImmersiveMode) || isBottomSplit;
if (isAppHeader) {
if (TaskInfoKt.isTransparentCaptionBarAppearance(taskInfo)) {
// The app is requesting to customize the caption bar, which means input on
diff --git a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecorationTests.java b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecorationTests.java
index 61f3755ca772..0bef41910146 100644
--- a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecorationTests.java
+++ b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecorationTests.java
@@ -29,6 +29,7 @@ import static android.view.WindowInsetsController.APPEARANCE_TRANSPARENT_CAPTION
import static com.android.dx.mockito.inline.extended.ExtendedMockito.mockitoSession;
import static com.android.wm.shell.MockSurfaceControlHelper.createMockSurfaceControlTransaction;
+import static com.android.wm.shell.shared.split.SplitScreenConstants.SPLIT_POSITION_BOTTOM_OR_RIGHT;
import static com.android.wm.shell.windowdecor.DesktopModeWindowDecoration.CLOSE_MAXIMIZE_MENU_DELAY_MS;
import static com.android.wm.shell.windowdecor.WindowDecoration.INVALID_CORNER_RADIUS;
@@ -305,7 +306,8 @@ public class DesktopModeWindowDecorationTests extends ShellTestCase {
RelayoutParams relayoutParams = new RelayoutParams();
DesktopModeWindowDecoration.updateRelayoutParams(
- relayoutParams, mContext, taskInfo, /* applyStartTransactionOnDraw= */ true,
+ relayoutParams, mContext, taskInfo, mMockSplitScreenController,
+ /* applyStartTransactionOnDraw= */ true,
/* shouldSetTaskPositionAndCrop */ false,
/* isStatusBarVisible */ true,
/* isKeyguardVisibleAndOccluded */ false,
@@ -325,7 +327,8 @@ public class DesktopModeWindowDecorationTests extends ShellTestCase {
RelayoutParams relayoutParams = new RelayoutParams();
DesktopModeWindowDecoration.updateRelayoutParams(
- relayoutParams, mContext, taskInfo, /* applyStartTransactionOnDraw= */ true,
+ relayoutParams, mContext, taskInfo, mMockSplitScreenController,
+ /* applyStartTransactionOnDraw= */ true,
/* shouldSetTaskPositionAndCrop */ false,
/* isStatusBarVisible */ true,
/* isKeyguardVisibleAndOccluded */ false,
@@ -344,7 +347,8 @@ public class DesktopModeWindowDecorationTests extends ShellTestCase {
RelayoutParams relayoutParams = new RelayoutParams();
DesktopModeWindowDecoration.updateRelayoutParams(
- relayoutParams, mContext, taskInfo, /* applyStartTransactionOnDraw= */ true,
+ relayoutParams, mContext, taskInfo, mMockSplitScreenController,
+ /* applyStartTransactionOnDraw= */ true,
/* shouldSetTaskPositionAndCrop */ false,
/* isStatusBarVisible */ true,
/* isKeyguardVisibleAndOccluded */ false,
@@ -367,6 +371,7 @@ public class DesktopModeWindowDecorationTests extends ShellTestCase {
relayoutParams,
mTestableContext,
taskInfo,
+ mMockSplitScreenController,
/* applyStartTransactionOnDraw= */ true,
/* shouldSetTaskPositionAndCrop */ false,
/* isStatusBarVisible */ true,
@@ -390,6 +395,7 @@ public class DesktopModeWindowDecorationTests extends ShellTestCase {
relayoutParams,
mTestableContext,
taskInfo,
+ mMockSplitScreenController,
/* applyStartTransactionOnDraw= */ true,
/* shouldSetTaskPositionAndCrop */ false,
/* isStatusBarVisible */ true,
@@ -413,6 +419,7 @@ public class DesktopModeWindowDecorationTests extends ShellTestCase {
relayoutParams,
mTestableContext,
taskInfo,
+ mMockSplitScreenController,
/* applyStartTransactionOnDraw= */ true,
/* shouldSetTaskPositionAndCrop */ false,
/* isStatusBarVisible */ true,
@@ -440,6 +447,7 @@ public class DesktopModeWindowDecorationTests extends ShellTestCase {
relayoutParams,
mTestableContext,
taskInfo,
+ mMockSplitScreenController,
/* applyStartTransactionOnDraw= */ true,
/* shouldSetTaskPositionAndCrop */ false,
/* isStatusBarVisible */ true,
@@ -468,6 +476,7 @@ public class DesktopModeWindowDecorationTests extends ShellTestCase {
relayoutParams,
mTestableContext,
taskInfo,
+ mMockSplitScreenController,
/* applyStartTransactionOnDraw= */ true,
/* shouldSetTaskPositionAndCrop */ false,
/* isStatusBarVisible */ true,
@@ -493,6 +502,7 @@ public class DesktopModeWindowDecorationTests extends ShellTestCase {
relayoutParams,
mTestableContext,
taskInfo,
+ mMockSplitScreenController,
/* applyStartTransactionOnDraw= */ true,
/* shouldSetTaskPositionAndCrop */ false,
/* isStatusBarVisible */ true,
@@ -518,6 +528,7 @@ public class DesktopModeWindowDecorationTests extends ShellTestCase {
relayoutParams,
mTestableContext,
taskInfo,
+ mMockSplitScreenController,
/* applyStartTransactionOnDraw= */ true,
/* shouldSetTaskPositionAndCrop */ false,
/* isStatusBarVisible */ true,
@@ -542,6 +553,7 @@ public class DesktopModeWindowDecorationTests extends ShellTestCase {
relayoutParams,
mTestableContext,
taskInfo,
+ mMockSplitScreenController,
/* applyStartTransactionOnDraw= */ true,
/* shouldSetTaskPositionAndCrop */ false,
/* isStatusBarVisible */ true,
@@ -566,6 +578,7 @@ public class DesktopModeWindowDecorationTests extends ShellTestCase {
relayoutParams,
mTestableContext,
taskInfo,
+ mMockSplitScreenController,
/* applyStartTransactionOnDraw= */ true,
/* shouldSetTaskPositionAndCrop */ false,
/* isStatusBarVisible */ true,
@@ -589,6 +602,7 @@ public class DesktopModeWindowDecorationTests extends ShellTestCase {
relayoutParams,
mTestableContext,
taskInfo,
+ mMockSplitScreenController,
/* applyStartTransactionOnDraw= */ true,
/* shouldSetTaskPositionAndCrop */ false,
/* isStatusBarVisible */ true,
@@ -612,6 +626,7 @@ public class DesktopModeWindowDecorationTests extends ShellTestCase {
relayoutParams,
mTestableContext,
taskInfo,
+ mMockSplitScreenController,
/* applyStartTransactionOnDraw= */ true,
/* shouldSetTaskPositionAndCrop */ false,
/* isStatusBarVisible */ true,
@@ -634,6 +649,7 @@ public class DesktopModeWindowDecorationTests extends ShellTestCase {
relayoutParams,
mTestableContext,
taskInfo,
+ mMockSplitScreenController,
/* applyStartTransactionOnDraw= */ true,
/* shouldSetTaskPositionAndCrop */ false,
/* isStatusBarVisible */ true,
@@ -657,6 +673,7 @@ public class DesktopModeWindowDecorationTests extends ShellTestCase {
relayoutParams,
mTestableContext,
taskInfo,
+ mMockSplitScreenController,
/* applyStartTransactionOnDraw= */ true,
/* shouldSetTaskPositionAndCrop */ false,
/* isStatusBarVisible */ true,
@@ -680,6 +697,7 @@ public class DesktopModeWindowDecorationTests extends ShellTestCase {
relayoutParams,
mTestableContext,
taskInfo,
+ mMockSplitScreenController,
/* applyStartTransactionOnDraw= */ true,
/* shouldSetTaskPositionAndCrop */ false,
/* isStatusBarVisible */ true,
@@ -704,6 +722,7 @@ public class DesktopModeWindowDecorationTests extends ShellTestCase {
relayoutParams,
mTestableContext,
taskInfo,
+ mMockSplitScreenController,
/* applyStartTransactionOnDraw= */ true,
/* shouldSetTaskPositionAndCrop */ false,
/* isStatusBarVisible */ true,
@@ -729,6 +748,7 @@ public class DesktopModeWindowDecorationTests extends ShellTestCase {
relayoutParams,
mTestableContext,
taskInfo,
+ mMockSplitScreenController,
/* applyStartTransactionOnDraw= */ true,
/* shouldSetTaskPositionAndCrop */ false,
/* isStatusBarVisible */ true,
@@ -752,6 +772,7 @@ public class DesktopModeWindowDecorationTests extends ShellTestCase {
relayoutParams,
mTestableContext,
taskInfo,
+ mMockSplitScreenController,
/* applyStartTransactionOnDraw= */ true,
/* shouldSetTaskPositionAndCrop */ false,
/* isStatusBarVisible */ true,
@@ -777,6 +798,7 @@ public class DesktopModeWindowDecorationTests extends ShellTestCase {
relayoutParams,
mTestableContext,
taskInfo,
+ mMockSplitScreenController,
/* applyStartTransactionOnDraw= */ true,
/* shouldSetTaskPositionAndCrop */ false,
/* isStatusBarVisible */ true,
@@ -792,6 +814,31 @@ public class DesktopModeWindowDecorationTests extends ShellTestCase {
}
@Test
+ public void updateRelayoutParams_handle_bottomSplitIsInsetSource() {
+ final ActivityManager.RunningTaskInfo taskInfo = createTaskInfo(/* visible= */ true);
+ final RelayoutParams relayoutParams = new RelayoutParams();
+ when(mMockSplitScreenController.isLeftRightSplit()).thenReturn(false);
+ when(mMockSplitScreenController.getSplitPosition(taskInfo.taskId))
+ .thenReturn(SPLIT_POSITION_BOTTOM_OR_RIGHT);
+
+ DesktopModeWindowDecoration.updateRelayoutParams(
+ relayoutParams,
+ mTestableContext,
+ taskInfo,
+ mMockSplitScreenController,
+ /* applyStartTransactionOnDraw= */ true,
+ /* shouldSetTaskPositionAndCrop */ false,
+ /* isStatusBarVisible */ true,
+ /* isKeyguardVisibleAndOccluded */ false,
+ /* inFullImmersiveMode */ true,
+ new InsetsState(),
+ /* hasGlobalFocus= */ true,
+ mExclusionRegion);
+
+ assertThat(relayoutParams.mIsInsetSource).isTrue();
+ }
+
+ @Test
@EnableFlags(Flags.FLAG_ENABLE_FULLY_IMMERSIVE_IN_DESKTOP)
public void updateRelayoutParams_header_addsPaddingInFullImmersive() {
final ActivityManager.RunningTaskInfo taskInfo = createTaskInfo(/* visible= */ true);
@@ -808,6 +855,7 @@ public class DesktopModeWindowDecorationTests extends ShellTestCase {
relayoutParams,
mTestableContext,
taskInfo,
+ mMockSplitScreenController,
/* applyStartTransactionOnDraw= */ true,
/* shouldSetTaskPositionAndCrop */ false,
/* isStatusBarVisible */ true,
@@ -832,6 +880,7 @@ public class DesktopModeWindowDecorationTests extends ShellTestCase {
relayoutParams,
mTestableContext,
taskInfo,
+ mMockSplitScreenController,
/* applyStartTransactionOnDraw= */ true,
/* shouldSetTaskPositionAndCrop */ false,
/* isStatusBarVisible */ true,
@@ -855,6 +904,7 @@ public class DesktopModeWindowDecorationTests extends ShellTestCase {
relayoutParams,
mTestableContext,
taskInfo,
+ mMockSplitScreenController,
/* applyStartTransactionOnDraw= */ true,
/* shouldSetTaskPositionAndCrop */ false,
/* isStatusBarVisible */ false,
@@ -878,6 +928,7 @@ public class DesktopModeWindowDecorationTests extends ShellTestCase {
relayoutParams,
mTestableContext,
taskInfo,
+ mMockSplitScreenController,
/* applyStartTransactionOnDraw= */ true,
/* shouldSetTaskPositionAndCrop */ false,
/* isStatusBarVisible */ true,
@@ -900,6 +951,7 @@ public class DesktopModeWindowDecorationTests extends ShellTestCase {
relayoutParams,
mTestableContext,
taskInfo,
+ mMockSplitScreenController,
/* applyStartTransactionOnDraw= */ true,
/* shouldSetTaskPositionAndCrop */ false,
/* isStatusBarVisible */ false,
@@ -922,6 +974,7 @@ public class DesktopModeWindowDecorationTests extends ShellTestCase {
relayoutParams,
mTestableContext,
taskInfo,
+ mMockSplitScreenController,
/* applyStartTransactionOnDraw= */ true,
/* shouldSetTaskPositionAndCrop */ false,
/* isStatusBarVisible */ true,
@@ -945,6 +998,7 @@ public class DesktopModeWindowDecorationTests extends ShellTestCase {
relayoutParams,
mTestableContext,
taskInfo,
+ mMockSplitScreenController,
/* applyStartTransactionOnDraw= */ true,
/* shouldSetTaskPositionAndCrop */ false,
/* isStatusBarVisible */ true,
@@ -960,6 +1014,7 @@ public class DesktopModeWindowDecorationTests extends ShellTestCase {
relayoutParams,
mTestableContext,
taskInfo,
+ mMockSplitScreenController,
/* applyStartTransactionOnDraw= */ true,
/* shouldSetTaskPositionAndCrop */ false,
/* isStatusBarVisible */ false,
@@ -983,6 +1038,7 @@ public class DesktopModeWindowDecorationTests extends ShellTestCase {
relayoutParams,
mTestableContext,
taskInfo,
+ mMockSplitScreenController,
/* applyStartTransactionOnDraw= */ true,
/* shouldSetTaskPositionAndCrop */ false,
/* isStatusBarVisible */ true,