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

Commit 2aa90627 authored by Yisroel Forta's avatar Yisroel Forta Committed by Android (Google) Code Review
Browse files

Merge "Fix AppStartInfo ProcessRecord lookup" into main

parents 6ca8e934 c89425b4
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -1085,12 +1085,15 @@ public class ActivityManagerService extends IActivityManager.Stub
        }
        @Override
        public void onActivityLaunched(long id, ComponentName name, int temperature, int userId) {
        public void onActivityLaunched(long id, ComponentName name, int temperature, int userId,
                    String processName) {
            mAppProfiler.onActivityLaunched();
            synchronized (ActivityManagerService.this) {
                ProcessRecord record = null;
                try {
                    record = getProcessRecordLocked(name.getPackageName(), mContext
                    String processRecordName = Flags.appStartInfoProcessNameFix()
                            ? processName : name.getPackageName();
                    record = getProcessRecordLocked(processRecordName, mContext
                            .getPackageManager().getPackageUidAsUser(name.getPackageName(), 0,
                            userId));
                } catch (NameNotFoundException nnfe) {
+10 −0
Original line number Diff line number Diff line
@@ -272,3 +272,13 @@ flag {
        purpose: PURPOSE_BUGFIX
    }
}

flag {
    name: "app_start_info_process_name_fix"
    namespace: "system_performance"
    description: "Use process name to lookup ProcessRecord."
    bug: "443136429"
    metadata {
        purpose: PURPOSE_BUGFIX
    }
}
 No newline at end of file
+2 −1
Original line number Diff line number Diff line
@@ -144,9 +144,10 @@ public class ActivityMetricsLaunchObserver {
     * @param name The launching activity name.
     * @param temperature The temperature at which a launch sequence had started.
     * @param userId The id of the user the activity is being launched for.
     * @param processName The name of the process that the launching activity belongs to.
     */
    public void onActivityLaunched(long id, ComponentName name, @Temperature int temperature,
            int userId) {
            int userId, String processName) {
    }

    /**
+1 −1
Original line number Diff line number Diff line
@@ -1814,7 +1814,7 @@ class ActivityMetricsLogger {
        // Beginning a launch is timing sensitive and so should be observed as soon as possible.
        mLaunchObserver.onActivityLaunched(info.mLaunchingState.mStartUptimeNs,
                info.mLastLaunchedActivity.mActivityComponent, temperature,
                info.mLastLaunchedActivity.mUserId);
                info.mLastLaunchedActivity.mUserId, info.mLastLaunchedActivity.processName);

        Trace.traceEnd(Trace.TRACE_TAG_ACTIVITY_MANAGER);
    }
+5 −4
Original line number Diff line number Diff line
@@ -84,10 +84,11 @@ class LaunchObserverRegistryImpl extends ActivityMetricsLaunchObserver implement
    }

    @Override
    public void onActivityLaunched(long id, ComponentName name, int temperature, int userId) {
    public void onActivityLaunched(long id, ComponentName name, int temperature, int userId,
            String processName) {
        mHandler.sendMessage(PooledLambda.obtainMessage(
                LaunchObserverRegistryImpl::handleOnActivityLaunched,
                this, id, name, temperature, userId));
                this, id, name, temperature, userId, processName));
    }

    @Override
@@ -138,10 +139,10 @@ class LaunchObserverRegistryImpl extends ActivityMetricsLaunchObserver implement
    }

    private void handleOnActivityLaunched(long id, ComponentName name,
            @Temperature int temperature, int userId) {
            @Temperature int temperature, int userId, String processName) {
        // Traverse start-to-end to meet the registerLaunchObserver multi-cast order guarantee.
        for (int i = 0; i < mList.size(); i++) {
            mList.get(i).onActivityLaunched(id, name, temperature, userId);
            mList.get(i).onActivityLaunched(id, name, temperature, userId, processName);
        }
    }

Loading