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

Commit 8e8cb1af authored by Rambo Wang's avatar Rambo Wang Committed by Automerger Merge Worker
Browse files

[DO NOT MERGE] Turn off carrier privileges grace period feature am: ad8a3324 am: 822f814e

parents 2f4fe4b5 822f814e
Loading
Loading
Loading
Loading
+4 −1
Original line number Original line 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_1 = "SHA-1";
    private static final String SHA_256 = "SHA-256";
    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.
     * Time delay to clear UICC rules after UICC is gone.
     * This introduces the grace period to retain carrier privileges when SIM is removed.
     * 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.
     * PackageManager flags used to query installed packages.
+7 −3
Original line number Original line Diff line number Diff line
@@ -73,6 +73,7 @@ import com.android.internal.telephony.uicc.IccUtils;


import org.junit.After;
import org.junit.After;
import org.junit.Before;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runner.RunWith;
import org.mockito.InOrder;
import org.mockito.InOrder;
@@ -549,7 +550,8 @@ public class CarrierPrivilegesTrackerTest extends TelephonyTest {
                List.of(new Pair<>(PRIVILEGED_PACKAGES, PRIVILEGED_UIDS_SET)));
                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 {
    public void testSimStateChangedSimStateNotReady() throws Exception {
        // Start with privileges, verify clearing certs clears UIDs
        // Start with privileges, verify clearing certs clears UIDs
        setupCarrierPrivilegesTrackerWithSimLoadedUids();
        setupCarrierPrivilegesTrackerWithSimLoadedUids();
@@ -573,7 +575,8 @@ public class CarrierPrivilegesTrackerTest extends TelephonyTest {
                        new Pair<>(Set.of(), Set.of())));
                        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 {
    public void testSimStateChangedSimStateAbsentThenLoadedWithSameRules() throws Exception {
        // Start with privileges
        // Start with privileges
        setupCarrierPrivilegesTrackerWithSimLoadedUids();
        setupCarrierPrivilegesTrackerWithSimLoadedUids();
@@ -642,7 +645,8 @@ public class CarrierPrivilegesTrackerTest extends TelephonyTest {
                List.of(new Pair<>(Set.of(), Set.of())));
                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 {
    public void testSimStateChangedSimStateAbsentThenLoadedWithUpdatedRules() throws Exception {
        // Start with privileges
        // Start with privileges
        setupCarrierPrivilegesTrackerWithSimLoadedUids();
        setupCarrierPrivilegesTrackerWithSimLoadedUids();