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

Commit b4eca62f authored by Wei Sheng Shih's avatar Wei Sheng Shih Committed by Android (Google) Code Review
Browse files

Merge "Update latest ActivityRecord#mLaunchSourceType if possible." into main

parents eb4760c4 fc5c53f4
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -495,7 +495,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
    final String launchedFromPackage; // always the package who started the activity.
    @Nullable
    final String launchedFromFeatureId; // always the feature in launchedFromPackage
    private final int mLaunchSourceType; // original launch source type
    int mLaunchSourceType; // latest launch source type
    final Intent intent;    // the original intent that generated us
    final String shortComponentName; // the short component name of the intent
    final String resolvedType; // as per original caller;
@@ -2451,6 +2451,10 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
        return mLaunchSourceType == type;
    }

    void updateLaunchSourceType(int launchFromUid, WindowProcessController caller) {
        mLaunchSourceType = determineLaunchSourceType(launchFromUid, caller);
    }

    private int determineLaunchSourceType(int launchFromUid, WindowProcessController caller) {
        if (launchFromUid == Process.SYSTEM_UID || launchFromUid == Process.ROOT_UID) {
            return LAUNCH_SOURCE_TYPE_SYSTEM;
+3 −0
Original line number Diff line number Diff line
@@ -1793,6 +1793,9 @@ class ActivityStarter {
                    activity.destroyIfPossible("Removes redundant singleInstance");
                }
            }
            if (mLastStartActivityRecord != null) {
                targetTaskTop.mLaunchSourceType = mLastStartActivityRecord.mLaunchSourceType;
            }
            targetTaskTop.mTransitionController.collect(targetTaskTop);
            recordTransientLaunchIfNeeded(targetTaskTop);
            // Recycle the target task for this launch.
+7 −0
Original line number Diff line number Diff line
@@ -2801,6 +2801,13 @@ public class ActivityTaskSupervisor implements RecentTasks.Callbacks {
                                targetActivity, activityOptions);
                    }

                    if (callingPid > 0) {
                        final WindowProcessController wpc = mService.mProcessMap
                                .getProcess(callingPid);
                        if (wpc != null) {
                            targetActivity.updateLaunchSourceType(callingUid, wpc);
                        }
                    }
                    mService.getActivityStartController().postStartActivityProcessingForLastStarter(
                            task.getTopNonFinishingActivity(), ActivityManager.START_TASK_TO_FRONT,
                            task.getRootTask());