summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNan Wu <wnan@google.com>2023-08-25 15:02:28 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-11-20 22:05:17 +0000
commita3c05a04776be0cbd3e37428ffd7170d08e6dc83 (patch)
treebf7410a77d18339f2ca9dd29aa15e3033e95e0ee
parentf9b9bae61cbbfad3728491eb7ba2983861d6eaf0 (diff)
downloadbase-a3c05a04776be0cbd3e37428ffd7170d08e6dc83.tar.gz
RESTRICT AUTOMERGE
Log to detect usage of whitelistToken when sending non-PI target Log ActivityManagerService.sendIntentSender if the target is not a PendingIntent and a non-null whitelistToken is sent to the client. This is simply to detect if there are real cases this would happen before we decide simply remove whitelistToken in that case. Do not pass whitelistToken when sending non-PI target In ActivityManagerService.sendIntentSender, if the target is not a PendingIntent, do not send whitelistToken to the client. Bug: 279428283 Test: Manual test (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:7a76717b61d8cb90a4987454f34e88417d68608b) Merged-In: I017486354a1ab2f14d0472c355583d53c27c4810 Change-Id: I017486354a1ab2f14d0472c355583d53c27c4810
-rw-r--r--services/core/java/com/android/server/am/ActivityManagerService.java15
1 files changed, 14 insertions, 1 deletions
diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java
index ffa290649580..5a12cdaae56c 100644
--- a/services/core/java/com/android/server/am/ActivityManagerService.java
+++ b/services/core/java/com/android/server/am/ActivityManagerService.java
@@ -5035,7 +5035,20 @@ public class ActivityManagerService extends IActivityManager.Stub
intent = new Intent(Intent.ACTION_MAIN);
}
try {
- target.send(code, intent, resolvedType, allowlistToken, null,
+ if (allowlistToken != null) {
+ final int callingUid = Binder.getCallingUid();
+ final String packageName;
+ final long token = Binder.clearCallingIdentity();
+ try {
+ packageName = AppGlobals.getPackageManager().getNameForUid(callingUid);
+ } finally {
+ Binder.restoreCallingIdentity(token);
+ }
+ Slog.wtf(TAG, "Send a non-null allowlistToken to a non-PI target."
+ + " Calling package: " + packageName + "; intent: " + intent
+ + "; options: " + options);
+ }
+ target.send(code, intent, resolvedType, null, null,
requiredPermission, options);
} catch (RemoteException e) {
}