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

Commit 2efbfa3c authored by Jay Shrauner's avatar Jay Shrauner Committed by Natiq Ahmed
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 f2ceba09
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -174,6 +174,7 @@ import com.android.contacts.widget.QuickContactImageView;
import com.google.common.collect.Lists;
import com.google.common.collect.ImmutableList;

import java.lang.SecurityException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
@@ -417,6 +418,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();