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

Commit 22681dc9 authored by Zhi An Ng's avatar Zhi An Ng Committed by android-build-merger
Browse files

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

am: 4018898a

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