Keyboard Shortcuts Helper: Include all System shortcuts
Also add support for shortcuts with no base character or keycode,
as needed by "Search" being triggered with just Meta.
Bug: 27454997
Change-Id: I75bc9d22c30f9ebcdcbea3fb53f166d942dc7b90
diff --git a/packages/SystemUI/res/values/strings.xml b/packages/SystemUI/res/values/strings.xml
index a523a41..a01066d 100644
--- a/packages/SystemUI/res/values/strings.xml
+++ b/packages/SystemUI/res/values/strings.xml
@@ -1388,6 +1388,31 @@
<string name="keyboard_shortcut_group_system_recents">Recents</string>
<!-- User visible title for the the keyboard shortcut that triggers the back action. -->
<string name="keyboard_shortcut_group_system_back">Back</string>
+ <!-- User visible title for the the keyboard shortcut that triggers the notification shade. -->
+ <string name="keyboard_shortcut_group_system_notifications">Notifications</string>
+ <!-- User visible title for the the keyboard shortcut that triggers the keyboard shortcuts helper. -->
+ <string name="keyboard_shortcut_group_system_shortcuts_helper">Keyboard Shortcuts</string>
+ <!-- User visible title for the the keyboard shortcut that switches input methods. -->
+ <string name="keyboard_shortcut_group_system_switch_input">Switch input method</string>
+
+ <!-- User visible title for the system-wide applications keyboard shortcuts list. -->
+ <string name="keyboard_shortcut_group_applications">Applications</string>
+ <!-- User visible title for the keyboard shortcut that takes the user to the assist app. -->
+ <string name="keyboard_shortcut_group_applications_assist">Assist</string>
+ <!-- User visible title for the keyboard shortcut that takes the user to the browser app. -->
+ <string name="keyboard_shortcut_group_applications_browser">Browser</string>
+ <!-- User visible title for the keyboard shortcut that takes the user to the contacts app. -->
+ <string name="keyboard_shortcut_group_applications_contacts">Contacts</string>
+ <!-- User visible title for the keyboard shortcut that takes the user to the email app. -->
+ <string name="keyboard_shortcut_group_applications_email">Email</string>
+ <!-- User visible title for the keyboard shortcut that takes the user to the instant messaging app. -->
+ <string name="keyboard_shortcut_group_applications_im">IM</string>
+ <!-- User visible title for the keyboard shortcut that takes the user to the music app. -->
+ <string name="keyboard_shortcut_group_applications_music">Music</string>
+ <!-- User visible title for the keyboard shortcut that takes the user to the YouTube app. -->
+ <string name="keyboard_shortcut_group_applications_youtube">YouTube</string>
+ <!-- User visible title for the keyboard shortcut that takes the user to the calendar app. -->
+ <string name="keyboard_shortcut_group_applications_calendar">Calendar</string>
<!-- SysUI Tuner: Option to show full do not disturb panel in volume [CHAR LIMIT=60] -->
<string name="tuner_full_zen_title">Show with volume controls</string>
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/KeyboardShortcuts.java b/packages/SystemUI/src/com/android/systemui/statusbar/KeyboardShortcuts.java
index 8fe60a0..2b365dc 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/KeyboardShortcuts.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/KeyboardShortcuts.java
@@ -245,7 +245,57 @@
systemGroup.addItem(new KeyboardShortcutInfo(
mContext.getString(R.string.keyboard_shortcut_group_system_recents),
KeyEvent.KEYCODE_TAB, KeyEvent.META_ALT_ON));
+ systemGroup.addItem(new KeyboardShortcutInfo(
+ mContext.getString(
+ R.string.keyboard_shortcut_group_system_notifications),
+ KeyEvent.KEYCODE_N, KeyEvent.META_META_ON));
+ systemGroup.addItem(new KeyboardShortcutInfo(
+ mContext.getString(
+ R.string.keyboard_shortcut_group_system_shortcuts_helper),
+ KeyEvent.KEYCODE_SLASH, KeyEvent.META_META_ON));
+ systemGroup.addItem(new KeyboardShortcutInfo(
+ mContext.getString(
+ R.string.keyboard_shortcut_group_system_switch_input),
+ KeyEvent.KEYCODE_SPACE, KeyEvent.META_META_ON));
result.add(systemGroup);
+
+ KeyboardShortcutGroup applicationGroup = new KeyboardShortcutGroup(
+ mContext.getString(R.string.keyboard_shortcut_group_applications),
+ true);
+ applicationGroup.addItem(new KeyboardShortcutInfo(
+ mContext.getString(
+ R.string.keyboard_shortcut_group_applications_assist),
+ KeyEvent.KEYCODE_UNKNOWN, KeyEvent.META_META_ON));
+ applicationGroup.addItem(new KeyboardShortcutInfo(
+ mContext.getString(
+ R.string.keyboard_shortcut_group_applications_browser),
+ KeyEvent.KEYCODE_B, KeyEvent.META_META_ON));
+ applicationGroup.addItem(new KeyboardShortcutInfo(
+ mContext.getString(
+ R.string.keyboard_shortcut_group_applications_contacts),
+ KeyEvent.KEYCODE_C, KeyEvent.META_META_ON));
+ applicationGroup.addItem(new KeyboardShortcutInfo(
+ mContext.getString(
+ R.string.keyboard_shortcut_group_applications_email),
+ KeyEvent.KEYCODE_E, KeyEvent.META_META_ON));
+ applicationGroup.addItem(new KeyboardShortcutInfo(
+ mContext.getString(
+ R.string.keyboard_shortcut_group_applications_im),
+ KeyEvent.KEYCODE_T, KeyEvent.META_META_ON));
+ applicationGroup.addItem(new KeyboardShortcutInfo(
+ mContext.getString(
+ R.string.keyboard_shortcut_group_applications_music),
+ KeyEvent.KEYCODE_P, KeyEvent.META_META_ON));
+ applicationGroup.addItem(new KeyboardShortcutInfo(
+ mContext.getString(
+ R.string.keyboard_shortcut_group_applications_youtube),
+ KeyEvent.KEYCODE_Y, KeyEvent.META_META_ON));
+ applicationGroup.addItem(new KeyboardShortcutInfo(
+ mContext.getString(
+ R.string.keyboard_shortcut_group_applications_calendar),
+ KeyEvent.KEYCODE_L, KeyEvent.META_META_ON));
+ result.add(applicationGroup);
+
showKeyboardShortcutsDialog(result);
}
}, deviceId);
@@ -354,11 +404,15 @@
return null;
}
String displayLabelString;
- if (info.getKeycode() == KeyEvent.KEYCODE_UNKNOWN) {
+ if (info.getBaseCharacter() > Character.MIN_VALUE) {
displayLabelString = String.valueOf(info.getBaseCharacter());
} else if (SPECIAL_CHARACTER_NAMES.get(info.getKeycode()) != null) {
displayLabelString = SPECIAL_CHARACTER_NAMES.get(info.getKeycode());
} else {
+ // Special case for shortcuts with no base key or keycode.
+ if (info.getKeycode() == KeyEvent.KEYCODE_UNKNOWN) {
+ return shortcutKeys;
+ }
// TODO: Have a generic map for when we don't have the device's.
char displayLabel = mKeyCharacterMap == null
? 0 : mKeyCharacterMap.getDisplayLabel(info.getKeycode());