diff options
3 files changed, 15 insertions, 1 deletions
diff --git a/services/core/java/com/android/server/wm/ActivityRecord.java b/services/core/java/com/android/server/wm/ActivityRecord.java index 03a13776a0ea..357b9c2e93ca 100644 --- a/services/core/java/com/android/server/wm/ActivityRecord.java +++ b/services/core/java/com/android/server/wm/ActivityRecord.java @@ -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; diff --git a/services/core/java/com/android/server/wm/ActivityStarter.java b/services/core/java/com/android/server/wm/ActivityStarter.java index 5bfe9d744975..c89f3a3a215e 100644 --- a/services/core/java/com/android/server/wm/ActivityStarter.java +++ b/services/core/java/com/android/server/wm/ActivityStarter.java @@ -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. diff --git a/services/core/java/com/android/server/wm/ActivityTaskSupervisor.java b/services/core/java/com/android/server/wm/ActivityTaskSupervisor.java index e81b440f6d6d..f72ac6a7a967 100644 --- a/services/core/java/com/android/server/wm/ActivityTaskSupervisor.java +++ b/services/core/java/com/android/server/wm/ActivityTaskSupervisor.java @@ -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()); |