Merge "Update latest ActivityRecord#mLaunchSourceType if possible." into main
diff --git a/services/core/java/com/android/server/wm/ActivityRecord.java b/services/core/java/com/android/server/wm/ActivityRecord.java
index d039b04..2dbf5bbf 100644
--- a/services/core/java/com/android/server/wm/ActivityRecord.java
+++ b/services/core/java/com/android/server/wm/ActivityRecord.java
@@ -495,7 +495,7 @@
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 @@
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 5bfe9d7..c89f3a3 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 @@
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 b0d8925..afdbc0a 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 @@
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());