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

Commit 1427fca4 authored by Josep del Río's avatar Josep del Río Committed by Android (Google) Code Review
Browse files

Merge "Reland modify bookmark shortcuts for platform alignment" into main

parents 99a430fc bcc88427
Loading
Loading
Loading
Loading
+4 −16
Original line number Diff line number Diff line
@@ -20,14 +20,10 @@

     Typical shortcuts (not necessarily defined here):
       'b': Browser
       'c': Contacts
       'p': Contacts
       'e': Email
       'g': GMail
       'k': Calendar
       'c': Calendar
       'm': Maps
       'p': Music
       's': SMS
       't': Talk
       'u': Calculator
       'y': YouTube
-->
@@ -38,7 +34,7 @@
        androidprv:modifierState="META" />
    <bookmark
        category="android.intent.category.APP_CONTACTS"
        androidprv:keycode="KEYCODE_C"
        androidprv:keycode="KEYCODE_P"
        androidprv:modifierState="META" />
    <bookmark
        category="android.intent.category.APP_EMAIL"
@@ -46,20 +42,12 @@
        androidprv:modifierState="META" />
    <bookmark
        category="android.intent.category.APP_CALENDAR"
        androidprv:keycode="KEYCODE_K"
        androidprv:keycode="KEYCODE_C"
        androidprv:modifierState="META" />
    <bookmark
        category="android.intent.category.APP_MAPS"
        androidprv:keycode="KEYCODE_M"
        androidprv:modifierState="META" />
    <bookmark
        category="android.intent.category.APP_MUSIC"
        androidprv:keycode="KEYCODE_P"
        androidprv:modifierState="META" />
    <bookmark
        role="android.app.role.SMS"
        androidprv:keycode="KEYCODE_S"
        androidprv:modifierState="META" />
    <bookmark
        category="android.intent.category.APP_CALCULATOR"
        androidprv:keycode="KEYCODE_U"
