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
diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
index fd84a2a..066daa8 100755
--- a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
+++ b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
@@ -1402,7 +1402,14 @@
                     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)