am b78a0a11: Merge "Ensure ApplicationInfo is for correct user for system/android package." into lmp-dev

* commit 'b78a0a111f7a52954eea6bdba5ade08870cee035':
  Ensure ApplicationInfo is for correct user for system/android package.
This commit is contained in:
Kenny Guy
2014-09-08 13:34:52 +00:00
committed by Android Git Automerger

View File

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