+2 −8
Original line number Diff line number Diff line
@@ -768,8 +768,6 @@ public final class KeyboardShortcutListSearch {
                    Intent.CATEGORY_APP_EMAIL,
                    Intent.CATEGORY_APP_CALENDAR,
                    Intent.CATEGORY_APP_MAPS,
                    Intent.CATEGORY_APP_MUSIC,
                    Intent.CATEGORY_APP_MESSAGING,
                    Intent.CATEGORY_APP_CALCULATOR,
            };
            String[] shortcutLabels = {
@@ -778,19 +776,15 @@ public final class KeyboardShortcutListSearch {
                    mContext.getString(R.string.keyboard_shortcut_group_applications_email),
                    mContext.getString(R.string.keyboard_shortcut_group_applications_calendar),
                    mContext.getString(R.string.keyboard_shortcut_group_applications_maps),
                    mContext.getString(R.string.keyboard_shortcut_group_applications_music),
                    mContext.getString(R.string.keyboard_shortcut_group_applications_sms),
                    mContext.getString(R.string.keyboard_shortcut_group_applications_calculator)
            };

            int[] keyCodes = {
                KeyEvent.KEYCODE_B,
                KeyEvent.KEYCODE_C,
                KeyEvent.KEYCODE_P,
                KeyEvent.KEYCODE_E,
                KeyEvent.KEYCODE_K,
                KeyEvent.KEYCODE_C,
                KeyEvent.KEYCODE_M,
                KeyEvent.KEYCODE_P,
                KeyEvent.KEYCODE_S,
                KeyEvent.KEYCODE_U,
            };

+2 −10
Original line number Diff line number Diff line
@@ -22,7 +22,7 @@
        androidprv:modifierState="META" />
    <bookmark
        category="android.intent.category.APP_CONTACTS"
        androidprv:keycode="KEYCODE_C"
        androidprv:keycode="KEYCODE_P"
        androidprv:modifierState="META" />
    <bookmark
        category="android.intent.category.APP_EMAIL"
@@ -30,20 +30,12 @@
        androidprv:modifierState="META" />
    <bookmark
        category="android.intent.category.APP_CALENDAR"
        androidprv:keycode="KEYCODE_K"
        androidprv:keycode="KEYCODE_C"
        androidprv:modifierState="META" />
    <bookmark
        category="android.intent.category.APP_MAPS"
        androidprv:keycode="KEYCODE_M"
        androidprv:modifierState="META" />
    <bookmark
        category="android.intent.category.APP_MUSIC"
        androidprv:keycode="KEYCODE_P"
        androidprv:modifierState="META" />
    <bookmark
        role="android.app.role.SMS"
        androidprv:keycode="KEYCODE_S"
        androidprv:modifierState="META" />
    <bookmark
        category="android.intent.category.APP_CALCULATOR"
        androidprv:keycode="KEYCODE_U"
+5 −12
Original line number Diff line number Diff line
@@ -258,9 +258,9 @@ public class KeyGestureEventTests extends ShortcutKeyTestBase {
                {"EXPLORER key -> Launch Default Browser", new int[]{KeyEvent.KEYCODE_EXPLORER},
                        KeyGestureEvent.KEY_GESTURE_TYPE_LAUNCH_DEFAULT_BROWSER,
                        KeyEvent.KEYCODE_EXPLORER, 0},
                {"Meta + C -> Launch Default Contacts", new int[]{META_KEY, KeyEvent.KEYCODE_C},
                {"Meta + P -> Launch Default Contacts", new int[]{META_KEY, KeyEvent.KEYCODE_P},
                        KeyGestureEvent.KEY_GESTURE_TYPE_LAUNCH_DEFAULT_CONTACTS,
                        KeyEvent.KEYCODE_C, META_ON},
                        KeyEvent.KEYCODE_P, META_ON},
                {"CONTACTS key -> Launch Default Contacts", new int[]{KeyEvent.KEYCODE_CONTACTS},
                        KeyGestureEvent.KEY_GESTURE_TYPE_LAUNCH_DEFAULT_CONTACTS,
                        KeyEvent.KEYCODE_CONTACTS, 0},
@@ -270,15 +270,12 @@ public class KeyGestureEventTests extends ShortcutKeyTestBase {
                {"ENVELOPE key -> Launch Default Email", new int[]{KeyEvent.KEYCODE_ENVELOPE},
                        KeyGestureEvent.KEY_GESTURE_TYPE_LAUNCH_DEFAULT_EMAIL,
                        KeyEvent.KEYCODE_ENVELOPE, 0},
                {"Meta + K -> Launch Default Calendar", new int[]{META_KEY, KeyEvent.KEYCODE_K},
                {"Meta + C -> Launch Default Calendar", new int[]{META_KEY, KeyEvent.KEYCODE_C},
                        KeyGestureEvent.KEY_GESTURE_TYPE_LAUNCH_DEFAULT_CALENDAR,
                        KeyEvent.KEYCODE_K, META_ON},
                        KeyEvent.KEYCODE_C, META_ON},
                {"CALENDAR key -> Launch Default Calendar", new int[]{KeyEvent.KEYCODE_CALENDAR},
                        KeyGestureEvent.KEY_GESTURE_TYPE_LAUNCH_DEFAULT_CALENDAR,
                        KeyEvent.KEYCODE_CALENDAR, 0},
                {"Meta + P -> Launch Default Music", new int[]{META_KEY, KeyEvent.KEYCODE_P},
                        KeyGestureEvent.KEY_GESTURE_TYPE_LAUNCH_DEFAULT_MUSIC,
                        KeyEvent.KEYCODE_P, META_ON},
                {"MUSIC key -> Launch Default Music", new int[]{KeyEvent.KEYCODE_MUSIC},
                        KeyGestureEvent.KEY_GESTURE_TYPE_LAUNCH_DEFAULT_MUSIC,
                        KeyEvent.KEYCODE_MUSIC, 0},
@@ -291,11 +288,7 @@ public class KeyGestureEventTests extends ShortcutKeyTestBase {
                        KeyEvent.KEYCODE_CALCULATOR, 0},
                {"Meta + M -> Launch Default Maps", new int[]{META_KEY, KeyEvent.KEYCODE_M},
                        KeyGestureEvent.KEY_GESTURE_TYPE_LAUNCH_DEFAULT_MAPS,
                        KeyEvent.KEYCODE_M, META_ON},
                {"Meta + S -> Launch Default Messaging App",
                        new int[]{META_KEY, KeyEvent.KEYCODE_S},
                        KeyGestureEvent.KEY_GESTURE_TYPE_LAUNCH_DEFAULT_MESSAGING,
                        KeyEvent.KEYCODE_S, META_ON}};
                        KeyEvent.KEYCODE_M, META_ON}};
    }

    @Keep
