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

Commit 96690b6b authored by Chih-Yu Huang's avatar Chih-Yu Huang
Browse files

psc: Remove redundant uid field from ProcessRecord

The `uid` field in `ProcessRecord` was a duplication of the `mUid`
field already present in its superclass, `ProcessRecordInternal`. This
patch removes the redundant field from `ProcessRecord` and renames
`mUid` to `uid` in `ProcessRecordInternal`, making it public. This
consolidates the process UID definition in the base class.

Bug: 425766486
Test: m services.core
Test: atest MockingOomAdjusterTests OomAdjusterTests
Test: atest FrameworksServicesTestsRavenwood_ProcessStateController
Flag: EXEMPT pure refactor
Change-Id: Ie984ad388d0960486e2af6d03982c595408e4e50
parent c82d0007
Loading
Loading
Loading
Loading
+0 −2
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;
+9 −5
Original line number Diff line number Diff line
@@ -227,9 +227,13 @@ public abstract class ProcessRecordInternal {
    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 +671,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 +1652,7 @@ public abstract class ProcessRecordInternal {
     */
    private String getTrackName() {
        if (mTrackName == null) {
            mTrackName = "oom:" + mProcessName + "/u" + mUid;
            mTrackName = "oom:" + mProcessName + "/u" + uid;
        }
        return mTrackName;
    }