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

Commit ad8a3324 authored by Rambo Wang's avatar Rambo Wang
Browse files

[DO NOT MERGE] Turn off carrier privileges grace period feature

Carrier privileges grace period feature was introduced in T
to benefit the switching between the same carrier.

On the cases when switching to different carriers, the feature
introduce a small time window to allow the previous carrier
app to have carrier privileges on upcoming carrier. This has
security concern.

In bug 229418673, Tycho can set a non-Fi pSIM subscription
as the Fi's secondary sub in a sub group, causing confusing
behavior for the end user.

The feature is turn off by default. When a solution that can
fix the security concern has been found, it will be turn on.

Bug: 229418673
Test: atest CarrierPrivilegesTrackerTest
Test: QA test on SS -> DS switching
Test: Telephony sanity(activation, calling, sms, data, switching...)
Change-Id: Ib98a6a97cc590a866a50029237da80634cec2ce3
parent 06798370
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -106,11 +106,14 @@ public class CarrierPrivilegesTracker extends Handler {
    private static final String SHA_1 = "SHA-1";
    private static final String SHA_256 = "SHA-256";

    // TODO(b/232273884): Turn feature on when find solution to handle the inter-carriers switching
    /**
     * Time delay to clear UICC rules after UICC is gone.
     * This introduces the grace period to retain carrier privileges when SIM is removed.
     *
     * This feature is off by default due to the security concern during inter-carriers switching.
     */
    private static final long CLEAR_UICC_RULES_DELAY_MILLIS = TimeUnit.SECONDS.toMillis(30);
    private static final long CLEAR_UICC_RULES_DELAY_MILLIS = TimeUnit.SECONDS.toMillis(0);

    /**
     * PackageManager flags used to query installed packages.
+7 −3
Original line number Diff line number Diff line
@@ -73,6 +73,7 @@ import com.android.internal.telephony.uicc.IccUtils;

import org.junit.After;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InOrder;
@@ -549,7 +550,8 @@ public class CarrierPrivilegesTrackerTest extends TelephonyTest {
                List.of(new Pair<>(PRIVILEGED_PACKAGES, PRIVILEGED_UIDS_SET)));
    }

    @Test
    // TODO(b/232273884): turn UT case on when grace period is on
    @Ignore
    public void testSimStateChangedSimStateNotReady() throws Exception {
        // Start with privileges, verify clearing certs clears UIDs
        setupCarrierPrivilegesTrackerWithSimLoadedUids();
@@ -573,7 +575,8 @@ public class CarrierPrivilegesTrackerTest extends TelephonyTest {
                        new Pair<>(Set.of(), Set.of())));
    }

    @Test
    // TODO(b/232273884): turn UT case on when grace period is on
    @Ignore
    public void testSimStateChangedSimStateAbsentThenLoadedWithSameRules() throws Exception {
        // Start with privileges
        setupCarrierPrivilegesTrackerWithSimLoadedUids();
@@ -642,7 +645,8 @@ public class CarrierPrivilegesTrackerTest extends TelephonyTest {
                List.of(new Pair<>(Set.of(), Set.of())));
    }

    @Test
    // TODO(b/232273884): turn UT case on when grace period is on
    @Ignore
    public void testSimStateChangedSimStateAbsentThenLoadedWithUpdatedRules() throws Exception {
        // Start with privileges
        setupCarrierPrivilegesTrackerWithSimLoadedUids();