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
This commit is contained in:
@@ -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);
|
||||
mContext.startActivity(shortcutIntent);
|
||||
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)
|
||||
|
||||
Reference in New Issue
Block a user