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

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

Merge "Remove AppStartInfo uid query" into main

parents 58a717f2 734e3455
Loading
Loading
Loading
Loading
+5 −12
Original line number Diff line number Diff line
@@ -1085,20 +1085,13 @@ public class ActivityManagerService extends IActivityManager.Stub
        }
        @Override
        public void onActivityLaunched(long id, ComponentName name, int temperature, int userId,
                    String processName) {
        public void onActivityLaunched(long id, ComponentName name, int temperature,
                String processName, int uid) {
            mAppProfiler.onActivityLaunched();
            synchronized (ActivityManagerService.this) {
                ProcessRecord record = null;
                try {
                String processRecordName = Flags.appStartInfoProcessNameFix()
                        ? processName : name.getPackageName();
                    record = getProcessRecordLocked(processRecordName, mContext
                            .getPackageManager().getPackageUidAsUser(name.getPackageName(), 0,
                            userId));
                } catch (NameNotFoundException nnfe) {
                    // Ignore, record will be lost.
                }
                ProcessRecord record = getProcessRecordLocked(processRecordName, uid);
                mProcessList.getAppStartInfoTracker().onActivityLaunched(id, name, temperature,
                        record);
            }
+2 −2
Original line number Diff line number Diff line
@@ -143,11 +143,11 @@ public class ActivityMetricsLaunchObserver {
     *           but cannot coalesce to the existing one, e.g. to a different display.
     * @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.
     * @param uid The uid of the process that the launching activity belongs to.
     */
    public void onActivityLaunched(long id, ComponentName name, @Temperature int temperature,
            int userId, String processName) {
            String processName, int uid) {
    }

    /**
+2 −1
Original line number Diff line number Diff line
@@ -1814,7 +1814,8 @@ 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.processName);
                info.mLastLaunchedActivity.processName,
                info.mLastLaunchedActivity.getUid());

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

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

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

    private void handleOnActivityLaunched(long id, ComponentName name,
            @Temperature int temperature, int userId, String processName) {
            @Temperature int temperature, String processName, int uid) {
        // 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, processName);
            mList.get(i).onActivityLaunched(id, name, temperature, processName, uid);
        }
    }

+1 −1
Original line number Diff line number Diff line
@@ -125,7 +125,7 @@ public class ActivityMetricsLaunchObserverTests extends WindowTestsBase {
    private void verifyOnActivityLaunched(ActivityRecord activity) {
        final ArgumentCaptor<Long> idCaptor = ArgumentCaptor.forClass(Long.class);
        verifyAsync(mLaunchObserver).onActivityLaunched(idCaptor.capture(),
                eq(activity.mActivityComponent), anyInt(), anyInt(), anyString());
                eq(activity.mActivityComponent), anyInt(), anyString(), anyInt());
        final long id = idCaptor.getValue();
        setExpectedStartedId(id, activity);
        mLastLaunchedIds.put(activity.mActivityComponent, id);