Loading core/java/android/content/ContentProvider.java +5 −4 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package android.content; import static android.Manifest.permission.INTERACT_ACROSS_USERS; import static android.Manifest.permission.INTERACT_ACROSS_USERS_FULL; import static android.os.Process.myUserHandle; import static android.os.Trace.TRACE_TAG_DATABASE; import android.annotation.NonNull; Loading Loading @@ -738,7 +739,7 @@ public abstract class ContentProvider implements ContentInterface, ComponentCall } boolean checkUser(int pid, int uid, Context context) { int callingUserId = UserHandle.getUserId(uid); final int callingUserId = UserHandle.getUserId(uid); if (callingUserId == context.getUserId() || mSingleUser) { return true; Loading @@ -765,8 +766,8 @@ public abstract class ContentProvider implements ContentInterface, ComponentCall if (um != null && um.isCloneProfile()) { UserHandle parent = um.getProfileParent(callingUser); if (parent != null && parent.equals(context.getUser())) { mUsersRedirectedToOwner.put(callingUser.getIdentifier(), true); if (parent != null && parent.equals(myUserHandle())) { mUsersRedirectedToOwner.put(callingUserId, true); return true; } } Loading @@ -774,7 +775,7 @@ public abstract class ContentProvider implements ContentInterface, ComponentCall // ignore } mUsersRedirectedToOwner.put(UserHandle.getUserId(uid), false); mUsersRedirectedToOwner.put(callingUserId, false); return false; } Loading services/core/java/com/android/server/am/ContentProviderHelper.java +10 −21 Original line number Diff line number Diff line Loading @@ -1046,6 +1046,16 @@ public class ContentProviderHelper { userId = UserHandle.getCallingUserId(); } if (isAuthorityRedirectedForCloneProfile(authority)) { UserManagerInternal umInternal = LocalServices.getService(UserManagerInternal.class); UserInfo userInfo = umInternal.getUserInfo(userId); if (userInfo != null && userInfo.isCloneProfile()) { userId = umInternal.getProfileParentId(userId); checkUser = false; } } ProviderInfo cpi = null; try { cpi = AppGlobals.getPackageManager().resolveContentProvider(authority, Loading @@ -1055,17 +1065,6 @@ public class ContentProviderHelper { | PackageManager.MATCH_DIRECT_BOOT_AWARE | PackageManager.MATCH_DIRECT_BOOT_UNAWARE, userId); if (cpi == null && isAuthorityRedirectedForCloneProfile(authority)) { // This might be a provider that's running only in the system user that's // also serving clone profiles cpi = AppGlobals.getPackageManager().resolveContentProvider(authority, ActivityManagerService.STOCK_PM_FLAGS | PackageManager.GET_URI_PERMISSION_PATTERNS | PackageManager.MATCH_DISABLED_COMPONENTS | PackageManager.MATCH_DIRECT_BOOT_AWARE | PackageManager.MATCH_DIRECT_BOOT_UNAWARE, UserHandle.USER_SYSTEM); } } catch (RemoteException ignored) { } if (cpi == null) { Loading @@ -1073,16 +1072,6 @@ public class ContentProviderHelper { + "; expected to find a valid ContentProvider for this authority"; } if (isAuthorityRedirectedForCloneProfile(authority)) { UserManagerInternal umInternal = LocalServices.getService(UserManagerInternal.class); UserInfo userInfo = umInternal.getUserInfo(userId); if (userInfo != null && userInfo.isCloneProfile()) { userId = umInternal.getProfileParentId(userId); checkUser = false; } } final int callingPid = Binder.getCallingPid(); ProcessRecord r; final String appName; Loading Loading
core/java/android/content/ContentProvider.java +5 −4 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package android.content; import static android.Manifest.permission.INTERACT_ACROSS_USERS; import static android.Manifest.permission.INTERACT_ACROSS_USERS_FULL; import static android.os.Process.myUserHandle; import static android.os.Trace.TRACE_TAG_DATABASE; import android.annotation.NonNull; Loading Loading @@ -738,7 +739,7 @@ public abstract class ContentProvider implements ContentInterface, ComponentCall } boolean checkUser(int pid, int uid, Context context) { int callingUserId = UserHandle.getUserId(uid); final int callingUserId = UserHandle.getUserId(uid); if (callingUserId == context.getUserId() || mSingleUser) { return true; Loading @@ -765,8 +766,8 @@ public abstract class ContentProvider implements ContentInterface, ComponentCall if (um != null && um.isCloneProfile()) { UserHandle parent = um.getProfileParent(callingUser); if (parent != null && parent.equals(context.getUser())) { mUsersRedirectedToOwner.put(callingUser.getIdentifier(), true); if (parent != null && parent.equals(myUserHandle())) { mUsersRedirectedToOwner.put(callingUserId, true); return true; } } Loading @@ -774,7 +775,7 @@ public abstract class ContentProvider implements ContentInterface, ComponentCall // ignore } mUsersRedirectedToOwner.put(UserHandle.getUserId(uid), false); mUsersRedirectedToOwner.put(callingUserId, false); return false; } Loading
services/core/java/com/android/server/am/ContentProviderHelper.java +10 −21 Original line number Diff line number Diff line Loading @@ -1046,6 +1046,16 @@ public class ContentProviderHelper { userId = UserHandle.getCallingUserId(); } if (isAuthorityRedirectedForCloneProfile(authority)) { UserManagerInternal umInternal = LocalServices.getService(UserManagerInternal.class); UserInfo userInfo = umInternal.getUserInfo(userId); if (userInfo != null && userInfo.isCloneProfile()) { userId = umInternal.getProfileParentId(userId); checkUser = false; } } ProviderInfo cpi = null; try { cpi = AppGlobals.getPackageManager().resolveContentProvider(authority, Loading @@ -1055,17 +1065,6 @@ public class ContentProviderHelper { | PackageManager.MATCH_DIRECT_BOOT_AWARE | PackageManager.MATCH_DIRECT_BOOT_UNAWARE, userId); if (cpi == null && isAuthorityRedirectedForCloneProfile(authority)) { // This might be a provider that's running only in the system user that's // also serving clone profiles cpi = AppGlobals.getPackageManager().resolveContentProvider(authority, ActivityManagerService.STOCK_PM_FLAGS | PackageManager.GET_URI_PERMISSION_PATTERNS | PackageManager.MATCH_DISABLED_COMPONENTS | PackageManager.MATCH_DIRECT_BOOT_AWARE | PackageManager.MATCH_DIRECT_BOOT_UNAWARE, UserHandle.USER_SYSTEM); } } catch (RemoteException ignored) { } if (cpi == null) { Loading @@ -1073,16 +1072,6 @@ public class ContentProviderHelper { + "; expected to find a valid ContentProvider for this authority"; } if (isAuthorityRedirectedForCloneProfile(authority)) { UserManagerInternal umInternal = LocalServices.getService(UserManagerInternal.class); UserInfo userInfo = umInternal.getUserInfo(userId); if (userInfo != null && userInfo.isCloneProfile()) { userId = umInternal.getProfileParentId(userId); checkUser = false; } } final int callingPid = Binder.getCallingPid(); ProcessRecord r; final String appName; Loading