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

Commit 45aef1a8 authored by m0viefreak's avatar m0viefreak Committed by Steve Kondik
Browse files

add 'edit permissions' button to force close dialog if permissions are revoced

This button directly brings up the application settings to edit permissions.
This way one doesn't have to go through all the menus and the app list again.

Change-Id: I94a4e6127d01dd725d51613d51d27fe9e03ee863
parent f5d58f74
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -981,5 +981,6 @@
    <string name="aerr_revoked_application">Die Anwendung <xliff:g id="application">%1$s</xliff:g> (Prozess <xliff:g id="process">%2$s</xliff:g>) wurde unerwartet beendet.\nACHTUNG!\nDer Anwendung wurden eine oder mehrere Berechtigungen entzogen, was zu Anwendungsfehlern führen kann. Bitte erteilen Sie ihr wieder Berechtigungen und versuchen es erneut.</string>
    <string name="aerr_revoked_process">Der Prozess <xliff:g id="process">%1$s</xliff:g> wurde unerwartet beendet.\nACHTUNG!\nDer Anwendung wurden eine oder mehrere Berechtigungen entzogen, was zu Anwendungsfehlern führen kann. Bitte erteilen Sie ihr wieder Berechtigungen und versuchen es erneut.</string>
    <string name="reset_perms">Berechtigungen zurücksetzen</string>
    <string name="edit_perms">Berechtigungen ändern</string>
    <string name="openvpn_vpn_description">OpenVPN</string>
</resources>
+2 −0
Original line number Diff line number Diff line
@@ -2048,6 +2048,8 @@
    <string name="force_close">Force close</string>
    <!-- Button allowing the user to send a bug report for application which has encountered an error. -->
    <string name="report">Report</string>
    <!-- Button allowing the user to open the application settings screen to edit permissions. -->
    <string name="edit_perms">Edit permissions</string>
    <!-- Button allowing the user reset the revoked permissions for application which has encountered an error. -->
    <string name="reset_perms">Reset permissions</string>
    <!-- Button allowing the user to choose to wait for an application that is not responding to become responsive again. -->
+13 −0
Original line number Diff line number Diff line
@@ -6964,6 +6964,7 @@ public final class ActivityManagerService extends ActivityManagerNative
        int res = result.get();

        Intent appErrorIntent = null;
        Intent appSettingsIntent = null;
        synchronized (this) {
            if (r != null) {
                mProcessCrashTimes.put(r.info.processName, r.info.uid,
@@ -6982,6 +6983,11 @@ public final class ActivityManagerService extends ActivityManagerNative
                    Binder.restoreCallingIdentity(oldId);
                }
            }
            else if (res == AppErrorDialog.FORCE_QUIT_AND_OPEN_APP_SETTINGS) {
                appSettingsIntent = new Intent(android.provider.Settings.ACTION_APPLICATION_DETAILS_SETTINGS,
                        Uri.parse("package:" + r.info.packageName));
                appSettingsIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            }
        }

        if (appErrorIntent != null) {
@@ -6991,6 +6997,13 @@ public final class ActivityManagerService extends ActivityManagerNative
                Slog.w(TAG, "bug report receiver dissappeared", e);
            }
        }
        if (appSettingsIntent != null) {
            try {
                mContext.startActivity(appSettingsIntent);
            } catch (ActivityNotFoundException e) {
                Slog.w(TAG, "could not launch application settings", e);
            }
        }
    }

    Intent createAppErrorIntentLocked(ProcessRecord r,
+4 −0
Original line number Diff line number Diff line
@@ -35,6 +35,7 @@ class AppErrorDialog extends BaseErrorDialog {
    static final int FORCE_QUIT = 0;
    static final int FORCE_QUIT_AND_REPORT = 1;
    static final int FORCE_QUIT_AND_RESET_PERMS = 2;
    static final int FORCE_QUIT_AND_OPEN_APP_SETTINGS = 3;

    // 5-minute timeout, then we automatically dismiss the crash dialog
    static final long DISMISS_TIMEOUT = 1000 * 60 * 5;
@@ -85,6 +86,9 @@ class AppErrorDialog extends BaseErrorDialog {
        }

        if (showRevoked) {
            setButton(DialogInterface.BUTTON_NEUTRAL,
                    res.getText(com.android.internal.R.string.edit_perms),
                    mHandler.obtainMessage(FORCE_QUIT_AND_OPEN_APP_SETTINGS));
            setButton(DialogInterface.BUTTON_NEGATIVE,
                    res.getText(com.android.internal.R.string.reset_perms),
                    mHandler.obtainMessage(FORCE_QUIT_AND_RESET_PERMS));