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

Commit f0a3cc5a authored by Jeff Brown's avatar Jeff Brown
Browse files

Handle ActivityNotFoundException in the WM policy.

When invoking a registered shortcut for which the activity was not
found, the startActivity throws ActivityNotFoundException.  If this
exception is not caught and handled, then the shortcut key is
dispatched to the application instead of being suppressed as it
should have been.

Found while fixing Bug: 3396233

Change-Id: I0e8e9e3ba09dd403a901d5eae12839734be467ed
parent 85fd2c91
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -1402,7 +1402,14 @@ public class PhoneWindowManager implements WindowManagerPolicy {
                    Intent shortcutIntent = mShortcutManager.getIntent(kcm, keyCode, metaState);
                    if (shortcutIntent != null) {
                        shortcutIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                        try {
                            mContext.startActivity(shortcutIntent);
                        } catch (ActivityNotFoundException ex) {
                            Slog.w(TAG, "Dropping shortcut key combination because "
                                    + "the activity to which it is registered was not found: "
                                    + KeyEvent.keyCodeToString(mShortcutKeyPressed)
                                    + "+" + KeyEvent.keyCodeToString(keyCode), ex);
                        }
                    } else {
                        Slog.i(TAG, "Dropping unregistered shortcut key combination: "
                                + KeyEvent.keyCodeToString(mShortcutKeyPressed)