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

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

Merge changes I9aafda0b,Ie984ad38 into main

* changes:
  psc: Move and refactor getUidRecord to ProcessRecordInternal
  psc: Remove redundant uid field from ProcessRecord
parents 0cf08da2 fb79f692
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -770,7 +770,7 @@ public abstract class OomAdjuster {
        // Scan downstreams of the process record
        for (ProcessRecord pr = queue.poll(); pr != null; pr = queue.poll()) {
            processes.add(pr);
            final UidRecord uidRec = pr.getUidRecord();
            final UidRecordInternal uidRec = pr.getUidRecord();
            if (uidRec != null) {
                uids.put(uidRec.getUid(), uidRec);
            }
+1 −2
Original line number Diff line number Diff line
@@ -641,8 +641,7 @@ public class OomAdjusterImpl extends OomAdjuster {
            // This process was updated in some way, mark that it was last calculated this sequence.
            app.setCompletedAdjSeq(mAdjSeq);
            if (uids != null) {
                final UidRecord uidRec = app.getUidRecord();

                final UidRecordInternal uidRec = app.getUidRecord();
                if (uidRec != null) {
                    uids.put(uidRec.getUid(), uidRec);
                }
+1 −1
Original line number Diff line number Diff line
@@ -5623,7 +5623,7 @@ public final class ProcessList implements ProcessStateController.ProcessLruUpdat
     */
    @GuardedBy("mService")
    long killAppIfBgRestrictedAndCachedIdleLocked(ProcessRecord app, long nowElapsed) {
        final UidRecord uidRec = app.getUidRecord();
        final UidRecordInternal uidRec = app.getUidRecord();
        final long lastCachedTime = app.getLastCachedTime();
        if (!mService.mConstants.mKillBgRestrictedAndCachedIdle
                || app.isKilled() || app.getThread() == null || uidRec == null || !uidRec.isIdle()
+2 −3
Original line number Diff line number Diff line
@@ -96,7 +96,6 @@ class ProcessRecord extends ProcessRecordInternal implements WindowProcessListen
    volatile ApplicationInfo info; // all about the first app in the process
    final ProcessInfo processInfo; // if non-null, process-specific manifest info
    final boolean appZygote;    // true if this is forked from the app zygote
    final int uid;              // uid of process; may be different from 'info' if isolated
    final int userId;           // user of process.
    final String processName;   // name of the process
    final String sdkSandboxClientAppPackage; // if this is an sdk sandbox process, name of the
@@ -597,7 +596,6 @@ class ProcessRecord extends ProcessRecordInternal implements WindowProcessListen
        processInfo = procInfo;
        appZygote = (UserHandle.getAppId(_uid) >= Process.FIRST_APP_ZYGOTE_ISOLATED_UID
                && UserHandle.getAppId(_uid) <= Process.LAST_APP_ZYGOTE_ISOLATED_UID);
        uid = _uid;
        userId = UserHandle.getUserId(_uid);
        processName = _processName;
        sdkSandboxClientAppPackage = _sdkSandboxClientAppPackage;
@@ -657,8 +655,9 @@ class ProcessRecord extends ProcessRecordInternal implements WindowProcessListen
        mErrorState.setCrashing(false);
    }

    @Override
    @GuardedBy(anyOf = {"mService", "mProcLock"})
    UidRecord getUidRecord() {
    public UidRecord getUidRecord() {
        return mUidRecord;
    }

+12 −5
Original line number Diff line number Diff line
@@ -223,13 +223,20 @@ public abstract class ProcessRecordInternal {
     */
    public abstract int getApplicationUid();

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

    // Enable this to trace all OomAdjuster state transitions
    private static final boolean TRACE_OOM_ADJ = false;

    private final String mProcessName;
    private final int mUid;
    private String mTrackName;

    /**
     * The process's actual UID.
     * This may differ from {@link #getApplicationUid()} if it's an isolated process.
     */
    public final int uid;
    public final boolean isolated;     // true if this is a special isolated process
    public final boolean isSdkSandbox; // true if this is an SDK sandbox process

@@ -667,9 +674,9 @@ public abstract class ProcessRecordInternal {

    public ProcessRecordInternal(String processName, int uid, Object serviceLock, Object procLock) {
        mProcessName = processName;
        mUid = uid;
        isSdkSandbox = Process.isSdkSandboxUid(mUid);
        isolated = Process.isIsolatedUid(mUid);
        this.uid = uid;
        isSdkSandbox = Process.isSdkSandboxUid(this.uid);
        isolated = Process.isIsolatedUid(this.uid);
        mServiceLock = serviceLock;
        mProcLock = procLock;
    }
@@ -1648,7 +1655,7 @@ public abstract class ProcessRecordInternal {
     */
    private String getTrackName() {
        if (mTrackName == null) {
            mTrackName = "oom:" + mProcessName + "/u" + mUid;
            mTrackName = "oom:" + mProcessName + "/u" + uid;
        }
        return mTrackName;
    }