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

Commit 8f7dd599 authored by Riddle Hsu's avatar Riddle Hsu
Browse files

Remove WM lock from simple conditions in oom-adj update

Though the conditions might get an intermediate state, the
original code with lock also has the similar symptom because
oom-adj calculation doesn't lock WM in entire update procedure.

And if there are important state changes, WM should schedule an
oom-adj update after the oom related field in WM are computed.
So it should eventually calculate the score steadily.

Bug: 159104503
Test: MockingOomAdjusterTests
      ActivityTaskManagerServiceTests
Change-Id: I75b715607203785f4fc6c0a2a18ed0a84d0a246a
parent 89387761
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -800,9 +800,7 @@ class AppErrors {
        // with a home activity running in the process to prevent a repeatedly crashing app
        // from blocking the user to manually clear the list.
        final WindowProcessController proc = app.getWindowProcessController();
        final WindowProcessController homeProc = mService.mAtmInternal.getHomeProcess();
        if (proc == homeProc && proc.hasActivities()
                && (((ProcessRecord) homeProc.mOwner).info.flags & FLAG_SYSTEM) == 0) {
        if (proc.isHomeProcess() && proc.hasActivities() && (app.info.flags & FLAG_SYSTEM) == 0) {
            proc.clearPackagePreferredForHomeActivities();
        }

+1 −1
Original line number Diff line number Diff line
@@ -3561,7 +3561,7 @@ public final class ProcessList {
            int clientTargetSdk) {
        outInfo.pid = app.pid;
        outInfo.uid = app.info.uid;
        if (mService.mAtmInternal.isHeavyWeightProcess(app.getWindowProcessController())) {
        if (app.getWindowProcessController().isHeavyWeightProcess()) {
            outInfo.flags |= ActivityManager.RunningAppProcessInfo.FLAG_CANT_SAVE_STATE;
        }
        if (app.isPersistent()) {
+2 −2
Original line number Diff line number Diff line
@@ -1850,8 +1850,8 @@ class ProcessRecord implements WindowProcessListener {

    boolean getCachedIsHeavyWeight() {
        if (mCachedIsHeavyWeight == VALUE_INVALID) {
            mCachedIsHeavyWeight = mService.mAtmInternal.isHeavyWeightProcess(
                    getWindowProcessController()) ? VALUE_TRUE : VALUE_FALSE;
            mCachedIsHeavyWeight = getWindowProcessController().isHeavyWeightProcess()
                    ? VALUE_TRUE : VALUE_FALSE;
        }
        return mCachedIsHeavyWeight == VALUE_TRUE;
    }
+2 −0
Original line number Diff line number Diff line
@@ -2058,6 +2058,8 @@ public class ActivityStackSupervisor implements RecentTasks.Callbacks {
        // Update the current top activity.
        mTopResumedActivity = topStack.mResumedActivity;
        scheduleTopResumedActivityStateIfNeeded();

        mService.updateTopApp(mTopResumedActivity);
    }

    /** Schedule top resumed state change if previous top activity already reported back. */
+0 −1
Original line number Diff line number Diff line
@@ -324,7 +324,6 @@ public abstract class ActivityTaskManagerInternal {
    public abstract void onProcessRemoved(String name, int uid);
    public abstract void onCleanUpApplicationRecord(WindowProcessController proc);
    public abstract int getTopProcessState();
    public abstract boolean isHeavyWeightProcess(WindowProcessController proc);
    public abstract void clearHeavyWeightProcessIfEquals(WindowProcessController proc);
    public abstract void finishHeavyWeightApp();

Loading