summaryrefslogtreecommitdiff
path: root/services/backup
diff options
context:
space:
mode:
authorTobias Thierer <tobiast@google.com>2020-12-10 13:46:08 +0000
committerTobias Thierer <tobiast@google.com>2020-12-11 00:55:44 +0000
commitdabbcf5903dc6838488fe67bee1f97cc5078cc5a (patch)
tree0bdf53379c4f0132a2903fccda8017a53da674b6 /services/backup
parentc6d183923ced854d78896b2ea6d7db21a65c5f45 (diff)
Fix DevicePolicyManager.isBackupServiceEnabled() breakage.
http://ag/12885739 introduced a enforceCallingPermission(BACKUP) check but callers of this API do not hold that permission. This CL fixes this by changing the check to enforceCallingOrSelfPermission(BACKUP), and clearing the binder identity in DevicePolicyManagerService, which makes the system server process the owner of that call. Bug: 158482162 Bug: 172466964 Test: atest com.android.cts.devicepolicy.{Device,Profile}OwnerTest#testBackupServiceEnabling Change-Id: I11d863229c4d62a058aaf37446a694b9c73ae5b8 Merged-In: I11d863229c4d62a058aaf37446a694b9c73ae5b8 (cherry picked from commit 630dec9eb496bc70db44c4f0b4196ea91e7df6cb)
Diffstat (limited to 'services/backup')
-rw-r--r--services/backup/java/com/android/server/backup/BackupManagerService.java2
1 files changed, 1 insertions, 1 deletions
diff --git a/services/backup/java/com/android/server/backup/BackupManagerService.java b/services/backup/java/com/android/server/backup/BackupManagerService.java
index 445297a839ba..89a6eca8fdaa 100644
--- a/services/backup/java/com/android/server/backup/BackupManagerService.java
+++ b/services/backup/java/com/android/server/backup/BackupManagerService.java
@@ -510,7 +510,7 @@ public class BackupManagerService extends IBackupManager.Stub {
int callingUid = Binder.getCallingUid();
if (CompatChanges.isChangeEnabled(
BackupManager.IS_BACKUP_SERVICE_ACTIVE_ENFORCE_PERMISSION_IN_SERVICE, callingUid)) {
- mContext.enforceCallingPermission(android.Manifest.permission.BACKUP,
+ mContext.enforceCallingOrSelfPermission(android.Manifest.permission.BACKUP,
"isBackupServiceActive");
}
synchronized (mStateLock) {