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

Commit 3c5b36af authored by Shubham Dubey's avatar Shubham Dubey
Browse files

Revert "Move carrier privilege status checks to CarrierPrivilege..."

Revert submission 16665236-carrier-privs-status-check

Reason for revert: Breaking tests
BUG:217412690
BUG:217412107

Reverted Changes:
I5470538bc:Move carrier privilege status checks to CarrierPri...
Iff4ba652f:Move carrier privilege status checks to CarrierPri...

Change-Id: I6c7f3a075ccb047930d266912c60e0f6c40075a8
parent 9c6e2ac2
Loading
Loading
Loading
Loading
+3 −58
Original line number Diff line number Diff line
@@ -29,7 +29,6 @@ import static android.telephony.TelephonyManager.SIM_STATE_UNKNOWN;

import android.annotation.NonNull;
import android.annotation.Nullable;
import android.app.ActivityManager;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
@@ -49,7 +48,6 @@ import android.os.Registrant;
import android.os.RegistrantList;
import android.os.UserHandle;
import android.os.UserManager;
import android.telephony.Annotation.CarrierPrivilegeStatus;
import android.telephony.CarrierConfigManager;
import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager;
@@ -65,7 +63,6 @@ import com.android.internal.annotations.GuardedBy;
import com.android.internal.telephony.uicc.IccUtils;
import com.android.internal.telephony.uicc.UiccPort;
import com.android.internal.telephony.uicc.UiccProfile;
import com.android.internal.util.ArrayUtils;
import com.android.telephony.Rlog;

