Fixing crash on keyboard shortcuts popup

Bug: 76218025
Test: Manual
Change-Id: I11c9005764c7b0492138dc17716a0c6c4578798e
This commit is contained in:
Vadim Tryshev 2018-05-11 20:02:20 -07:00
parent 08cf36ea54
commit 3455f8d0f6
1 changed files with 12 additions and 10 deletions

View File

@ -2291,16 +2291,18 @@ public class Launcher extends BaseDraggingActivity
shortcutInfos.add(new KeyboardShortcutInfo(getString(R.string.all_apps_button_label),
KeyEvent.KEYCODE_A, KeyEvent.META_CTRL_ON));
}
View currentFocus = getCurrentFocus();
if (new CustomActionsPopup(this, currentFocus).canShow()) {
shortcutInfos.add(new KeyboardShortcutInfo(getString(R.string.custom_actions),
KeyEvent.KEYCODE_O, KeyEvent.META_CTRL_ON));
}
if (currentFocus.getTag() instanceof ItemInfo
&& DeepShortcutManager.supportsShortcuts((ItemInfo) currentFocus.getTag())) {
shortcutInfos.add(new KeyboardShortcutInfo(
getString(R.string.shortcuts_menu_with_notifications_description),
KeyEvent.KEYCODE_S, KeyEvent.META_CTRL_ON));
final View currentFocus = getCurrentFocus();
if (currentFocus != null) {
if (new CustomActionsPopup(this, currentFocus).canShow()) {
shortcutInfos.add(new KeyboardShortcutInfo(getString(R.string.custom_actions),
KeyEvent.KEYCODE_O, KeyEvent.META_CTRL_ON));
}
if (currentFocus.getTag() instanceof ItemInfo
&& DeepShortcutManager.supportsShortcuts((ItemInfo) currentFocus.getTag())) {
shortcutInfos.add(new KeyboardShortcutInfo(
getString(R.string.shortcuts_menu_with_notifications_description),
KeyEvent.KEYCODE_S, KeyEvent.META_CTRL_ON));
}
}
if (!shortcutInfos.isEmpty()) {
data.add(new KeyboardShortcutGroup(getString(R.string.home_screen), shortcutInfos));