From c0322ecda54d9c2db12e861f4d36ef50595b9740 Mon Sep 17 00:00:00 2001 From: Jeff Sharkey Date: Tue, 30 Sep 2014 13:55:39 -0700 Subject: [PATCH] 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 --- .../java/com/android/server/am/ActivityManagerService.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java index 12c98c17166c7..c7eb54665c3b7 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); } }