Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 67f870a4 authored by Daichi Hirono's avatar Daichi Hirono
Browse files

Add move to next display to the shortcut helper UI

Bug: 375078976
Test: None
Flag: com.android.window.flags.enable_move_to_next_display_shortcut
Change-Id: I6ccd02d877686501abd7f95059a01bfdf00d6f08
parent 87dd4664
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -2270,6 +2270,8 @@
    <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>
    <!-- User visible title for the keyboard shortcut that moves a focused task to a next display [CHAR LIMIT=70] -->
    <string name="system_multitasking_move_to_next_display">Move active window between displays</string>

    <!-- User visible title for the input keyboard shortcuts list. [CHAR LIMIT=70] -->
    <string name="keyboard_shortcut_group_input">Input</string>
+42 −20
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package com.android.systemui.keyboard.shortcut.data.source

import android.content.res.Resources
import android.view.KeyEvent.KEYCODE_D
import android.view.KeyEvent.KEYCODE_DPAD_LEFT
import android.view.KeyEvent.KEYCODE_DPAD_RIGHT
import android.view.KeyEvent.KEYCODE_DPAD_UP
@@ -29,6 +30,7 @@ import android.view.KeyboardShortcutGroup
import com.android.systemui.dagger.qualifiers.Main
import com.android.systemui.keyboard.shortcut.data.model.shortcutInfo
import com.android.systemui.res.R
import com.android.window.flags.Flags.enableMoveToNextDisplayShortcut
import javax.inject.Inject

class MultitaskingShortcutsSource @Inject constructor(@Main private val resources: Resources) :
@@ -38,42 +40,62 @@ class MultitaskingShortcutsSource @Inject constructor(@Main private val resource
        listOf(
            KeyboardShortcutGroup(
                resources.getString(R.string.shortcutHelper_category_recent_apps),
                recentsShortcuts()
                recentsShortcuts(),
            ),
            KeyboardShortcutGroup(
                resources.getString(R.string.shortcutHelper_category_split_screen),
                splitScreenShortcuts()
            )
                splitScreenShortcuts(),
            ),
        )

    private fun splitScreenShortcuts() =
        listOf(
    private fun splitScreenShortcuts() = buildList {
        //  Enter Split screen with current app to RHS:
        //   - Meta + Ctrl + Right arrow
        add(
            shortcutInfo(resources.getString(R.string.system_multitasking_rhs)) {
                command(META_META_ON or META_CTRL_ON, KEYCODE_DPAD_RIGHT)
            },
            }
        )
        //  Enter Split screen with current app to LHS:
        //   - Meta + Ctrl + Left arrow
        add(
            shortcutInfo(resources.getString(R.string.system_multitasking_lhs)) {
                command(META_META_ON or META_CTRL_ON, KEYCODE_DPAD_LEFT)
            },
            }
        )
        //  Switch from Split screen to full screen:
        //   - Meta + Ctrl + Up arrow
        add(
            shortcutInfo(resources.getString(R.string.system_multitasking_full_screen)) {
                command(META_META_ON or META_CTRL_ON, KEYCODE_DPAD_UP)
            },
            }
        )
        //  Change split screen focus to RHS:
        //   - Meta + Alt + Right arrow
        add(
            shortcutInfo(resources.getString(R.string.system_multitasking_splitscreen_focus_rhs)) {
                command(META_META_ON or META_ALT_ON, KEYCODE_DPAD_RIGHT)
            },
            }
        )
        //  Change split screen focus to LHS:
        //   - Meta + Alt + Left arrow
        add(
            shortcutInfo(resources.getString(R.string.system_multitasking_splitscreen_focus_lhs)) {
                command(META_META_ON or META_ALT_ON, KEYCODE_DPAD_LEFT)
            },
            }
        )
        if (enableMoveToNextDisplayShortcut()) {
            // Move a window to the next display:
            //  - Meta + Ctrl + D
            add(
                shortcutInfo(
                    resources.getString(R.string.system_multitasking_move_to_next_display)
                ) {
                    command(META_META_ON or META_CTRL_ON, KEYCODE_D)
                }
            )
        }
    }

    private fun recentsShortcuts() =
        listOf(