Loading libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecorViewModel.java +8 −1 Original line number Diff line number Diff line Loading @@ -51,6 +51,7 @@ import android.app.IActivityManager; import android.app.IActivityTaskManager; import android.content.Context; import android.content.Intent; import android.content.res.Configuration; import android.graphics.Point; import android.graphics.PointF; import android.graphics.Rect; Loading Loading @@ -884,7 +885,13 @@ public class DesktopModeWindowDecorViewModel implements WindowDecorViewModel, if (decoration == null) { return; } mDesktopTasksController.requestSplit(decoration.mTaskInfo, false /* leftOrTop */); final int orientation = mContext.getResources().getConfiguration().orientation; // Set leftOrTop as True to split to the top in portrait mode. // Set leftOrTop as False to split to the right in landscape mode. boolean leftOrTop = orientation == Configuration.ORIENTATION_PORTRAIT; mDesktopTasksController.requestSplit(decoration.mTaskInfo, leftOrTop); mDesktopModeUiEventLogger.log(decoration.mTaskInfo, DesktopUiEventEnum.DESKTOP_WINDOW_APP_HANDLE_MENU_TAP_TO_SPLIT_SCREEN); } Loading libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecorViewModelTests.kt +25 −1 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ import android.content.ComponentName import android.content.Context import android.content.Intent import android.content.Intent.ACTION_MAIN import android.content.res.Configuration import android.graphics.PointF import android.graphics.Rect import android.graphics.Region Loading Loading @@ -773,7 +774,30 @@ class DesktopModeWindowDecorViewModelTests : DesktopModeWindowDecorViewModelTest } @Test fun testDecor_onClickToSplitScreen_requestsSplit() { fun testDecor_onClickToSplitScreen_inPortrait_requestsSplitToTop() { // GIVEN the device is in portrait orientation val resources = spyContext.resources val configuration = resources.configuration configuration.orientation = Configuration.ORIENTATION_PORTRAIT val windowDecorationActionsCaptor = argumentCaptor<WindowDecorationActions>() val decor = createOpenTaskDecoration( windowingMode = WINDOWING_MODE_MULTI_WINDOW, windowDecorationActions = windowDecorationActionsCaptor ) windowDecorationActionsCaptor.firstValue.onToSplitScreen(decor.mTaskInfo.taskId) verify(mockDesktopTasksController).requestSplit(decor.mTaskInfo, leftOrTop = true) } @Test fun testDecor_onClickToSplitScreen_inLandscape_requestsSplitToSide() { // GIVEN the device is in landscape orientation val resources = spyContext.resources val configuration = resources.configuration configuration.orientation = Configuration.ORIENTATION_LANDSCAPE val windowDecorationActionsCaptor = argumentCaptor<WindowDecorationActions>() val decor = createOpenTaskDecoration( windowingMode = WINDOWING_MODE_MULTI_WINDOW, Loading Loading
libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecorViewModel.java +8 −1 Original line number Diff line number Diff line Loading @@ -51,6 +51,7 @@ import android.app.IActivityManager; import android.app.IActivityTaskManager; import android.content.Context; import android.content.Intent; import android.content.res.Configuration; import android.graphics.Point; import android.graphics.PointF; import android.graphics.Rect; Loading Loading @@ -884,7 +885,13 @@ public class DesktopModeWindowDecorViewModel implements WindowDecorViewModel, if (decoration == null) { return; } mDesktopTasksController.requestSplit(decoration.mTaskInfo, false /* leftOrTop */); final int orientation = mContext.getResources().getConfiguration().orientation; // Set leftOrTop as True to split to the top in portrait mode. // Set leftOrTop as False to split to the right in landscape mode. boolean leftOrTop = orientation == Configuration.ORIENTATION_PORTRAIT; mDesktopTasksController.requestSplit(decoration.mTaskInfo, leftOrTop); mDesktopModeUiEventLogger.log(decoration.mTaskInfo, DesktopUiEventEnum.DESKTOP_WINDOW_APP_HANDLE_MENU_TAP_TO_SPLIT_SCREEN); } Loading
libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecorViewModelTests.kt +25 −1 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ import android.content.ComponentName import android.content.Context import android.content.Intent import android.content.Intent.ACTION_MAIN import android.content.res.Configuration import android.graphics.PointF import android.graphics.Rect import android.graphics.Region Loading Loading @@ -773,7 +774,30 @@ class DesktopModeWindowDecorViewModelTests : DesktopModeWindowDecorViewModelTest } @Test fun testDecor_onClickToSplitScreen_requestsSplit() { fun testDecor_onClickToSplitScreen_inPortrait_requestsSplitToTop() { // GIVEN the device is in portrait orientation val resources = spyContext.resources val configuration = resources.configuration configuration.orientation = Configuration.ORIENTATION_PORTRAIT val windowDecorationActionsCaptor = argumentCaptor<WindowDecorationActions>() val decor = createOpenTaskDecoration( windowingMode = WINDOWING_MODE_MULTI_WINDOW, windowDecorationActions = windowDecorationActionsCaptor ) windowDecorationActionsCaptor.firstValue.onToSplitScreen(decor.mTaskInfo.taskId) verify(mockDesktopTasksController).requestSplit(decor.mTaskInfo, leftOrTop = true) } @Test fun testDecor_onClickToSplitScreen_inLandscape_requestsSplitToSide() { // GIVEN the device is in landscape orientation val resources = spyContext.resources val configuration = resources.configuration configuration.orientation = Configuration.ORIENTATION_LANDSCAPE val windowDecorationActionsCaptor = argumentCaptor<WindowDecorationActions>() val decor = createOpenTaskDecoration( windowingMode = WINDOWING_MODE_MULTI_WINDOW, Loading