Ensure ApplicationInfo is for correct user for system/android package.
createPackageContextAsUser shortcuts creating the context for system and android packages, however it should still make sure the ApplicationInfo for the package is for the correct user. Bug: 17002733 Change-Id: Ie10008449f13a4464a9797937c4413d6aa119fbe
This commit is contained in:
@@ -2121,7 +2121,9 @@ class ContextImpl extends Context {
|
||||
public Context createPackageContextAsUser(String packageName, int flags, UserHandle user)
|
||||
throws NameNotFoundException {
|
||||
final boolean restricted = (flags & CONTEXT_RESTRICTED) == CONTEXT_RESTRICTED;
|
||||
if (packageName.equals("system") || packageName.equals("android")) {
|
||||
if ((packageName.equals("system") || packageName.equals("android"))
|
||||
&& user.getIdentifier() == UserHandle.getUserId(
|
||||
mPackageInfo.getApplicationInfo().uid)) {
|
||||
return new ContextImpl(this, mMainThread, mPackageInfo, mActivityToken,
|
||||
user, restricted, mDisplay, mOverrideConfiguration);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user