AppErrors: Don't suppress dialogs when ANR_SHOW_BACKGROUND is set

Change-Id: Ie6013013ff4e23e51e471e97d15e113cc759657e
Fixes: 30929056
This commit is contained in:
Adrian Roos
2016-08-23 14:26:39 +02:00
parent a0a718f5db
commit 6a7e08920c
2 changed files with 11 additions and 3 deletions

View File

@@ -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";

View File

@@ -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,7 +614,9 @@ class AppErrors {
// processes run critical code.
mService.removeProcessLocked(app, false, false, "crash");
mService.mStackSupervisor.resumeFocusedStackTopActivityLocked();
return false;
if (!showBackground) {
return false;
}
}
mService.mStackSupervisor.resumeFocusedStackTopActivityLocked();
} else {
@@ -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);