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
This commit is contained in:
Jeff Sharkey
2014-09-30 13:55:39 -07:00
parent 51a400eb44
commit c0322ecda5

View File

@@ -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);
}
}