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

Commit 1ff3f115 authored by Rhed Jao's avatar Rhed Jao Committed by Android (Google) Code Review
Browse files

Merge "Adds user id support to the checkSignatures API"

parents f3979da4 9923f39c
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -960,7 +960,7 @@ public class ApplicationPackageManager extends PackageManager {
    @Override
    public int checkSignatures(String pkg1, String pkg2) {
        try {
            return mPM.checkSignatures(pkg1, pkg2);
            return mPM.checkSignatures(pkg1, pkg2, getUserId());
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
+1 −2
Original line number Diff line number Diff line
@@ -100,8 +100,7 @@ interface IPackageManager {

    boolean isProtectedBroadcast(String actionName);

    @UnsupportedAppUsage
    int checkSignatures(String pkg1, String pkg2);
    int checkSignatures(String pkg1, String pkg2, int userId);

    @UnsupportedAppUsage
    int checkUidSignatures(int uid1, int uid2);
+7 −2
Original line number Diff line number Diff line
@@ -49,6 +49,7 @@ import static android.content.pm.PackageManager.MATCH_DIRECT_BOOT_UNAWARE;
import static android.content.pm.PackageManager.MATCH_SYSTEM_ONLY;
import static android.content.pm.PackageManager.MATCH_UNINSTALLED_PACKAGES;
import static android.content.pm.PackageManager.PERMISSION_GRANTED;
import static android.content.pm.PackageManager.SIGNATURE_NO_MATCH;
import static android.net.ConnectivityManager.BLOCKED_REASON_NONE;
import static android.os.FactoryTest.FACTORY_TEST_OFF;
import static android.os.IServiceManager.DUMP_FLAG_PRIORITY_CRITICAL;
@@ -14510,8 +14511,12 @@ public class ActivityManagerService extends IActivityManager.Stub
                return false;
            }
            int match = mContext.getPackageManager().checkSignatures(
                    ii.targetPackage, ii.packageName);
            int match = SIGNATURE_NO_MATCH;
            try {
                match = AppGlobals.getPackageManager().checkSignatures(
                        ii.targetPackage, ii.packageName, userId);
            } catch (RemoteException e) {
            }
            if (match < 0 && match != PackageManager.SIGNATURE_FIRST_NOT_SIGNED) {
                if (Build.IS_DEBUGGABLE && (callingUid == Process.ROOT_UID)
                        && (flags & INSTR_FLAG_ALWAYS_CHECK_SIGNATURE) == 0) {
+1 −1
Original line number Diff line number Diff line
@@ -1255,7 +1255,7 @@ public final class OverlayManagerService extends SystemService {
            // to be installed for different users: ignore userId for now.
            try {
                return mPackageManager.checkSignatures(
                        packageName1, packageName2) == SIGNATURE_MATCH;
                        packageName1, packageName2, userId) == SIGNATURE_MATCH;
            } catch (RemoteException e) {
                // Intentionally left blank
            }
+1 −1
Original line number Diff line number Diff line
@@ -373,7 +373,7 @@ public interface Computer extends PackageDataSnapshot {
    PackageStateInternal getPackageStateFiltered(@NonNull String packageName, int callingUid,
            @UserIdInt int userId);

    int checkSignatures(@NonNull String pkg1, @NonNull String pkg2);
    int checkSignatures(@NonNull String pkg1, @NonNull String pkg2, int userId);

    int checkUidSignatures(int uid1, int uid2);

Loading