Skip to content

Commit bc52ca2

Browse files
committed
Stop ANR dialogs from appearing when ActivityManager dialogs should not be shown
Stop ANR dialogs from appearing on devices where the ActivityManager dialogs should not be shown. Instead, kill the process. This is preferable because the user can't actually do anything on the device. TESTED = runs on device with that config, simulated ANR using test app. Change-Id: I6267000afd12ef929f0c625220184c6ab0139552
1 parent c7e56ef commit bc52ca2

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

services/java/com/android/server/am/ActivityManagerService.java

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -933,11 +933,15 @@ public void handleMessage(Message msg) {
933933
broadcastIntentLocked(null, null, intent,
934934
null, null, 0, null, null, null,
935935
false, false, MY_PID, Process.SYSTEM_UID);
936-
937-
Dialog d = new AppNotRespondingDialog(ActivityManagerService.this,
938-
mContext, proc, (ActivityRecord)data.get("activity"));
939-
d.show();
940-
proc.anrDialog = d;
936+
if (mShowDialogs) {
937+
Dialog d = new AppNotRespondingDialog(ActivityManagerService.this,
938+
mContext, proc, (ActivityRecord) data.get("activity"));
939+
d.show();
940+
proc.anrDialog = d;
941+
} else {
942+
// Just kill the app if there is no dialog to be shown.
943+
killAppAtUsersRequest(proc, null);
944+
}
941945
}
942946

943947
ensureBootCompleted();

0 commit comments

Comments
 (0)