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

Commit 82a5a35c authored by Jay Shrauner's avatar Jay Shrauner
Browse files

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
parent fcfcae34
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -147,6 +147,7 @@ import com.android.contacts.widget.MultiShrinkScroller.MultiShrinkScrollerListen
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 @@ public class QuickContactActivity extends ContactsActivity {
            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();