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

Commit 52aa1cc1 authored by Chih-Yu Huang's avatar Chih-Yu Huang
Browse files

psc: Move isolated and isSdkSandbox to ProcessRecordInternal

This CL refactors the `isolated` and `isSdkSandbox` fields from
`ProcessRecord` to `ProcessRecordInternal`. It's the preparation to
decouple OomAdjuster with ProcessRecord.

Bug: 425766486
Test: m services.core
Test: atest MockingOomAdjusterTests OomAdjusterTests
Test: atest FrameworksServicesTestsRavenwood_ProcessStateController
Flag: EXEMPT pure refactor

Change-Id: I75b4b8f3023f0371399cdcc81e70c435b4262aa3
parent eb7c8ff9
Loading
Loading
Loading
Loading
+0 −4
Original line number Diff line number Diff line
@@ -94,8 +94,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 isolated;     // true if this is a special isolated process
    public final boolean isSdkSandbox; // true if this is an SDK sandbox process
    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.
@@ -602,8 +600,6 @@ class ProcessRecord extends ProcessRecordInternal implements WindowProcessListen
            }
        }
        processInfo = procInfo;
        isolated = Process.isIsolated(_uid);
        isSdkSandbox = Process.isSdkSandboxUid(_uid);
        appZygote = (UserHandle.getAppId(_uid) >= Process.FIRST_APP_ZYGOTE_ISOLATED_UID
                && UserHandle.getAppId(_uid) <= Process.LAST_APP_ZYGOTE_ISOLATED_UID);
        uid = _uid;
+6 −0
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@ import static com.android.server.wm.WindowProcessController.ACTIVITY_STATE_FLAG_

import android.annotation.ElapsedRealtimeLong;
import android.app.ActivityManager;
import android.os.Process;
import android.os.SystemClock;
import android.os.Trace;
import android.util.TimeUtils;
@@ -190,6 +191,9 @@ public abstract class ProcessRecordInternal {
    private final int mUid;
    private String mTrackName;

    public final boolean isolated;     // true if this is a special isolated process
    public final boolean isSdkSandbox; // true if this is an SDK sandbox process

    private Observer mObserver;
    private StartedServiceObserver mStartedServiceObserver;

@@ -589,6 +593,8 @@ 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);
        mServiceLock = serviceLock;
        mProcLock = procLock;
    }