import java.io.FileDescriptor;
@@ -517,13 +514,10 @@ public class CarrierPrivilegesTracker extends Handler {
    }

    private void refreshInstalledPackageCache() {
        // Include DISABLED_UNTIL_USED components. This facilitates cases where a carrier app
        // is disabled by default, and some other component wants to enable it when it has
        // gained carrier privileges (as an indication that a matching SIM has been inserted).
        int flags =
                PackageManager.GET_SIGNING_CERTIFICATES
                PackageManager.MATCH_DISABLED_COMPONENTS
                        | PackageManager.MATCH_DISABLED_UNTIL_USED_COMPONENTS
                        | PackageManager.MATCH_HIDDEN_UNTIL_INSTALLED_COMPONENTS;
                        | PackageManager.GET_SIGNING_CERTIFICATES;
        List<PackageInfo> installedPackages =
                mPackageManager.getInstalledPackagesAsUser(
                        flags, UserHandle.SYSTEM.getIdentifier());
@@ -587,11 +581,6 @@ public class CarrierPrivilegesTracker extends Handler {
        } finally {
            mPrivilegedPackageInfoLock.readLock().unlock();
        }

        // Update set of enabled carrier apps now that the privilege rules may have changed.
        ActivityManager am = mContext.getSystemService(ActivityManager.class);
        CarrierAppUtils.disableCarrierAppsUntilPrivileged(mContext.getOpPackageName(),
                mTelephonyManager, am.getCurrentUser(), mContext);
    }

    private PrivilegedPackageInfo getCurrentPrivilegedPackagesForAllUsers() {
@@ -741,51 +730,7 @@ public class CarrierPrivilegesTracker extends Handler {
            // best effort.
            refreshInstalledPackageCache();
        }
        maybeUpdatePrivilegedPackagesAndNotifyRegistrants();
    }

    /** Backing of {@link TelephonyManager#checkCarrierPrivilegesForPackage}. */
    public @CarrierPrivilegeStatus int getCarrierPrivilegeStatusForPackage(String packageName) {
        // TODO(b/205736323) consider if/how we want to account for the RULES_NOT_LOADED and
        // ERROR_LOADING_RULES constants. Technically those will never be returned today since those
        // results are only from the SIM rules, but the CC rules' result (which never has these
        // errors) always supersede them unless something goes super wrong when getting CC.
        mPrivilegedPackageInfoLock.readLock().lock();
        try {
            return mPrivilegedPackageInfo.mPackageNames.contains(packageName)
                    ? TelephonyManager.CARRIER_PRIVILEGE_STATUS_HAS_ACCESS
                    : TelephonyManager.CARRIER_PRIVILEGE_STATUS_NO_ACCESS;
        } finally {
            mPrivilegedPackageInfoLock.readLock().unlock();
        }
    }

    /** Backing of {@link TelephonyManager#getPackagesWithCarrierPrivileges}. */
    public Set<String> getPackagesWithCarrierPrivileges() {
        mPrivilegedPackageInfoLock.readLock().lock();
        try {
            return Collections.unmodifiableSet(mPrivilegedPackageInfo.mPackageNames);
        } finally {
            mPrivilegedPackageInfoLock.readLock().unlock();
        }
    }

    /**
     * Backing of {@link TelephonyManager#hasCarrierPrivileges} and {@link
     * TelephonyManager#getCarrierPrivilegeStatus(int)}.
     */
    public @CarrierPrivilegeStatus int getCarrierPrivilegeStatusForUid(int uid) {
        // TODO(b/205736323) consider if/how we want to account for the RULES_NOT_LOADED and
        // ERROR_LOADING_RULES constants. Technically those will never be returned today since those
        // results are only from the SIM rules, but the CC rules' result (which never has these
        // errors) always supersede them unless something goes super wrong when getting CC.
        mPrivilegedPackageInfoLock.readLock().lock();
        try {
            return ArrayUtils.contains(mPrivilegedPackageInfo.mUids, uid)
                    ? TelephonyManager.CARRIER_PRIVILEGE_STATUS_HAS_ACCESS
                    : TelephonyManager.CARRIER_PRIVILEGE_STATUS_NO_ACCESS;
        } finally {
            mPrivilegedPackageInfoLock.readLock().unlock();
        }
        maybeUpdatePrivilegedPackagesAndNotifyRegistrants();
    }
}
+6 −18
Original line number Diff line number Diff line
@@ -378,11 +378,8 @@ public class UiccPort {

    /**
     * Exposes {@link UiccCarrierPrivilegeRules#getCarrierPrivilegeStatus}.
     *
     * <p>TODO(b/205736323) remove this and downstream once fully moved to CarrierPrivilegesTracker
     *
     * @deprecated Please use {@link UiccProfile#getCarrierPrivilegeStatus(Signature, String)}
     *     instead.
     * @deprecated Please use
     * {@link UiccProfile#getCarrierPrivilegeStatus(Signature, String)} instead.
     */
    @Deprecated
    public int getCarrierPrivilegeStatus(Signature signature, String packageName) {
@@ -395,11 +392,8 @@ public class UiccPort {

    /**
     * Exposes {@link UiccCarrierPrivilegeRules#getCarrierPrivilegeStatus}.
     *
     * <p>TODO(b/205736323) remove this and downstream once fully moved to CarrierPrivilegesTracker
     *
     * @deprecated Please use {@link UiccProfile#getCarrierPrivilegeStatus(PackageManager, String)}
     *     instead.
     * @deprecated Please use
     * {@link UiccProfile#getCarrierPrivilegeStatus(PackageManager, String)} instead.
     */
    @Deprecated
    public int getCarrierPrivilegeStatus(PackageManager packageManager, String packageName) {
@@ -412,9 +406,6 @@ public class UiccPort {

    /**
     * Exposes {@link UiccCarrierPrivilegeRules#getCarrierPrivilegeStatus}.
     *
     * <p>TODO(b/205736323) remove this and downstream once fully moved to CarrierPrivilegesTracker
     *
     * @deprecated Please use {@link UiccProfile#getCarrierPrivilegeStatus(PackageInfo)} instead.
     */
    @Deprecated
@@ -428,11 +419,8 @@ public class UiccPort {

    /**
     * Exposes {@link UiccCarrierPrivilegeRules#getCarrierPrivilegeStatusForCurrentTransaction}.
     *
     * <p>TODO(b/205736323) remove this and downstream once fully moved to CarrierPrivilegesTracker
     *
     * @deprecated Please use {@link
     *     UiccProfile#getCarrierPrivilegeStatusForCurrentTransaction(PackageManager)} instead.
     * @deprecated Please use
     * {@link UiccProfile#getCarrierPrivilegeStatusForCurrentTransaction(PackageManager)} instead.
     */
    @Deprecated
    public int getCarrierPrivilegeStatusForCurrentTransaction(PackageManager packageManager) {
+0 −1
Original line number Diff line number Diff line
@@ -1334,7 +1334,6 @@ public class UiccProfile extends IccCard {
    }

    private void onCarrierPrivilegesLoadedMessage() {
        // TODO(b/211796398): clean up logic below once all carrier privilege check migration done
        // Update set of enabled carrier apps now that the privilege rules may have changed.
        ActivityManager am = mContext.getSystemService(ActivityManager.class);
        CarrierAppUtils.disableCarrierAppsUntilPrivileged(mContext.getOpPackageName(),
+3 −46
Original line number Diff line number Diff line
@@ -105,9 +105,9 @@ public class CarrierPrivilegesTrackerTest extends TelephonyTest {
    private static final int[] PRIVILEGED_UIDS = {UID_1, UID_2};

    private static final int PM_FLAGS =
            PackageManager.GET_SIGNING_CERTIFICATES
            PackageManager.MATCH_DISABLED_COMPONENTS
                    | PackageManager.MATCH_DISABLED_UNTIL_USED_COMPONENTS
                    | PackageManager.MATCH_HIDDEN_UNTIL_INSTALLED_COMPONENTS;
                    | PackageManager.GET_SIGNING_CERTIFICATES;

    @Mock private Signature mSignature;

@@ -257,21 +257,6 @@ public class CarrierPrivilegesTrackerTest extends TelephonyTest {
        }
    }

    private void verifyCurrentState(Set<String> expectedPackageNames, int[] expectedUids) {
        assertEquals(
                expectedPackageNames, mCarrierPrivilegesTracker.getPackagesWithCarrierPrivileges());
        for (String packageName : expectedPackageNames) {
            assertEquals(
                    TelephonyManager.CARRIER_PRIVILEGE_STATUS_HAS_ACCESS,
                    mCarrierPrivilegesTracker.getCarrierPrivilegeStatusForPackage(packageName));
        }
        for (int uid : expectedUids) {
            assertEquals(
                    TelephonyManager.CARRIER_PRIVILEGE_STATUS_HAS_ACCESS,
                    mCarrierPrivilegesTracker.getCarrierPrivilegeStatusForUid(uid));
        }
    }

    private void verifyRegistrantUpdates(@Nullable int[] expectedUids, int expectedUidUpdates) {
        assertArrayEquals(expectedUids, mHandler.privilegedUids);
        assertEquals(expectedUidUpdates, mHandler.numUidUpdates);
@@ -306,9 +291,8 @@ public class CarrierPrivilegesTrackerTest extends TelephonyTest {
                mHandler, REGISTRANT_WHAT, null);
        mTestableLooper.processAllMessages();

        // No updates triggered, but the registrant gets an empty update.
        verifyCurrentState(Set.of(), new int[0]);
        verifyRegistrantUpdates(new int[0] /* expectedUids */, 1 /* expectedUidUpdates */);
        // No updates triggered, so TelephonyRegistry doesn't get any updates.
        verifyCarrierPrivilegesChangedUpdates(List.of());
    }

@@ -323,7 +307,6 @@ public class CarrierPrivilegesTrackerTest extends TelephonyTest {
                mHandler, REGISTRANT_WHAT, null);
        mTestableLooper.processAllMessages();

        verifyCurrentState(PRIVILEGED_PACKAGES, PRIVILEGED_UIDS);
        verifyRegistrantUpdates(PRIVILEGED_UIDS /* expectedUids */, 1 /* expectedUidUpdates */);
        verifyCarrierPrivilegesChangedUpdates(
                List.of(new Pair<>(PRIVILEGED_PACKAGES, PRIVILEGED_UIDS)));
@@ -333,7 +316,6 @@ public class CarrierPrivilegesTrackerTest extends TelephonyTest {
        mCarrierPrivilegesTracker.unregisterCarrierPrivilegesListener(mHandler);
        mTestableLooper.processAllMessages();

        verifyCurrentState(PRIVILEGED_PACKAGES, PRIVILEGED_UIDS);
        verifyRegistrantUpdates(null /* expectedUids */, 0 /* expectedUidUpdates */);
        verifyCarrierPrivilegesChangedUpdates(List.of());

@@ -341,7 +323,6 @@ public class CarrierPrivilegesTrackerTest extends TelephonyTest {
        sendCarrierConfigChangedIntent(INVALID_SUBSCRIPTION_ID, PHONE_ID);
        mTestableLooper.processAllMessages();

        verifyCurrentState(Set.of(), new int[0]);
        verifyRegistrantUpdates(null /* expectedUids */, 0 /* expectedUidUpdates */);
        verifyCarrierPrivilegesChangedUpdates(List.of(new Pair<>(Set.of(), new int[0])));
    }
@@ -359,7 +340,6 @@ public class CarrierPrivilegesTrackerTest extends TelephonyTest {
        sendCarrierConfigChangedIntent(SUB_ID, PHONE_ID);
        mTestableLooper.processAllMessages();

        verifyCurrentState(PRIVILEGED_PACKAGES, PRIVILEGED_UIDS);
        verifyRegistrantUpdates(PRIVILEGED_UIDS, 1 /* expectedUidUpdates */);
        verifyCarrierPrivilegesChangedUpdates(
                List.of(new Pair<>(PRIVILEGED_PACKAGES, PRIVILEGED_UIDS)));
@@ -373,7 +353,6 @@ public class CarrierPrivilegesTrackerTest extends TelephonyTest {
        sendCarrierConfigChangedIntent(SUB_ID, PHONE_ID_INCORRECT);
        mTestableLooper.processAllMessages();

        verifyCurrentState(PRIVILEGED_PACKAGES, PRIVILEGED_UIDS);
        verifyRegistrantUpdates(null /* expectedUids */, 0 /* expectedUidUpdates */);
        verifyCarrierPrivilegesChangedUpdates(
                List.of(new Pair<>(PRIVILEGED_PACKAGES, PRIVILEGED_UIDS)));
@@ -387,7 +366,6 @@ public class CarrierPrivilegesTrackerTest extends TelephonyTest {
        sendCarrierConfigChangedIntent(INVALID_SUBSCRIPTION_ID, PHONE_ID);
        mTestableLooper.processAllMessages();

        verifyCurrentState(Set.of(), new int[0]);
        verifyRegistrantUpdates(new int[0] /* expectedUids */, 1 /* expectedUidUpdates */);
        verifyCarrierPrivilegesChangedUpdates(
                List.of(
@@ -406,7 +384,6 @@ public class CarrierPrivilegesTrackerTest extends TelephonyTest {
        sendCarrierConfigChangedIntent(SUB_ID, PHONE_ID);
        mTestableLooper.processAllMessages();

        verifyCurrentState(Set.of(), new int[0]);
        verifyRegistrantUpdates(new int[0] /* expectedUids */, 1 /* expectedUidUpdates */);
        verifyCarrierPrivilegesChangedUpdates(List.of(new Pair<>(Set.of(), new int[0])));
    }
@@ -426,7 +403,6 @@ public class CarrierPrivilegesTrackerTest extends TelephonyTest {
        sendCarrierConfigChangedIntent(SUB_ID, PHONE_ID);
        mTestableLooper.processAllMessages();

        verifyCurrentState(Set.of(PACKAGE_1), new int[] {UID_1});
        verifyRegistrantUpdates(new int[] {UID_1}, 1 /* expectedUidUpdates */);
        verifyCarrierPrivilegesChangedUpdates(
                List.of(new Pair<>(Set.of(PACKAGE_1), new int[] {UID_1})));
@@ -439,7 +415,6 @@ public class CarrierPrivilegesTrackerTest extends TelephonyTest {
        sendCarrierConfigChangedIntent(SUB_ID, PHONE_ID);
        mTestableLooper.processAllMessages();

        verifyCurrentState(PRIVILEGED_PACKAGES, PRIVILEGED_UIDS);
        verifyRegistrantUpdates(PRIVILEGED_UIDS, 2 /* expectedUidUpdates */);
        verifyCarrierPrivilegesChangedUpdates(
                List.of(new Pair<>(PRIVILEGED_PACKAGES, PRIVILEGED_UIDS)));
@@ -458,7 +433,6 @@ public class CarrierPrivilegesTrackerTest extends TelephonyTest {
        sendSimCardStateChangedIntent(PHONE_ID, SIM_STATE_LOADED);
        mTestableLooper.processAllMessages();

        verifyCurrentState(PRIVILEGED_PACKAGES, PRIVILEGED_UIDS);
        verifyRegistrantUpdates(PRIVILEGED_UIDS, 1 /* expectedUidUpdates */);
        verifyCarrierPrivilegesChangedUpdates(
                List.of(new Pair<>(PRIVILEGED_PACKAGES, PRIVILEGED_UIDS)));
@@ -477,7 +451,6 @@ public class CarrierPrivilegesTrackerTest extends TelephonyTest {
        sendSimApplicationStateChangedIntent(PHONE_ID, SIM_STATE_LOADED);
        mTestableLooper.processAllMessages();

        verifyCurrentState(PRIVILEGED_PACKAGES, PRIVILEGED_UIDS);
        verifyRegistrantUpdates(PRIVILEGED_UIDS, 1 /* expectedUidUpdates */);
        verifyCarrierPrivilegesChangedUpdates(
                List.of(new Pair<>(PRIVILEGED_PACKAGES, PRIVILEGED_UIDS)));
@@ -493,7 +466,6 @@ public class CarrierPrivilegesTrackerTest extends TelephonyTest {
        sendSimCardStateChangedIntent(PHONE_ID, SIM_STATE_LOADED);
        mTestableLooper.processAllMessages();

        verifyCurrentState(Set.of(), new int[0]);
        verifyRegistrantUpdates(new int[0], 1 /* expectedUidUpdates */);
        verifyCarrierPrivilegesChangedUpdates(
                List.of(
@@ -511,7 +483,6 @@ public class CarrierPrivilegesTrackerTest extends TelephonyTest {
        sendSimCardStateChangedIntent(PHONE_ID_INCORRECT, SIM_STATE_LOADED);
        mTestableLooper.processAllMessages();

        verifyCurrentState(PRIVILEGED_PACKAGES, PRIVILEGED_UIDS);
        verifyRegistrantUpdates(null /* expectedUids */, 0 /* expectedUidUpdates */);
        verifyCarrierPrivilegesChangedUpdates(
                List.of(new Pair<>(PRIVILEGED_PACKAGES, PRIVILEGED_UIDS)));
@@ -525,7 +496,6 @@ public class CarrierPrivilegesTrackerTest extends TelephonyTest {
        sendSimCardStateChangedIntent(PHONE_ID, SIM_STATE_NOT_READY);
        mTestableLooper.processAllMessages();

        verifyCurrentState(Set.of(), new int[0]);
        verifyRegistrantUpdates(new int[0], 1 /* expectedUidUpdates */);
        verifyCarrierPrivilegesChangedUpdates(
                List.of(
@@ -548,7 +518,6 @@ public class CarrierPrivilegesTrackerTest extends TelephonyTest {
        sendSimCardStateChangedIntent(PHONE_ID, SIM_STATE_LOADED);
        mTestableLooper.processAllMessages();

        verifyCurrentState(Set.of(PACKAGE_1), new int[] {UID_1});
        verifyRegistrantUpdates(new int[] {UID_1}, 1 /* expectedUidUpdates */);
        verifyCarrierPrivilegesChangedUpdates(
                List.of(new Pair<>(Set.of(PACKAGE_1), new int[] {UID_1})));
@@ -562,7 +531,6 @@ public class CarrierPrivilegesTrackerTest extends TelephonyTest {
        sendSimCardStateChangedIntent(PHONE_ID, SIM_STATE_LOADED);
        mTestableLooper.processAllMessages();

        verifyCurrentState(PRIVILEGED_PACKAGES, PRIVILEGED_UIDS);
        verifyRegistrantUpdates(PRIVILEGED_UIDS, 2 /* expectedUidUpdates */);
        verifyCarrierPrivilegesChangedUpdates(
                List.of(new Pair<>(PRIVILEGED_PACKAGES, PRIVILEGED_UIDS)));
@@ -579,7 +547,6 @@ public class CarrierPrivilegesTrackerTest extends TelephonyTest {
        sendPackageChangedIntent(Intent.ACTION_PACKAGE_ADDED, PACKAGE_1);
        mTestableLooper.processAllMessages();

        verifyCurrentState(Set.of(PACKAGE_1), new int[] {UID_1});
        verifyRegistrantUpdates(new int[] {UID_1}, 1 /* expectedUidUpdates */);
        verifyCarrierPrivilegesChangedUpdates(
                List.of(new Pair<>(Set.of(PACKAGE_1), new int[] {UID_1})));
@@ -599,7 +566,6 @@ public class CarrierPrivilegesTrackerTest extends TelephonyTest {
        sendPackageChangedIntent(Intent.ACTION_PACKAGE_ADDED, PACKAGE_1);
        mTestableLooper.processAllMessages();

        verifyCurrentState(Set.of(PACKAGE_1), PRIVILEGED_UIDS);
        verifyRegistrantUpdates(PRIVILEGED_UIDS, 1 /* expectedUidUpdates */);
        verifyCarrierPrivilegesChangedUpdates(
                List.of(new Pair<>(Set.of(PACKAGE_1), PRIVILEGED_UIDS)));
@@ -620,7 +586,6 @@ public class CarrierPrivilegesTrackerTest extends TelephonyTest {
        sendPackageChangedIntent(Intent.ACTION_PACKAGE_REPLACED, PACKAGE_1);
        mTestableLooper.processAllMessages();

        verifyCurrentState(Set.of(PACKAGE_1), PRIVILEGED_UIDS);
        verifyRegistrantUpdates(PRIVILEGED_UIDS, 1 /* expectedUidUpdates */);
        verifyCarrierPrivilegesChangedUpdates(
                List.of(new Pair<>(Set.of(PACKAGE_1), PRIVILEGED_UIDS)));
@@ -645,7 +610,6 @@ public class CarrierPrivilegesTrackerTest extends TelephonyTest {
        sendPackageChangedIntent(Intent.ACTION_PACKAGE_ADDED, PACKAGE_1);
        mTestableLooper.processAllMessages();

        verifyCurrentState(Set.of(PACKAGE_2), new int[] {UID_2});
        verifyRegistrantUpdates(new int[] {UID_2}, 1 /* expectedUidUpdates */);
        verifyCarrierPrivilegesChangedUpdates(
                List.of(new Pair<>(Set.of(PACKAGE_2), new int[] {UID_2})));
@@ -669,7 +633,6 @@ public class CarrierPrivilegesTrackerTest extends TelephonyTest {
        sendPackageChangedIntent(Intent.ACTION_PACKAGE_ADDED, PACKAGE_1);
        mTestableLooper.processAllMessages();

        verifyCurrentState(Set.of(PACKAGE_2), new int[] {UID_2});
        verifyRegistrantUpdates(new int[] {UID_2}, 1 /* expectedUidUpdates */);
        verifyCarrierPrivilegesChangedUpdates(
                List.of(new Pair<>(Set.of(PACKAGE_2), new int[] {UID_2})));
@@ -688,7 +651,6 @@ public class CarrierPrivilegesTrackerTest extends TelephonyTest {
        sendPackageChangedIntent(Intent.ACTION_PACKAGE_REMOVED, PACKAGE_1);
        mTestableLooper.processAllMessages();

        verifyCurrentState(Set.of(PACKAGE_2), new int[] {UID_2});
        verifyRegistrantUpdates(new int[] {UID_2}, 1 /* expectedUidUpdates */);
        verifyCarrierPrivilegesChangedUpdates(
                List.of(new Pair<>(Set.of(PACKAGE_2), new int[] {UID_2})));
@@ -703,7 +665,6 @@ public class CarrierPrivilegesTrackerTest extends TelephonyTest {
        sendPackageChangedIntent(Intent.ACTION_PACKAGE_REMOVED, PACKAGE_1);
        mTestableLooper.processAllMessages();

        verifyCurrentState(Set.of(), new int[0]);
        verifyRegistrantUpdates(null /* expectedUidUpdates */, 0 /* expectedUidUpdates */);
        verifyCarrierPrivilegesChangedUpdates(List.of());
    }
@@ -718,7 +679,6 @@ public class CarrierPrivilegesTrackerTest extends TelephonyTest {
        mTestableLooper.processAllMessages();

        // Expect no package will have privilege at last
        verifyCurrentState(Set.of(), new int[0]);
        verifyRegistrantUpdates(new int[0], 1 /* expectedUidUpdates */);
        verifyCarrierPrivilegesChangedUpdates(
                List.of(
@@ -730,7 +690,6 @@ public class CarrierPrivilegesTrackerTest extends TelephonyTest {
        mTestableLooper.processAllMessages();

        // Expect all privileges from Carrier Config come back
        verifyCurrentState(PRIVILEGED_PACKAGES, PRIVILEGED_UIDS);
        verifyRegistrantUpdates(PRIVILEGED_UIDS, 2 /* expectedUidUpdates */);
        verifyCarrierPrivilegesChangedUpdates(
                List.of(new Pair<>(PRIVILEGED_PACKAGES, PRIVILEGED_UIDS)));
@@ -746,7 +705,6 @@ public class CarrierPrivilegesTrackerTest extends TelephonyTest {
        mTestableLooper.processAllMessages();

        // Expect only PACKAGE_3 will have privilege at last
        verifyCurrentState(Set.of(PACKAGE_3), new int[]{UID_3});
        verifyRegistrantUpdates(new int[]{UID_3}, 1 /* expectedUidUpdates */);
        verifyCarrierPrivilegesChangedUpdates(
                List.of(
@@ -759,7 +717,6 @@ public class CarrierPrivilegesTrackerTest extends TelephonyTest {
        mTestableLooper.processAllMessages();

        // Expect all privileges from UICC come back
        verifyCurrentState(PRIVILEGED_PACKAGES, PRIVILEGED_UIDS);
        verifyRegistrantUpdates(PRIVILEGED_UIDS, 2 /* expectedUidUpdates */);
        verifyCarrierPrivilegesChangedUpdates(
                List.of(new Pair<>(PRIVILEGED_PACKAGES, PRIVILEGED_UIDS)));