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

Commit 2b5f925e authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Corretly handle SIM not ready state" into udc-dev

parents 65debc1e b8c1607b
Loading
Loading
Loading
Loading
+1 −4
Original line number Diff line number Diff line
@@ -46,7 +46,6 @@ import android.os.Process;
import android.os.RemoteException;
import android.os.TelephonyServiceManager;
import android.os.UserHandle;
import android.provider.DeviceConfig;
import android.provider.Settings;
import android.provider.Telephony.SimInfo;
import android.service.carrier.CarrierIdentifier;
@@ -1311,9 +1310,7 @@ public class SubscriptionManagerService extends ISub.Stub {
                log("updateSubscription: SIM_STATE_NOT_READY is not a final state. Will update "
                        + "subscription later.");
                return;
            }

            if (!areUiccAppsEnabledOnCard(phoneId)) {
            } else {
                logl("updateSubscription: UICC app disabled on slot " + phoneId);
                markSubscriptionsInactive(phoneId);
            }
+13 −0
Original line number Diff line number Diff line
@@ -2235,6 +2235,19 @@ public class SubscriptionManagerServiceTest extends TelephonyTest {
        assertThat(mSubscriptionManagerServiceUT.getActiveSubIdList(false)).isEmpty();
    }

    @Test
    public void testSimNotReadyBySimDeactivate() {
        insertSubscription(FAKE_SUBSCRIPTION_INFO1);

        mContextFixture.addCallingOrSelfPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE);
        mSubscriptionManagerServiceUT.updateSimState(
                0, TelephonyManager.SIM_STATE_NOT_READY, null, null);
        doReturn(true).when(mUiccProfile).isEmptyProfile();
        processAllMessages();

        assertThat(mSubscriptionManagerServiceUT.getActiveSubIdList(false)).isEmpty();
    }

    @Test
    public void testInactiveSimRemoval() {
        insertSubscription(FAKE_SUBSCRIPTION_INFO2);