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

Commit 606faf06 authored by Jeff Davidson's avatar Jeff Davidson Committed by Android (Google) Code Review
Browse files

Merge "Revert "Update SubscriptionInfo when the SIM transitions to a NOT_READY...

Merge "Revert "Update SubscriptionInfo when the SIM transitions to a NOT_READY state."" into oc-dr1-dev
parents 6dee0e40 35055d47
Loading
Loading
Loading
Loading
+7 −9
Original line number Diff line number Diff line
@@ -71,7 +71,7 @@ public class SubscriptionInfoUpdater extends Handler {
    private static final int EVENT_SIM_LOCKED_QUERY_ICCID_DONE = 1;
    private static final int EVENT_GET_NETWORK_SELECTION_MODE_DONE = 2;
    private static final int EVENT_SIM_LOADED = 3;
    private static final int EVENT_SIM_ABSENT_OR_NOT_READY = 4;
    private static final int EVENT_SIM_ABSENT = 4;
    private static final int EVENT_SIM_LOCKED = 5;
    private static final int EVENT_SIM_IO_ERROR = 6;
    private static final int EVENT_SIM_UNKNOWN = 7;
@@ -195,10 +195,8 @@ public class SubscriptionInfoUpdater extends Handler {
            // TODO: All of the below should be converted to ACTION_INTERNAL_SIM_STATE_CHANGED to
            // ensure that the SubscriptionInfo is updated before the broadcasts are sent out.
            if (action.equals(TelephonyIntents.ACTION_SIM_STATE_CHANGED)) {
                if (IccCardConstants.INTENT_VALUE_ICC_ABSENT.equals(simStatus)
                        || IccCardConstants.INTENT_VALUE_ICC_NOT_READY.equals(simStatus)) {
                    sendMessage(obtainMessage(EVENT_SIM_ABSENT_OR_NOT_READY, slotIndex, -1,
                            simStatus));
                if (IccCardConstants.INTENT_VALUE_ICC_ABSENT.equals(simStatus)) {
                    sendMessage(obtainMessage(EVENT_SIM_ABSENT, slotIndex, -1));
                } else if (IccCardConstants.INTENT_VALUE_ICC_UNKNOWN.equals(simStatus)) {
                    sendMessage(obtainMessage(EVENT_SIM_UNKNOWN, slotIndex, -1));
                } else if (IccCardConstants.INTENT_VALUE_ICC_CARD_IO_ERROR.equals(simStatus)) {
@@ -307,8 +305,8 @@ public class SubscriptionInfoUpdater extends Handler {
                handleSimLoaded(msg.arg1);
                break;

            case EVENT_SIM_ABSENT_OR_NOT_READY:
                handleSimAbsentOrNotReady(msg.arg1, (String) msg.obj);
            case EVENT_SIM_ABSENT:
                handleSimAbsent(msg.arg1);
                break;

            case EVENT_SIM_LOCKED:
@@ -492,7 +490,7 @@ public class SubscriptionInfoUpdater extends Handler {
        mCarrierServiceBindHelper.updateForPhoneId(slotId, simState);
    }

    private void handleSimAbsentOrNotReady(int slotId, String simState) {
    private void handleSimAbsent(int slotId) {
        if (mIccId[slotId] != null && !mIccId[slotId].equals(ICCID_STRING_FOR_NO_SIM)) {
            logd("SIM" + (slotId + 1) + " hot plug out");
        }
@@ -500,7 +498,7 @@ public class SubscriptionInfoUpdater extends Handler {
        if (isAllIccIdQueryDone()) {
            updateSubscriptionInfoByIccId();
        }
        updateCarrierServices(slotId, simState);
        updateCarrierServices(slotId, IccCardConstants.INTENT_VALUE_ICC_ABSENT);
    }

    private void handleSimError(int slotId) {
+1 −24
Original line number Diff line number Diff line
@@ -182,29 +182,6 @@ public class SubscriptionInfoUpdaterTest extends TelephonyTest {
        verify(mSubscriptionController, times(1)).notifySubscriptionInfoChanged();
    }

    @Test
    @SmallTest
    public void testSimNotReady() throws Exception {
        doReturn(Arrays.asList(mSubInfo)).when(mSubscriptionController)
                .getSubInfoUsingSlotIndexWithCheck(eq(FAKE_SUB_ID_1), anyBoolean(), anyString());
        Intent mIntent = new Intent(TelephonyIntents.ACTION_SIM_STATE_CHANGED);
        mIntent.putExtra(IccCardConstants.INTENT_KEY_ICC_STATE,
                IccCardConstants.INTENT_VALUE_ICC_NOT_READY);
        mIntent.putExtra(PhoneConstants.PHONE_KEY, FAKE_SUB_ID_1);

        mContext.sendBroadcast(mIntent);

        waitForMs(100);
        verify(mSubscriptionContent).put(eq(SubscriptionManager.SIM_SLOT_INDEX),
                eq(SubscriptionManager.INVALID_SIM_SLOT_INDEX));

        CarrierConfigManager mConfigManager = (CarrierConfigManager)
                mContext.getSystemService(Context.CARRIER_CONFIG_SERVICE);
        verify(mConfigManager).updateConfigForPhoneId(eq(FAKE_SUB_ID_1),
                eq(IccCardConstants.INTENT_VALUE_ICC_NOT_READY));
        verify(mSubscriptionController, times(1)).notifySubscriptionInfoChanged();
    }

    @Test
    @SmallTest
    public void testSimUnknown() throws Exception {