summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Tracy Zhou <tracyzhou@google.com> 2024-03-15 22:01:59 -0700
committer Tracy Zhou <tracyzhou@google.com> 2024-03-19 17:34:12 +0000
commit5c627d2425ed77784f599ef5e92549daa8a85d06 (patch)
treefb8ddff37c351fc9e79abcf9585c554e86657f03
parent2040daa663051428b19eadf912d8be2b19ee23e7 (diff)
Add change split screen focus shortcut to the shortcut instructions menu
Bug: 322896230 Test: Menu updated Change-Id: I134e5c1b2f24d218ea96dafb8b93793362919cc7
-rw-r--r--packages/SystemUI/res/values/strings.xml4
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/KeyboardShortcutListSearch.java57
2 files changed, 36 insertions, 25 deletions
diff --git a/packages/SystemUI/res/values/strings.xml b/packages/SystemUI/res/values/strings.xml
index 774bbe504b03..d3ee9fb449a8 100644
--- a/packages/SystemUI/res/values/strings.xml
+++ b/packages/SystemUI/res/values/strings.xml
@@ -2010,6 +2010,10 @@
<string name="system_multitasking_lhs">Enter split screen with current app to LHS</string>
<!-- User visible title for the keyboard shortcut that switches from split screen to full screen [CHAR LIMIT=70] -->
<string name="system_multitasking_full_screen">Switch from split screen to full screen</string>
+ <!-- User visible title for the keyboard shortcut that switches to app on right or below while using split screen [CHAR LIMIT=70] -->
+ <string name="system_multitasking_splitscreen_focus_rhs">Switch to app on right or below while using split screen</string>
+ <!-- User visible title for the keyboard shortcut that switches to app on left or above while using split screen [CHAR LIMIT=70] -->
+ <string name="system_multitasking_splitscreen_focus_lhs">Switch to app on left or above while using split screen</string>
<!-- User visible title for the keyboard shortcut that replaces an app from one to another during split screen [CHAR LIMIT=70] -->
<string name="system_multitasking_replace">During split screen: replace an app from one to another</string>
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/KeyboardShortcutListSearch.java b/packages/SystemUI/src/com/android/systemui/statusbar/KeyboardShortcutListSearch.java
index a12b9709a063..b0d33c236dd8 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/KeyboardShortcutListSearch.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/KeyboardShortcutListSearch.java
@@ -636,34 +636,41 @@ public final class KeyboardShortcutListSearch {
// Enter Split screen with current app to RHS: Meta + Ctrl + Right arrow
// Enter Split screen with current app to LHS: Meta + Ctrl + Left arrow
// Switch from Split screen to full screen: Meta + Ctrl + Up arrow
- String[] shortcutLabels = {
- context.getString(R.string.system_multitasking_rhs),
- context.getString(R.string.system_multitasking_lhs),
- context.getString(R.string.system_multitasking_full_screen),
- };
- int[] keyCodes = {
- KeyEvent.KEYCODE_DPAD_RIGHT,
- KeyEvent.KEYCODE_DPAD_LEFT,
- KeyEvent.KEYCODE_DPAD_UP,
- };
-
- for (int i = 0; i < shortcutLabels.length; i++) {
- List<ShortcutKeyGroup> shortcutKeyGroups = Arrays.asList(new ShortcutKeyGroup(
- new KeyboardShortcutInfo(
- shortcutLabels[i],
- keyCodes[i],
- KeyEvent.META_META_ON | KeyEvent.META_CTRL_ON),
- null));
- ShortcutMultiMappingInfo shortcutMultiMappingInfo =
- new ShortcutMultiMappingInfo(
- shortcutLabels[i],
- null,
- shortcutKeyGroups);
- systemMultitaskingGroup.addItem(shortcutMultiMappingInfo);
- }
+ // Change split screen focus to RHS: Meta + Alt + Right arrow
+ // Change split screen focus to LHS: Meta + Alt + Left arrow
+ systemMultitaskingGroup.addItem(
+ getMultitaskingShortcut(context.getString(R.string.system_multitasking_rhs),
+ KeyEvent.KEYCODE_DPAD_RIGHT,
+ KeyEvent.META_META_ON | KeyEvent.META_CTRL_ON));
+ systemMultitaskingGroup.addItem(
+ getMultitaskingShortcut(context.getString(R.string.system_multitasking_lhs),
+ KeyEvent.KEYCODE_DPAD_LEFT,
+ KeyEvent.META_META_ON | KeyEvent.META_CTRL_ON));
+ systemMultitaskingGroup.addItem(
+ getMultitaskingShortcut(context.getString(R.string.system_multitasking_full_screen),
+ KeyEvent.KEYCODE_DPAD_UP,
+ KeyEvent.META_META_ON | KeyEvent.META_CTRL_ON));
+ systemMultitaskingGroup.addItem(
+ getMultitaskingShortcut(
+ context.getString(R.string.system_multitasking_splitscreen_focus_rhs),
+ KeyEvent.KEYCODE_DPAD_RIGHT,
+ KeyEvent.META_META_ON | KeyEvent.META_ALT_ON));
+ systemMultitaskingGroup.addItem(
+ getMultitaskingShortcut(
+ context.getString(R.string.system_multitasking_splitscreen_focus_lhs),
+ KeyEvent.KEYCODE_DPAD_LEFT,
+ KeyEvent.META_META_ON | KeyEvent.META_ALT_ON));
return systemMultitaskingGroup;
}
+ private static ShortcutMultiMappingInfo getMultitaskingShortcut(String shortcutLabel,
+ int keycode, int modifiers) {
+ List<ShortcutKeyGroup> shortcutKeyGroups = Arrays.asList(
+ new ShortcutKeyGroup(new KeyboardShortcutInfo(shortcutLabel, keycode, modifiers),
+ null));
+ return new ShortcutMultiMappingInfo(shortcutLabel, null, shortcutKeyGroups);
+ }
+
private static KeyboardShortcutMultiMappingGroup getMultiMappingInputShortcuts(
Context context) {
List<ShortcutMultiMappingInfo> shortcutMultiMappingInfoList = Arrays.asList(