summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Sharkey <jsharkey@android.com>2020-04-23 11:11:06 -0600
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2021-11-12 05:36:03 +0000
commit4e9ea675434412180e95d24ac178c6130c616b18 (patch)
tree938891084b74b2a80296b271a2f14f42a757362f
parentffa177d3e0d7e25d88e39aa279ad2c7a11ee9b38 (diff)
downloadbase-4e9ea675434412180e95d24ac178c6130c616b18.tar.gz
Force-set a ClipData to prevent later migration.
migrateExtraStreamToClipData() will only offer to promote Uri values if a ClipData isn't already defined, so we ensure that a ClipData value is always defined. This blocks later promotion and granting. Bug: 200683077 Bug: 123700107 Test: manual Change-Id: I99c1411e8b4eb01eb27ac4306e3bf6cc88cb4273 (cherry picked from commit 6ebf410b818c6a525130d5fcb72381217fec8e7a) (cherry picked from commit 3cf2b049867977916d29f1674f71e89b49ea1f69) Merged-In:I99c1411e8b4eb01eb27ac4306e3bf6cc88cb4273
-rw-r--r--services/core/java/com/android/server/accounts/AccountManagerService.java6
1 files changed, 6 insertions, 0 deletions
diff --git a/services/core/java/com/android/server/accounts/AccountManagerService.java b/services/core/java/com/android/server/accounts/AccountManagerService.java
index 08b708e6f875..9e8464728b9b 100644
--- a/services/core/java/com/android/server/accounts/AccountManagerService.java
+++ b/services/core/java/com/android/server/accounts/AccountManagerService.java
@@ -46,6 +46,7 @@ import android.app.admin.DeviceAdminInfo;
import android.app.admin.DevicePolicyManager;
import android.app.admin.DevicePolicyManagerInternal;
import android.content.BroadcastReceiver;
+import android.content.ClipData;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
@@ -4759,6 +4760,11 @@ public class AccountManagerService
* supplied entries in the system Settings app.
*/
protected boolean checkKeyIntent(int authUid, Intent intent) {
+ // Explicitly set an empty ClipData to ensure that we don't offer to
+ // promote any Uris contained inside for granting purposes
+ if (intent.getClipData() == null) {
+ intent.setClipData(ClipData.newPlainText(null, null));
+ }
intent.setFlags(intent.getFlags() & ~(Intent.FLAG_GRANT_READ_URI_PERMISSION
| Intent.FLAG_GRANT_WRITE_URI_PERMISSION
| Intent.FLAG_GRANT_PERSISTABLE_URI_PERMISSION