+3 −6
Original line number Diff line number Diff line
@@ -26,7 +26,6 @@ import static android.view.KeyEvent.KEYCODE_E;
import static android.view.KeyEvent.KEYCODE_ENTER;
import static android.view.KeyEvent.KEYCODE_H;
import static android.view.KeyEvent.KEYCODE_J;
import static android.view.KeyEvent.KEYCODE_K;
import static android.view.KeyEvent.KEYCODE_M;
import static android.view.KeyEvent.KEYCODE_META_LEFT;
import static android.view.KeyEvent.KEYCODE_N;
@@ -67,14 +66,12 @@ public class ModifierShortcutTests extends ShortcutKeyTestBase {
        // These shortcuts should align with those defined in
        // services/tests/wmtests/res/xml/bookmarks.xml
        INTENT_SHORTCUTS.append(KEYCODE_U, Intent.CATEGORY_APP_CALCULATOR);
        INTENT_SHORTCUTS.append(KEYCODE_C, Intent.CATEGORY_APP_CONTACTS);
        INTENT_SHORTCUTS.append(KEYCODE_P, Intent.CATEGORY_APP_CONTACTS);
        INTENT_SHORTCUTS.append(KEYCODE_E, Intent.CATEGORY_APP_EMAIL);
        INTENT_SHORTCUTS.append(KEYCODE_K, Intent.CATEGORY_APP_CALENDAR);
        INTENT_SHORTCUTS.append(KEYCODE_C, Intent.CATEGORY_APP_CALENDAR);
        INTENT_SHORTCUTS.append(KEYCODE_M, Intent.CATEGORY_APP_MAPS);
        INTENT_SHORTCUTS.append(KEYCODE_P, Intent.CATEGORY_APP_MUSIC);

        ROLE_SHORTCUTS.append(KEYCODE_B, RoleManager.ROLE_BROWSER);
        ROLE_SHORTCUTS.append(KEYCODE_S, RoleManager.ROLE_SMS);
    }
    private static final int ANY_DISPLAY_ID = 123;

@@ -109,7 +106,7 @@ public class ModifierShortcutTests extends ShortcutKeyTestBase {
        sendKeyCombination(new int[]{KEYCODE_META_LEFT, KEYCODE_SHIFT_LEFT, KEYCODE_B}, 0);
        mPhoneWindowManager.assertLaunchRole(RoleManager.ROLE_BROWSER);

        sendKeyCombination(new int[]{KEYCODE_META_LEFT, KEYCODE_SHIFT_LEFT, KEYCODE_C}, 0);
        sendKeyCombination(new int[]{KEYCODE_META_LEFT, KEYCODE_SHIFT_LEFT, KEYCODE_P}, 0);
        mPhoneWindowManager.assertLaunchCategory(Intent.CATEGORY_APP_CONTACTS);

        sendKeyCombination(new int[]{KEYCODE_META_LEFT, KEYCODE_SHIFT_LEFT, KEYCODE_J}, 0);
Loading