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

Commit aa3ec79b authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "am: Migrate updateAppUidRecLSP() to use ProcessRecordInternal" into main

parents 99932895 3d7ad161
Loading
Loading
Loading
Loading
+8 −9
Original line number Diff line number Diff line
@@ -1287,7 +1287,7 @@ public abstract class OomAdjuster {
    @GuardedBy({"mService", "mProcLock"})
    protected void updateAppUidRecIfNecessaryLSP(final ProcessRecord app) {
        if (!app.isKilledByAm() && app.isProcessRunning()) {
            if (app.isolated && app.mServices.numberOfRunningServices() <= 0
            if (app.isolated && app.getServices().numberOfRunningServices() <= 0
                    && app.getIsolatedEntryPoint() == null) {
                // No op.
            } else {
@@ -1298,18 +1298,17 @@ public abstract class OomAdjuster {
    }

    @GuardedBy({"mService", "mProcLock"})
    private void updateAppUidRecLSP(ProcessRecord app) {
    private void updateAppUidRecLSP(ProcessRecordInternal app) {
        final UidRecordInternal uidRec = app.getUidRecord();
        if (uidRec != null) {
            final ProcessRecordInternal state = app;
            uidRec.setEphemeral(app.info.isInstantApp());
            if (uidRec.getCurProcState() > state.getCurProcState()) {
                uidRec.setCurProcState(state.getCurProcState());
            uidRec.setEphemeral(app.isInstantApp());
            if (uidRec.getCurProcState() > app.getCurProcState()) {
                uidRec.setCurProcState(app.getCurProcState());
            }
            if (app.mServices.hasForegroundServices()) {
            if (app.getServices().hasForegroundServices()) {
                uidRec.setHasForegroundServices(true);
            }
            uidRec.setCurCapability(uidRec.getCurCapability() | state.getCurCapability());
            uidRec.setCurCapability(uidRec.getCurCapability() | app.getCurCapability());
        }
    }

@@ -2303,7 +2302,7 @@ public abstract class OomAdjuster {
                mService.mHandler.post(() -> {
                    synchronized (mService) {
                        mService.mServices.stopAllForegroundServicesLocked(
                                app.uid, app.info.packageName);
                                app.uid, app.getPackageName());
                    }
                });
            }
+10 −0
Original line number Diff line number Diff line
@@ -1225,6 +1225,16 @@ class ProcessRecord extends ProcessRecordInternal implements WindowProcessListen
        return info.uid;
    }

    @Override
    public String getPackageName() {
        return info.packageName;
    }

    @Override
    public boolean isInstantApp() {
        return info.isInstantApp();
    }

    @Override
    public long getLastPss() {
        return mProfile.getLastPss();
+6 −0
Original line number Diff line number Diff line
@@ -247,6 +247,12 @@ public abstract class ProcessRecordInternal {
     */
    public abstract int getApplicationUid();

    /** Returns the package name of the application this process belongs to. */
    public abstract String getPackageName();

    /** Returns whether this process is for an instant app. */
    public abstract boolean isInstantApp();

    /** Returns the {@link UidRecordInternal} associated with this process. */
    public abstract UidRecordInternal getUidRecord();