Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6df8d523 authored by Kenny Guy's avatar Kenny Guy
Browse files

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
parent fdd04d42
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -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);
        }