AppErrors: Don't suppress dialogs when ANR_SHOW_BACKGROUND is set
Change-Id: Ie6013013ff4e23e51e471e97d15e113cc759657e Fixes: 30929056
This commit is contained in:
@@ -5839,6 +5839,8 @@ public final class Settings {
|
|||||||
/**
|
/**
|
||||||
* If nonzero, ANRs in invisible background processes bring up a dialog.
|
* If nonzero, ANRs in invisible background processes bring up a dialog.
|
||||||
* Otherwise, the process will be silently killed.
|
* Otherwise, the process will be silently killed.
|
||||||
|
*
|
||||||
|
* Also prevents ANRs and crash dialogs from being suppressed.
|
||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
public static final String ANR_SHOW_BACKGROUND = "anr_show_background";
|
public static final String ANR_SHOW_BACKGROUND = "anr_show_background";
|
||||||
|
|||||||
@@ -575,6 +575,8 @@ class AppErrors {
|
|||||||
boolean handleAppCrashLocked(ProcessRecord app, String reason,
|
boolean handleAppCrashLocked(ProcessRecord app, String reason,
|
||||||
String shortMsg, String longMsg, String stackTrace, AppErrorDialog.Data data) {
|
String shortMsg, String longMsg, String stackTrace, AppErrorDialog.Data data) {
|
||||||
long now = SystemClock.uptimeMillis();
|
long now = SystemClock.uptimeMillis();
|
||||||
|
boolean showBackground = Settings.Secure.getInt(mContext.getContentResolver(),
|
||||||
|
Settings.Secure.ANR_SHOW_BACKGROUND, 0) != 0;
|
||||||
|
|
||||||
Long crashTime;
|
Long crashTime;
|
||||||
Long crashTimePersistent;
|
Long crashTimePersistent;
|
||||||
@@ -612,7 +614,9 @@ class AppErrors {
|
|||||||
// processes run critical code.
|
// processes run critical code.
|
||||||
mService.removeProcessLocked(app, false, false, "crash");
|
mService.removeProcessLocked(app, false, false, "crash");
|
||||||
mService.mStackSupervisor.resumeFocusedStackTopActivityLocked();
|
mService.mStackSupervisor.resumeFocusedStackTopActivityLocked();
|
||||||
return false;
|
if (!showBackground) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
mService.mStackSupervisor.resumeFocusedStackTopActivityLocked();
|
mService.mStackSupervisor.resumeFocusedStackTopActivityLocked();
|
||||||
} else {
|
} else {
|
||||||
@@ -705,7 +709,7 @@ class AppErrors {
|
|||||||
}
|
}
|
||||||
final boolean crashSilenced = mAppsNotReportingCrashes != null &&
|
final boolean crashSilenced = mAppsNotReportingCrashes != null &&
|
||||||
mAppsNotReportingCrashes.contains(proc.info.packageName);
|
mAppsNotReportingCrashes.contains(proc.info.packageName);
|
||||||
if (mService.canShowErrorDialogs() && !crashSilenced) {
|
if ((mService.canShowErrorDialogs() || showBackground) && !crashSilenced) {
|
||||||
proc.crashDialog = new AppErrorDialog(mContext, mService, data);
|
proc.crashDialog = new AppErrorDialog(mContext, mService, data);
|
||||||
} else {
|
} else {
|
||||||
// The device is asleep, so just pretend that the user
|
// 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, null, 0, null, null, null, AppOpsManager.OP_NONE,
|
||||||
null, false, false, MY_PID, Process.SYSTEM_UID, 0 /* TODO: Verify */);
|
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,
|
d = new AppNotRespondingDialog(mService,
|
||||||
mContext, proc, (ActivityRecord)data.get("activity"),
|
mContext, proc, (ActivityRecord)data.get("activity"),
|
||||||
msg.arg1 != 0);
|
msg.arg1 != 0);
|
||||||
|
|||||||
Reference in New Issue
Block a user