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

Commit 76745199 authored by Etienne Ruffieux's avatar Etienne Ruffieux Committed by Automerger Merge Worker
Browse files

Merge "Use UserHandle created context to check package name." into tm-qpr-dev am: 676d5233

parents 8498e526 676d5233
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -373,9 +373,12 @@ public final class Utils {
     */
    public static boolean isPackageNameAccurate(Context context, String callingPackage,
            int callingUid) {
        UserHandle callingUser = UserHandle.getUserHandleForUid(callingUid);

        // Verifies the integrity of the calling package name
        try {
            int packageUid = context.getPackageManager().getPackageUid(callingPackage, 0);
            int packageUid = context.createContextAsUser(callingUser, 0)
                    .getPackageManager().getPackageUid(callingPackage, 0);
            if (packageUid != callingUid) {
                Log.e(TAG, "isPackageNameAccurate: App with package name " + callingPackage
                        + " is UID " + packageUid + " but caller is " + callingUid);