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

Commit 2ab51249 authored by Songchun Fan's avatar Songchun Fan Committed by Android Build Coastguard Worker
Browse files

Revert "[ADI][20/N] protect the verifier app"

FLAG: EXEMPT just revert
BUG: 422535876
Test: n/a just revert

This reverts commit 0624394b.
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:369e04cb63e049aa851312af142ed4b396f902bc)
Merged-In: Icd2bbb2281eac89c64da9a5b6131bb684e37372c
Change-Id: Icd2bbb2281eac89c64da9a5b6131bb684e37372c
parent a0b63e2b
Loading
Loading
Loading
Loading
+0 −2
Original line number Original line Diff line number Diff line
@@ -2491,8 +2491,6 @@ public class PackageManagerService implements PackageSender, TestUtilityService
            mVerificationServiceProviderPackage =
            mVerificationServiceProviderPackage =
                    getVerificationServiceProviderPackage(computer, mContext.getString(
                    getVerificationServiceProviderPackage(computer, mContext.getString(
                            R.string.config_verificationServiceProviderPackageName));
                            R.string.config_verificationServiceProviderPackageName));
            mProtectedPackages.setVerificationServiceProviderPackage(
                    mVerificationServiceProviderPackage);


            // Initialize InstantAppRegistry's Instant App list for all users.
            // Initialize InstantAppRegistry's Instant App list for all users.
            forEachPackageState(computer, packageState -> {
            forEachPackageState(computer, packageState -> {
+5 −24
Original line number Original line Diff line number Diff line
@@ -64,10 +64,6 @@ public class ProtectedPackages {
    @GuardedBy("this")
    @GuardedBy("this")
    private final String mDeviceProvisioningPackage;
    private final String mDeviceProvisioningPackage;


    @Nullable
    @GuardedBy("this")
    private String mVerificationServiceProviderPackage;

    @Nullable
    @Nullable
    @GuardedBy("this")
    @GuardedBy("this")
    private final SparseArray<Set<String>> mOwnerProtectedPackages = new SparseArray<>();
    private final SparseArray<Set<String>> mOwnerProtectedPackages = new SparseArray<>();
@@ -101,12 +97,6 @@ public class ProtectedPackages {
        }
        }
    }
    }


    /** Sets verification service provider package which should be protected. */
    public synchronized void setVerificationServiceProviderPackage(
            @Nullable String verificationServiceProviderPackage) {
        mVerificationServiceProviderPackage = verificationServiceProviderPackage;
    }

    private synchronized boolean hasDeviceOwnerOrProfileOwner(int userId, String packageName) {
    private synchronized boolean hasDeviceOwnerOrProfileOwner(int userId, String packageName) {
        if (packageName == null) {
        if (packageName == null) {
            return false;
            return false;
@@ -142,20 +132,11 @@ public class ProtectedPackages {
     * can modify its data or package state.
     * can modify its data or package state.
     */
     */
    private synchronized boolean isProtectedPackage(@UserIdInt int userId, String packageName) {
    private synchronized boolean isProtectedPackage(@UserIdInt int userId, String packageName) {
        if (packageName == null) {
        return packageName != null
            return false;
                && (packageName.equals(mDeviceProvisioningPackage)
        }
                        || isOwnerProtectedPackage(userId, packageName)
        if (packageName.equals(mDeviceProvisioningPackage)
                        || (Flags.protectSupervisionPackages()
                || isOwnerProtectedPackage(userId, packageName)) {
                                && isSupervisionPackage(userId, packageName)));
            return true;
        }
        if (Flags.protectSupervisionPackages() && isSupervisionPackage(userId, packageName)) {
            return true;
        }
        if (packageName.equals(mVerificationServiceProviderPackage)) {
            return true;
        }
        return false;
    }
    }


    /**
    /**