diff options
author | Vadim Tryshev <vadimt@google.com> | 2018-05-11 20:02:20 -0700 |
---|---|---|
committer | Vadim Tryshev <vadimt@google.com> | 2018-05-11 20:02:20 -0700 |
commit | 3455f8d0f6c1e7a2b9eb3fb64d534276d2932038 (patch) | |
tree | 66685e9dc7534a9740bf0c739086913e34785b6e /src | |
parent | 08cf36ea546a65c15ca7651042f3dc48805fdab0 (diff) | |
download | android_packages_apps_Trebuchet-3455f8d0f6c1e7a2b9eb3fb64d534276d2932038.tar.gz android_packages_apps_Trebuchet-3455f8d0f6c1e7a2b9eb3fb64d534276d2932038.tar.bz2 android_packages_apps_Trebuchet-3455f8d0f6c1e7a2b9eb3fb64d534276d2932038.zip |
Fixing crash on keyboard shortcuts popup
Bug: 76218025
Test: Manual
Change-Id: I11c9005764c7b0492138dc17716a0c6c4578798e
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/launcher3/Launcher.java | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java index 521ad48a3..b45ee2d69 100644 --- a/src/com/android/launcher3/Launcher.java +++ b/src/com/android/launcher3/Launcher.java @@ -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)); |