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

Commit fc5c53f4 authored by wilsonshih's avatar wilsonshih
Browse files

Update latest ActivityRecord#mLaunchSourceType if possible.

The launch source can change when the top activity is launched from
recents or home, make it updatable so the style and theme used for
starting window can be correct.

Flag: EXEMPT bugfix
Bug: 340401554
Bug: 353187744
Test: atest EnsureBarContrastTest WindowInsetsControllerTests
Test: launch test app then kill app process, verify system will show
starting window when launch app again.

Change-Id: Ie7eedcea7a81ac5be835f04993ebb291ca6c0672
parent 81096d0d
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -497,7 +497,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;
@@ -2450,6 +2450,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());