Merge "Only show dialog if top app is killed" into oc-mr1-dev

This commit is contained in:
Zhi An Ng
2017-10-13 20:08:49 +00:00
committed by Android (Google) Code Review

View File

@@ -5459,7 +5459,7 @@ public class ActivityManagerService extends IActivityManager.Stub
boolean doLowMem = app.instr == null; boolean doLowMem = app.instr == null;
boolean doOomAdj = doLowMem; boolean doOomAdj = doLowMem;
if (!app.killedByAm) { if (!app.killedByAm) {
maybeNotifyTopAppKilled(app); maybeNotifyTopAppKilledLocked(app);
Slog.i(TAG, "Process " + app.processName + " (pid " + pid + ") has died: " Slog.i(TAG, "Process " + app.processName + " (pid " + pid + ") has died: "
+ ProcessList.makeOomAdjString(app.setAdj) + ProcessList.makeOomAdjString(app.setAdj)
+ ProcessList.makeProcStateString(app.setProcState)); + ProcessList.makeProcStateString(app.setProcState));
@@ -5494,8 +5494,8 @@ public class ActivityManagerService extends IActivityManager.Stub
} }
/** Show system error dialog when a top app is killed by LMK */ /** Show system error dialog when a top app is killed by LMK */
void maybeNotifyTopAppKilled(ProcessRecord app) { void maybeNotifyTopAppKilledLocked(ProcessRecord app) {
if (!shouldNotifyTopAppKilled(app)) { if (!shouldNotifyTopAppKilledLocked(app)) {
return; return;
} }
@@ -5505,8 +5505,10 @@ public class ActivityManagerService extends IActivityManager.Stub
} }
/** Only show notification when the top app is killed on low ram devices */ /** Only show notification when the top app is killed on low ram devices */
private boolean shouldNotifyTopAppKilled(ProcessRecord app) { private boolean shouldNotifyTopAppKilledLocked(ProcessRecord app) {
return app.curSchedGroup == ProcessList.SCHED_GROUP_TOP_APP && final ActivityRecord TOP_ACT = resumedAppLocked();
final ProcessRecord TOP_APP = TOP_ACT != null ? TOP_ACT.app : null;
return app == TOP_APP &&
ActivityManager.isLowRamDeviceStatic(); ActivityManager.isLowRamDeviceStatic();
} }