summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Riddle Hsu <riddlehsu@google.com> 2024-10-31 02:49:10 +0000
committer Riddle Hsu <riddlehsu@google.com> 2024-10-31 09:37:36 +0000
commitdde9ccdcd56e1e50273f2b07f820798f313bc2ce (patch)
tree1a3fbf3d24cd73324f43fa941e78695caf3f0178
parent428aef405975f5e07e8e47afaf91823ea3c338a4 (diff)
Add aspect ratio setting button in window handle menu
The button will be visible if the task is fullscreen windowing mode and the display is ignore-orientation-request (i.e. large screen). Currently it only applies if desktop mode is enabled. This is to make it easier for users to switch aspect ratio of app. Bug: 376395315 Flag: EXEMPT add a common button Test: adb shell setprop \ persist.wm.debug.desktop_mode_enforce_device_restrictions false adb shell settings put global enable_freeform_support 1 adb shell settings put global override_desktop_mode_features 1 adb shell cmd window set-ignore-orientation-request 1 adb reboot Open an app in fullscreen mode. Click top bar to see the button. Change-Id: I5908286624cd426daeca317e9803e6619fe994be
-rw-r--r--libs/WindowManager/Shell/res/drawable/desktop_mode_ic_handle_menu_change_aspect_ratio.xml25
-rw-r--r--libs/WindowManager/Shell/res/layout/desktop_mode_window_decor_handle_menu.xml8
-rw-r--r--libs/WindowManager/Shell/res/values/dimen.xml8
-rw-r--r--libs/WindowManager/Shell/res/values/strings.xml2
-rw-r--r--libs/WindowManager/Shell/src/com/android/wm/shell/compatui/CompatUIController.java8
-rw-r--r--libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecorViewModel.java5
-rw-r--r--libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecoration.java10
-rw-r--r--libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/HandleMenu.kt87
-rw-r--r--libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecorationTests.java10
-rw-r--r--libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/windowdecor/HandleMenuTest.kt2
10 files changed, 131 insertions, 34 deletions
diff --git a/libs/WindowManager/Shell/res/drawable/desktop_mode_ic_handle_menu_change_aspect_ratio.xml b/libs/WindowManager/Shell/res/drawable/desktop_mode_ic_handle_menu_change_aspect_ratio.xml
new file mode 100644
index 000000000000..4442e9df7688
--- /dev/null
+++ b/libs/WindowManager/Shell/res/drawable/desktop_mode_ic_handle_menu_change_aspect_ratio.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2024 The Android Open Source Project
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="20dp"
+ android:height="20dp"
+ android:viewportWidth="24"
+ android:viewportHeight="24">
+ <path
+ android:fillColor="@color/compat_controls_text"
+ android:pathData="M19,12h-2v3h-3v2h5v-5zM7,9h3L10,7L5,7v5h2L7,9zM21,3L3,3c-1.1,0 -2,0.9 -2,2v14c0,1.1 0.9,2 2,2h18c1.1,0 2,-0.9 2,-2L23,5c0,-1.1 -0.9,-2 -2,-2zM21,19.01L3,19.01L3,4.99h18v14.02z"/>
+</vector>
diff --git a/libs/WindowManager/Shell/res/layout/desktop_mode_window_decor_handle_menu.xml b/libs/WindowManager/Shell/res/layout/desktop_mode_window_decor_handle_menu.xml
index 5609663c01a0..f90e165ffc74 100644
--- a/libs/WindowManager/Shell/res/layout/desktop_mode_window_decor_handle_menu.xml
+++ b/libs/WindowManager/Shell/res/layout/desktop_mode_window_decor_handle_menu.xml
@@ -157,6 +157,14 @@
android:drawableStart="@drawable/desktop_mode_ic_handle_menu_manage_windows"
android:drawableTint="?androidprv:attr/materialColorOnSurface"
style="@style/DesktopModeHandleMenuActionButton" />
+
+ <Button
+ android:id="@+id/change_aspect_ratio_button"
+ android:contentDescription="@string/change_aspect_ratio_text"
+ android:text="@string/change_aspect_ratio_text"
+ android:drawableStart="@drawable/desktop_mode_ic_handle_menu_change_aspect_ratio"
+ android:drawableTint="?androidprv:attr/materialColorOnSurface"
+ style="@style/DesktopModeHandleMenuActionButton" />
</LinearLayout>
<LinearLayout
diff --git a/libs/WindowManager/Shell/res/values/dimen.xml b/libs/WindowManager/Shell/res/values/dimen.xml
index fa1aa193e1e3..c172d74311ed 100644
--- a/libs/WindowManager/Shell/res/values/dimen.xml
+++ b/libs/WindowManager/Shell/res/values/dimen.xml
@@ -523,8 +523,9 @@
<dimen name="desktop_mode_handle_menu_width">216dp</dimen>
<!-- The maximum height of the handle menu in desktop mode. Three pills at 52dp each,
- additional actions pill 156dp, plus 2dp spacing between them plus 4dp top padding. -->
- <dimen name="desktop_mode_handle_menu_height">322dp</dimen>
+ additional actions pill 208dp, plus 2dp spacing between them plus 4dp top padding.
+ 52*3 + 52*4 + (4-1)*2 + 4 = 374 -->
+ <dimen name="desktop_mode_handle_menu_height">374dp</dimen>
<!-- The elevation set on the handle menu pills. -->
<dimen name="desktop_mode_handle_menu_pill_elevation">1dp</dimen>
@@ -547,6 +548,9 @@
<!-- The height of the handle menu's "Open in browser" pill in desktop mode. -->
<dimen name="desktop_mode_handle_menu_open_in_browser_pill_height">52dp</dimen>
+ <!-- The height of the handle menu's "Change aspect ratio" pill in desktop mode. -->
+ <dimen name="desktop_mode_handle_menu_change_aspect_ratio_height">52dp</dimen>
+
<!-- The margin between pills of the handle menu in desktop mode. -->
<dimen name="desktop_mode_handle_menu_pill_spacing_margin">2dp</dimen>
diff --git a/libs/WindowManager/Shell/res/values/strings.xml b/libs/WindowManager/Shell/res/values/strings.xml
index ef0386a1b4dd..c6963f76594c 100644
--- a/libs/WindowManager/Shell/res/values/strings.xml
+++ b/libs/WindowManager/Shell/res/values/strings.xml
@@ -305,6 +305,8 @@
<string name="new_window_text">New Window</string>
<!-- Accessibility text for the handle menu new window button [CHAR LIMIT=NONE] -->
<string name="manage_windows_text">Manage Windows</string>
+ <!-- Accessibility text for the handle menu change aspect ratio button [CHAR LIMIT=NONE] -->
+ <string name="change_aspect_ratio_text">Change aspect ratio</string>
<!-- Accessibility text for the handle menu close button [CHAR LIMIT=NONE] -->
<string name="close_text">Close</string>
<!-- Accessibility text for the handle menu close menu button [CHAR LIMIT=NONE] -->
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/compatui/CompatUIController.java b/libs/WindowManager/Shell/src/com/android/wm/shell/compatui/CompatUIController.java
index 6146ecd9ade6..886330f3264a 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/compatui/CompatUIController.java
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/compatui/CompatUIController.java
@@ -688,6 +688,12 @@ public class CompatUIController implements OnDisplaysChangedListener,
private void launchUserAspectRatioSettings(
@NonNull TaskInfo taskInfo, @NonNull ShellTaskOrganizer.TaskListener taskListener) {
+ launchUserAspectRatioSettings(mContext, taskInfo);
+ }
+
+ /** Launch the user aspect ratio settings for the package of the given task. */
+ public static void launchUserAspectRatioSettings(
+ @NonNull Context context, @NonNull TaskInfo taskInfo) {
final Intent intent = new Intent(Settings.ACTION_MANAGE_USER_ASPECT_RATIO_SETTINGS);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
@@ -697,7 +703,7 @@ public class CompatUIController implements OnDisplaysChangedListener,
intent.setData(packageUri);
}
final UserHandle userHandle = UserHandle.of(taskInfo.userId);
- mContext.startActivityAsUser(intent, userHandle);
+ context.startActivityAsUser(intent, userHandle);
}
@VisibleForTesting
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecorViewModel.java b/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecorViewModel.java
index a3324cc6f286..d8088a601540 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecorViewModel.java
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DesktopModeWindowDecorViewModel.java
@@ -103,6 +103,7 @@ import com.android.wm.shell.common.DisplayLayout;
import com.android.wm.shell.common.MultiInstanceHelper;
import com.android.wm.shell.common.ShellExecutor;
import com.android.wm.shell.common.SyncTransactionQueue;
+import com.android.wm.shell.compatui.CompatUIController;
import com.android.wm.shell.desktopmode.DesktopActivityOrientationChangeHandler;
import com.android.wm.shell.desktopmode.DesktopModeEventLogger;
import com.android.wm.shell.desktopmode.DesktopModeVisualIndicator;
@@ -1574,6 +1575,10 @@ public class DesktopModeWindowDecorViewModel implements WindowDecorViewModel,
onManageWindows(windowDecoration);
return Unit.INSTANCE;
});
+ windowDecoration.setOnChangeAspectRatioClickListener(() -> {
+ CompatUIController.launchUserAspectRatioSettings(mContext, taskInfo);
+ return Unit.INSTANCE;
+ });
windowDecoration.setCaptionListeners(
touchEventListener, touchEventListener, touchEventListener, touchEventListener);
windowDecoration.setExclusionRegionListener(mExclusionRegionListener);
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 9f37358b6044..833004798b6e 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
@@ -155,6 +155,7 @@ public class DesktopModeWindowDecoration extends WindowDecoration<WindowDecorLin
private Function0<Unit> mOnToSplitscreenClickListener;
private Function0<Unit> mOnNewWindowClickListener;
private Function0<Unit> mOnManageWindowsClickListener;
+ private Function0<Unit> mOnChangeAspectRatioClickListener;
private DragPositioningCallback mDragPositioningCallback;
private DragResizeInputListener mDragResizeListener;
private Runnable mCurrentViewHostRunnable = null;
@@ -366,6 +367,11 @@ public class DesktopModeWindowDecoration extends WindowDecoration<WindowDecorLin
mOnManageWindowsClickListener = listener;
}
+ /** Registers a listener to be called when the aspect ratio action is triggered. */
+ void setOnChangeAspectRatioClickListener(Function0<Unit> listener) {
+ mOnChangeAspectRatioClickListener = listener;
+ }
+
void setCaptionListeners(
View.OnClickListener onCaptionButtonClickListener,
View.OnTouchListener onCaptionTouchListener,
@@ -1352,6 +1358,8 @@ public class DesktopModeWindowDecoration extends WindowDecoration<WindowDecorLin
&& Flags.enableDesktopWindowingMultiInstanceFeatures();
final boolean shouldShowManageWindowsButton = supportsMultiInstance
&& mMinimumInstancesFound;
+ final boolean shouldShowChangeAspectRatioButton = HandleMenu.Companion
+ .shouldShowChangeAspectRatioButton(mTaskInfo);
final boolean inDesktopImmersive = mDesktopRepository
.isTaskInFullImmersiveState(mTaskInfo.taskId);
mHandleMenu = mHandleMenuFactory.create(
@@ -1364,6 +1372,7 @@ public class DesktopModeWindowDecoration extends WindowDecoration<WindowDecorLin
canEnterDesktopMode(mContext),
supportsMultiInstance,
shouldShowManageWindowsButton,
+ shouldShowChangeAspectRatioButton,
getBrowserLink(),
mResult.mCaptionWidth,
mResult.mCaptionHeight,
@@ -1384,6 +1393,7 @@ public class DesktopModeWindowDecoration extends WindowDecoration<WindowDecorLin
/* onToSplitScreenClickListener= */ mOnToSplitscreenClickListener,
/* onNewWindowClickListener= */ mOnNewWindowClickListener,
/* onManageWindowsClickListener= */ mOnManageWindowsClickListener,
+ /* onAspectRatioSettingsClickListener= */ mOnChangeAspectRatioClickListener,
/* openInBrowserClickListener= */ (intent) -> {
mOpenInBrowserClickListener.accept(intent);
onCapturedLinkExpired();
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/HandleMenu.kt b/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/HandleMenu.kt
index 93bd9290dfeb..2edc380756ac 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/HandleMenu.kt
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/HandleMenu.kt
@@ -19,6 +19,7 @@ import android.annotation.ColorInt
import android.annotation.DimenRes
import android.annotation.SuppressLint
import android.app.ActivityManager.RunningTaskInfo
+import android.app.WindowConfiguration
import android.content.Context
import android.content.Intent
import android.content.res.ColorStateList
@@ -71,6 +72,7 @@ class HandleMenu(
private val shouldShowWindowingPill: Boolean,
private val shouldShowNewWindowButton: Boolean,
private val shouldShowManageWindowsButton: Boolean,
+ private val shouldShowChangeAspectRatioButton: Boolean,
private val openInBrowserIntent: Intent?,
private val captionWidth: Int,
private val captionHeight: Int,
@@ -111,6 +113,10 @@ class HandleMenu(
private val shouldShowBrowserPill: Boolean
get() = openInBrowserIntent != null
+ private val shouldShowMoreActionsPill: Boolean
+ get() = SHOULD_SHOW_SCREENSHOT_BUTTON || shouldShowNewWindowButton ||
+ shouldShowManageWindowsButton || shouldShowChangeAspectRatioButton
+
init {
updateHandleMenuPillPositions(captionX, captionY)
}
@@ -121,6 +127,7 @@ class HandleMenu(
onToSplitScreenClickListener: () -> Unit,
onNewWindowClickListener: () -> Unit,
onManageWindowsClickListener: () -> Unit,
+ onChangeAspectRatioClickListener: () -> Unit,
openInBrowserClickListener: (Intent) -> Unit,
onOpenByDefaultClickListener: () -> Unit,
onCloseMenuClickListener: () -> Unit,
@@ -138,6 +145,7 @@ class HandleMenu(
onToSplitScreenClickListener = onToSplitScreenClickListener,
onNewWindowClickListener = onNewWindowClickListener,
onManageWindowsClickListener = onManageWindowsClickListener,
+ onChangeAspectRatioClickListener = onChangeAspectRatioClickListener,
openInBrowserClickListener = openInBrowserClickListener,
onOpenByDefaultClickListener = onOpenByDefaultClickListener,
onCloseMenuClickListener = onCloseMenuClickListener,
@@ -158,6 +166,7 @@ class HandleMenu(
onToSplitScreenClickListener: () -> Unit,
onNewWindowClickListener: () -> Unit,
onManageWindowsClickListener: () -> Unit,
+ onChangeAspectRatioClickListener: () -> Unit,
openInBrowserClickListener: (Intent) -> Unit,
onOpenByDefaultClickListener: () -> Unit,
onCloseMenuClickListener: () -> Unit,
@@ -171,14 +180,16 @@ class HandleMenu(
shouldShowWindowingPill = shouldShowWindowingPill,
shouldShowBrowserPill = shouldShowBrowserPill,
shouldShowNewWindowButton = shouldShowNewWindowButton,
- shouldShowManageWindowsButton = shouldShowManageWindowsButton
+ shouldShowManageWindowsButton = shouldShowManageWindowsButton,
+ shouldShowChangeAspectRatioButton = shouldShowChangeAspectRatioButton
).apply {
- bind(taskInfo, appIconBitmap, appName)
+ bind(taskInfo, appIconBitmap, appName, shouldShowMoreActionsPill)
this.onToDesktopClickListener = onToDesktopClickListener
this.onToFullscreenClickListener = onToFullscreenClickListener
this.onToSplitScreenClickListener = onToSplitScreenClickListener
this.onNewWindowClickListener = onNewWindowClickListener
this.onManageWindowsClickListener = onManageWindowsClickListener
+ this.onChangeAspectRatioClickListener = onChangeAspectRatioClickListener
this.onOpenInBrowserClickListener = {
openInBrowserClickListener.invoke(openInBrowserIntent!!)
}
@@ -392,8 +403,11 @@ class HandleMenu(
R.dimen.desktop_mode_handle_menu_manage_windows_height
)
}
- if (!SHOULD_SHOW_SCREENSHOT_BUTTON && !shouldShowNewWindowButton
- && !shouldShowManageWindowsButton) {
+ if (!shouldShowChangeAspectRatioButton) {
+ menuHeight -= loadDimensionPixelSize(
+ R.dimen.desktop_mode_handle_menu_change_aspect_ratio_height)
+ }
+ if (!shouldShowMoreActionsPill) {
menuHeight -= pillTopMargin
}
if (!shouldShowBrowserPill) {
@@ -427,7 +441,8 @@ class HandleMenu(
private val shouldShowWindowingPill: Boolean,
private val shouldShowBrowserPill: Boolean,
private val shouldShowNewWindowButton: Boolean,
- private val shouldShowManageWindowsButton: Boolean
+ private val shouldShowManageWindowsButton: Boolean,
+ private val shouldShowChangeAspectRatioButton: Boolean
) {
val rootView = LayoutInflater.from(context)
.inflate(R.layout.desktop_mode_window_decor_handle_menu, null /* root */) as View
@@ -454,6 +469,8 @@ class HandleMenu(
private val newWindowBtn = moreActionsPill.requireViewById<Button>(R.id.new_window_button)
private val manageWindowBtn = moreActionsPill
.requireViewById<Button>(R.id.manage_windows_button)
+ private val changeAspectRatioBtn = moreActionsPill
+ .requireViewById<Button>(R.id.change_aspect_ratio_button)
// Open in Browser Pill.
private val openInBrowserPill = rootView.requireViewById<View>(R.id.open_in_browser_pill)
@@ -472,6 +489,7 @@ class HandleMenu(
var onToSplitScreenClickListener: (() -> Unit)? = null
var onNewWindowClickListener: (() -> Unit)? = null
var onManageWindowsClickListener: (() -> Unit)? = null
+ var onChangeAspectRatioClickListener: (() -> Unit)? = null
var onOpenInBrowserClickListener: (() -> Unit)? = null
var onOpenByDefaultClickListener: (() -> Unit)? = null
var onCloseMenuClickListener: (() -> Unit)? = null
@@ -488,6 +506,7 @@ class HandleMenu(
collapseMenuButton.setOnClickListener { onCloseMenuClickListener?.invoke() }
newWindowBtn.setOnClickListener { onNewWindowClickListener?.invoke() }
manageWindowBtn.setOnClickListener { onManageWindowsClickListener?.invoke() }
+ changeAspectRatioBtn.setOnClickListener { onChangeAspectRatioClickListener?.invoke() }
rootView.setOnTouchListener { _, event ->
if (event.actionMasked == ACTION_OUTSIDE) {
@@ -499,7 +518,12 @@ class HandleMenu(
}
/** Binds the menu views to the new data. */
- fun bind(taskInfo: RunningTaskInfo, appIconBitmap: Bitmap?, appName: CharSequence?) {
+ fun bind(
+ taskInfo: RunningTaskInfo,
+ appIconBitmap: Bitmap?,
+ appName: CharSequence?,
+ shouldShowMoreActionsPill: Boolean
+ ) {
this.taskInfo = taskInfo
this.style = calculateMenuStyle(taskInfo)
@@ -507,7 +531,10 @@ class HandleMenu(
if (shouldShowWindowingPill) {
bindWindowingPill(style)
}
- bindMoreActionsPill(style)
+ moreActionsPill.isGone = !shouldShowMoreActionsPill
+ if (shouldShowMoreActionsPill) {
+ bindMoreActionsPill(style)
+ }
bindOpenInBrowserPill(style)
}
@@ -616,27 +643,20 @@ class HandleMenu(
}
private fun bindMoreActionsPill(style: MenuStyle) {
- moreActionsPill.apply {
- isGone = !shouldShowNewWindowButton && !SHOULD_SHOW_SCREENSHOT_BUTTON
- && !shouldShowManageWindowsButton
- }
- screenshotBtn.apply {
- isGone = !SHOULD_SHOW_SCREENSHOT_BUTTON
- background.setTint(style.backgroundColor)
- setTextColor(style.textColor)
- compoundDrawableTintList = ColorStateList.valueOf(style.textColor)
- }
- newWindowBtn.apply {
- isGone = !shouldShowNewWindowButton
- background.setTint(style.backgroundColor)
- setTextColor(style.textColor)
- compoundDrawableTintList = ColorStateList.valueOf(style.textColor)
- }
- manageWindowBtn.apply {
- isGone = !shouldShowManageWindowsButton
- background.setTint(style.backgroundColor)
- setTextColor(style.textColor)
- compoundDrawableTintList = ColorStateList.valueOf(style.textColor)
+ arrayOf(
+ screenshotBtn to SHOULD_SHOW_SCREENSHOT_BUTTON,
+ newWindowBtn to shouldShowNewWindowButton,
+ manageWindowBtn to shouldShowManageWindowsButton,
+ changeAspectRatioBtn to shouldShowChangeAspectRatioButton,
+ ).forEach {
+ val button = it.first
+ val shouldShow = it.second
+ button.apply {
+ isGone = !shouldShow
+ background.setTint(style.backgroundColor)
+ setTextColor(style.textColor)
+ compoundDrawableTintList = ColorStateList.valueOf(style.textColor)
+ }
}
}
@@ -664,6 +684,14 @@ class HandleMenu(
companion object {
private const val TAG = "HandleMenu"
private const val SHOULD_SHOW_SCREENSHOT_BUTTON = false
+
+ /**
+ * Returns whether the aspect ratio button should be shown for the task. It usually means
+ * that the task is on a large screen with ignore-orientation-request.
+ */
+ fun shouldShowChangeAspectRatioButton(taskInfo: RunningTaskInfo): Boolean =
+ taskInfo.appCompatTaskInfo.eligibleForUserAspectRatioButton() &&
+ taskInfo.windowingMode == WindowConfiguration.WINDOWING_MODE_FULLSCREEN
}
}
@@ -679,6 +707,7 @@ interface HandleMenuFactory {
shouldShowWindowingPill: Boolean,
shouldShowNewWindowButton: Boolean,
shouldShowManageWindowsButton: Boolean,
+ shouldShowChangeAspectRatioButton: Boolean,
openInBrowserIntent: Intent?,
captionWidth: Int,
captionHeight: Int,
@@ -699,6 +728,7 @@ object DefaultHandleMenuFactory : HandleMenuFactory {
shouldShowWindowingPill: Boolean,
shouldShowNewWindowButton: Boolean,
shouldShowManageWindowsButton: Boolean,
+ shouldShowChangeAspectRatioButton: Boolean,
openInBrowserIntent: Intent?,
captionWidth: Int,
captionHeight: Int,
@@ -715,6 +745,7 @@ object DefaultHandleMenuFactory : HandleMenuFactory {
shouldShowWindowingPill,
shouldShowNewWindowButton,
shouldShowManageWindowsButton,
+ shouldShowChangeAspectRatioButton,
openInBrowserIntent,
captionWidth,
captionHeight,
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 8a2c7782906d..4f172c1f3335 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
@@ -261,8 +261,8 @@ public class DesktopModeWindowDecorationTests extends ShellTestCase {
doReturn(defaultDisplay).when(mMockDisplayController).getDisplay(Display.DEFAULT_DISPLAY);
doReturn(mInsetsState).when(mMockDisplayController).getInsetsState(anyInt());
when(mMockHandleMenuFactory.create(any(), any(), anyInt(), any(), any(), any(),
- anyBoolean(), anyBoolean(), anyBoolean(), any(), anyInt(), anyInt(), anyInt(),
- anyInt()))
+ anyBoolean(), anyBoolean(), anyBoolean(), anyBoolean(), any(), anyInt(), anyInt(),
+ anyInt(), anyInt()))
.thenReturn(mMockHandleMenu);
when(mMockMultiInstanceHelper.supportsMultiInstanceSplit(any())).thenReturn(false);
when(mMockAppHeaderViewHolderFactory.create(any(), any(), any(), any(), any(), any(), any(),
@@ -1174,6 +1174,7 @@ public class DesktopModeWindowDecorationTests extends ShellTestCase {
any(),
any(),
any(),
+ any(),
openInBrowserCaptor.capture(),
any(),
any(),
@@ -1204,6 +1205,7 @@ public class DesktopModeWindowDecorationTests extends ShellTestCase {
any(),
any(),
any(),
+ any(),
openInBrowserCaptor.capture(),
any(),
any(),
@@ -1259,6 +1261,7 @@ public class DesktopModeWindowDecorationTests extends ShellTestCase {
any(),
any(),
any(),
+ any(),
closeClickListener.capture(),
any(),
anyBoolean()
@@ -1290,6 +1293,7 @@ public class DesktopModeWindowDecorationTests extends ShellTestCase {
any(),
any(),
any(),
+ any(),
/* forceShowSystemBars= */ eq(true)
);
}
@@ -1433,7 +1437,7 @@ public class DesktopModeWindowDecorationTests extends ShellTestCase {
private void verifyHandleMenuCreated(@Nullable Uri uri) {
verify(mMockHandleMenuFactory).create(any(), any(), anyInt(), any(), any(),
- any(), anyBoolean(), anyBoolean(), anyBoolean(),
+ any(), anyBoolean(), anyBoolean(), anyBoolean(), anyBoolean(),
argThat(intent -> (uri == null && intent == null) || intent.getData().equals(uri)),
anyInt(), anyInt(), anyInt(), anyInt());
}
diff --git a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/windowdecor/HandleMenuTest.kt b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/windowdecor/HandleMenuTest.kt
index 9544fa823b5a..ade17c61eda1 100644
--- a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/windowdecor/HandleMenuTest.kt
+++ b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/windowdecor/HandleMenuTest.kt
@@ -266,6 +266,7 @@ class HandleMenuTest : ShellTestCase() {
WindowManagerWrapper(mockWindowManager),
layoutId, appIcon, appName, splitScreenController, shouldShowWindowingPill = true,
shouldShowNewWindowButton = true, shouldShowManageWindowsButton = false,
+ shouldShowChangeAspectRatioButton = false,
null /* openInBrowserLink */, captionWidth = HANDLE_WIDTH, captionHeight = 50,
captionX = captionX,
captionY = 0,
@@ -276,6 +277,7 @@ class HandleMenuTest : ShellTestCase() {
onToSplitScreenClickListener = mock(),
onNewWindowClickListener = mock(),
onManageWindowsClickListener = mock(),
+ onChangeAspectRatioClickListener = mock(),
openInBrowserClickListener = mock(),
onOpenByDefaultClickListener = mock(),
onCloseMenuClickListener = mock(),