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

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

Merge "Fix start info handling of isolated processes" into main

parents 2bbce862 4faf0ca3
Loading
Loading
Loading
Loading
+22 −3
Original line number Diff line number Diff line
@@ -634,12 +634,20 @@ public final class AppStartInfoTracker {
        }

        final ApplicationStartInfo info = new ApplicationStartInfo(raw);
        int uid = raw.getRealUid();

        AppStartInfoContainer container = mData.get(raw.getPackageName(), raw.getRealUid());
        // Isolated process starts won't be reasonably accessible if stored by their uid, don't
        // store them.
        if (com.android.server.am.Flags.appStartInfoIsolatedProcess()
                && UserHandle.isIsolated(uid)) {
            return null;
        }

        AppStartInfoContainer container = mData.get(raw.getPackageName(), uid);
        if (container == null) {
            container = new AppStartInfoContainer(mAppStartInfoHistoryListSize);
            container.mUid = info.getRealUid();
            mData.put(raw.getPackageName(), raw.getRealUid(), container);
            container.mUid = uid;
            mData.put(raw.getPackageName(), uid, container);
        }
        container.addStartInfoLocked(info);

@@ -1010,6 +1018,17 @@ public final class AppStartInfoTracker {
                            new AppStartInfoContainer(mAppStartInfoHistoryListSize);
                    int uid = container.readFromProto(proto, AppsStartInfoProto.Package.USERS,
                            pkgName);

                    // If the isolated process flag is enabled and the uid is that of an isolated
                    // process, then break early so that the container will not be added to mData.
                    // This is expected only as a one time mitigation, records added after this flag
                    // is enabled should always return false for isIsolated and thereby always
                    // continue on.
                    if (com.android.server.am.Flags.appStartInfoIsolatedProcess()
                            && UserHandle.isIsolated(uid)) {
                        break;
                    }

                    synchronized (mLock) {
                        mData.put(pkgName, uid, container);
                    }
+10 −0
Original line number Diff line number Diff line
@@ -270,3 +270,13 @@ flag {
        purpose: PURPOSE_BUGFIX
    }
}

flag {
    name: "app_start_info_isolated_process"
    namespace: "system_performance"
    description: "Adjust handling of isolated process records to be discarded."
    bug: "374032823"
    metadata {
        purpose: PURPOSE_BUGFIX
    }
}