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

Commit 6a7e0892 authored by Adrian Roos's avatar Adrian Roos
Browse files

AppErrors: Don't suppress dialogs when ANR_SHOW_BACKGROUND is set

Change-Id: Ie6013013ff4e23e51e471e97d15e113cc759657e
Fixes: 30929056
parent a0a718f5
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -5839,6 +5839,8 @@ public final class Settings {
        /**
         * If nonzero, ANRs in invisible background processes bring up a dialog.
         * Otherwise, the process will be silently killed.
         *
         * Also prevents ANRs and crash dialogs from being suppressed.
         * @hide
         */
        public static final String ANR_SHOW_BACKGROUND = "anr_show_background";
+9 −3
Original line number Diff line number Diff line
@@ -575,6 +575,8 @@ class AppErrors {
    boolean handleAppCrashLocked(ProcessRecord app, String reason,
            String shortMsg, String longMsg, String stackTrace, AppErrorDialog.Data data) {
        long now = SystemClock.uptimeMillis();
        boolean showBackground = Settings.Secure.getInt(mContext.getContentResolver(),
                Settings.Secure.ANR_SHOW_BACKGROUND, 0) != 0;

        Long crashTime;
        Long crashTimePersistent;
@@ -612,8 +614,10 @@ class AppErrors {
                // processes run critical code.
                mService.removeProcessLocked(app, false, false, "crash");
                mService.mStackSupervisor.resumeFocusedStackTopActivityLocked();
                if (!showBackground) {
                    return false;
                }
            }
            mService.mStackSupervisor.resumeFocusedStackTopActivityLocked();
        } else {
            TaskRecord affectedTask =
@@ -705,7 +709,7 @@ class AppErrors {
            }
            final boolean crashSilenced = mAppsNotReportingCrashes != null &&
                    mAppsNotReportingCrashes.contains(proc.info.packageName);
            if (mService.canShowErrorDialogs() && !crashSilenced) {
            if ((mService.canShowErrorDialogs() || showBackground) && !crashSilenced) {
                proc.crashDialog = new AppErrorDialog(mContext, mService, data);
            } else {
                // The device is asleep, so just pretend that the user
@@ -942,7 +946,9 @@ class AppErrors {
                    null, null, 0, null, null, null, AppOpsManager.OP_NONE,
                    null, false, false, MY_PID, Process.SYSTEM_UID, 0 /* TODO: Verify */);

            if (mService.canShowErrorDialogs()) {
            boolean showBackground = Settings.Secure.getInt(mContext.getContentResolver(),
                    Settings.Secure.ANR_SHOW_BACKGROUND, 0) != 0;
            if (mService.canShowErrorDialogs() || showBackground) {
                d = new AppNotRespondingDialog(mService,
                        mContext, proc, (ActivityRecord)data.get("activity"),
                        msg.arg1 != 0);