Fix SecurityException crashes in onClick
Catch SecurityExceptions when attempting to launch activites and display
a toast indicating the app isn't found, consistent with Launcher2 handling.
Bug:18506811
Change-Id: I1b0c4a02597279ac31621293aa3c29d87a006ba4
diff --git a/src/com/android/contacts/quickcontact/QuickContactActivity.java b/src/com/android/contacts/quickcontact/QuickContactActivity.java
index b3b6b54..70d3281 100644
--- a/src/com/android/contacts/quickcontact/QuickContactActivity.java
+++ b/src/com/android/contacts/quickcontact/QuickContactActivity.java
@@ -147,6 +147,7 @@
import com.android.contacts.widget.QuickContactImageView;
import com.google.common.collect.Lists;
+import java.lang.SecurityException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
@@ -368,6 +369,11 @@
mHasIntentLaunched = true;
try {
startActivity(intent);
+ } catch (SecurityException ex) {
+ Toast.makeText(QuickContactActivity.this, R.string.missing_app,
+ Toast.LENGTH_SHORT).show();
+ Log.e(TAG, "QuickContacts does not have permission to launch "
+ + intent);
} catch (ActivityNotFoundException ex) {
Toast.makeText(QuickContactActivity.this, R.string.missing_app,
Toast.LENGTH_SHORT).show();