Skip to content

Commit c0322ec

Browse files
committed
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
1 parent 51a400e commit c0322ec

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

services/core/java/com/android/server/am/ActivityManagerService.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9349,6 +9349,7 @@ && isValidSingletonCall(r.uid, cpi.applicationInfo.uid)) {
93499349
checkTime(startTime, "getContentProviderImpl: after getProviderByClass");
93509350
final boolean firstClass = cpr == null;
93519351
if (firstClass) {
9352+
final long ident = Binder.clearCallingIdentity();
93529353
try {
93539354
checkTime(startTime, "getContentProviderImpl: before getApplicationInfo");
93549355
ApplicationInfo ai =
@@ -9366,6 +9367,8 @@ && isValidSingletonCall(r.uid, cpi.applicationInfo.uid)) {
93669367
cpr = new ContentProviderRecord(this, cpi, ai, comp, singleton);
93679368
} catch (RemoteException ex) {
93689369
// pm is in same process, this will never happen.
9370+
} finally {
9371+
Binder.restoreCallingIdentity(ident);
93699372
}
93709373
}
93719374

0 commit comments

Comments
 (0)