Add a intent creator token for the activity interceptors
When an activity launch is intercepted, Intent#prepareToLeaveProcess is
not called since the interception happens in the system_server. So if
any activity is calling a trampoline activity, the keys do not get
collected.
Since all the interceptors are present in the system_server, add the
creator token before launching the intercepted intent.
Bug: 399442502
Flag: EXEMPT (bug fix)
Test: m
Change-Id: I4434534b4bed8ef858603c95097d9855bf4d58a8
diff --git a/services/core/java/com/android/server/wm/ActivityStartInterceptor.java b/services/core/java/com/android/server/wm/ActivityStartInterceptor.java
index 5cc186c..a19f438 100644
--- a/services/core/java/com/android/server/wm/ActivityStartInterceptor.java
+++ b/services/core/java/com/android/server/wm/ActivityStartInterceptor.java
@@ -272,6 +272,12 @@
mActivityOptions = interceptResult.getActivityOptions();
mCallingPid = mRealCallingPid;
mCallingUid = mRealCallingUid;
+ // When an activity launch is intercepted, Intent#prepareToLeaveProcess is not called
+ // since the interception happens in the system_server. So if any activity is calling
+ // a trampoline activity, the keys do not get collected. Since all the interceptors
+ // are present in the system_server, add the creator token before launching the
+ // intercepted intent.
+ mService.mAmInternal.addCreatorToken(mIntent, mCallingPackage);
if (interceptResult.isActivityResolved()) {
return true;
}