summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Annie Meng <anniemeng@google.com> 2019-01-31 11:13:14 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2019-01-31 11:13:14 +0000
commitdb19aa43d0efd2cda1e62a10fb42feb6df148bab (patch)
tree42a9ad6777217bcfa50584e7b8108d28555a2eea
parent39e2a4394e845f7d3594b5ad8928d168c31a7ca8 (diff)
parent312e7803462bb89d244f6d71ad38ab2c3a71ddf1 (diff)
Merge "[Multi-user] Clear calling identity for backup activation"
-rw-r--r--services/backup/java/com/android/server/backup/Trampoline.java9
1 files changed, 8 insertions, 1 deletions
diff --git a/services/backup/java/com/android/server/backup/Trampoline.java b/services/backup/java/com/android/server/backup/Trampoline.java
index 303734a4043c..87872e8bcbc2 100644
--- a/services/backup/java/com/android/server/backup/Trampoline.java
+++ b/services/backup/java/com/android/server/backup/Trampoline.java
@@ -332,7 +332,14 @@ public class Trampoline extends IBackupManager.Stub {
// If the user is unlocked, we can start the backup service for it. Otherwise we
// will start the service when the user is unlocked as part of its unlock callback.
if (getUserManager().isUserUnlocked(userId)) {
- startServiceForUser(userId);
+ // Clear calling identity as initialization enforces the system identity but we
+ // can be coming from shell.
+ long oldId = Binder.clearCallingIdentity();
+ try {
+ startServiceForUser(userId);
+ } finally {
+ Binder.restoreCallingIdentity(oldId);
+ }
}
} else {
try {