summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Jeff Sharkey <jsharkey@android.com> 2014-09-30 13:55:39 -0700
committer Jeff Sharkey <jsharkey@android.com> 2014-09-30 14:01:32 -0700
commitc0322ecda54d9c2db12e861f4d36ef50595b9740 (patch)
tree7b2a37fd9dbef25ea9210d2ed96314ca1ba3267b
parent51a400eb440c89fb06a47371bb7b026f00edb09c (diff)
Clear ident when obtaining provider across users.
When calling getContentProvider() across user boundaries, and creating the provider for the first time, we need to clear caller identity. (We could have torn down the provider while the system was under memory pressure.) Bug: 17409650 Change-Id: I67713a03e5f7106f5e8fcf33fe3fdae81ce644ec
-rwxr-xr-xservices/core/java/com/android/server/am/ActivityManagerService.java3
1 files changed, 3 insertions, 0 deletions
diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java
index 12c98c17166c..c7eb54665c3b 100755
--- a/services/core/java/com/android/server/am/ActivityManagerService.java
+++ b/services/core/java/com/android/server/am/ActivityManagerService.java
@@ -9349,6 +9349,7 @@ public final class ActivityManagerService extends ActivityManagerNative
checkTime(startTime, "getContentProviderImpl: after getProviderByClass");
final boolean firstClass = cpr == null;
if (firstClass) {
+ final long ident = Binder.clearCallingIdentity();
try {
checkTime(startTime, "getContentProviderImpl: before getApplicationInfo");
ApplicationInfo ai =
@@ -9366,6 +9367,8 @@ public final class ActivityManagerService extends ActivityManagerNative
cpr = new ContentProviderRecord(this, cpi, ai, comp, singleton);
} catch (RemoteException ex) {
// pm is in same process, this will never happen.
+ } finally {
+ Binder.restoreCallingIdentity(ident);
}
}