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

Commit 4ead6a47 authored by Xiangyu/Malcolm Chen's avatar Xiangyu/Malcolm Chen Committed by android-build-merger
Browse files

Merge "Move setSimState() call from UiccProfile to UiccController." am: db76603b

am: 9c30d47c

Change-Id: I6d779fe6ec4429817a208813753f1027833011a4
parents 1da8e5f9 9c30d47c
Loading
Loading
Loading
Loading
+24 −3
Original line number Diff line number Diff line
@@ -30,7 +30,6 @@ import android.telephony.Rlog;
import android.telephony.TelephonyManager;
import android.util.LocalLog;

import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.telephony.CommandException;
import com.android.internal.telephony.CommandsInterface;
import com.android.internal.telephony.IccCardConstants;
@@ -471,10 +470,32 @@ public class UiccController extends Handler {
        }
    }

    static void updateInternalIccState(String value, String reason, int phoneId) {
    static String getIccStateIntentString(IccCardConstants.State state) {
        switch (state) {
            case ABSENT: return IccCardConstants.INTENT_VALUE_ICC_ABSENT;
            case PIN_REQUIRED: return IccCardConstants.INTENT_VALUE_ICC_LOCKED;
            case PUK_REQUIRED: return IccCardConstants.INTENT_VALUE_ICC_LOCKED;
            case NETWORK_LOCKED: return IccCardConstants.INTENT_VALUE_ICC_LOCKED;
            case READY: return IccCardConstants.INTENT_VALUE_ICC_READY;
            case NOT_READY: return IccCardConstants.INTENT_VALUE_ICC_NOT_READY;
            case PERM_DISABLED: return IccCardConstants.INTENT_VALUE_ICC_LOCKED;
            case CARD_IO_ERROR: return IccCardConstants.INTENT_VALUE_ICC_CARD_IO_ERROR;
            case CARD_RESTRICTED: return IccCardConstants.INTENT_VALUE_ICC_CARD_RESTRICTED;
            case LOADED: return IccCardConstants.INTENT_VALUE_ICC_LOADED;
            default: return IccCardConstants.INTENT_VALUE_ICC_UNKNOWN;
        }
    }

    static void updateInternalIccState(Context context, IccCardConstants.State state, String reason,
            int phoneId) {
        TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(
                Context.TELEPHONY_SERVICE);
        telephonyManager.setSimStateForPhone(phoneId, state.toString());

        SubscriptionInfoUpdater subInfoUpdator = PhoneFactory.getSubscriptionInfoUpdater();
        if (subInfoUpdator != null) {
            subInfoUpdator.updateInternalIccState(value, reason, phoneId);
            subInfoUpdator.updateInternalIccState(getIccStateIntentString(state),
                    reason, phoneId);
        } else {
            Rlog.e(LOG_TAG, "subInfoUpdate is null.");
        }
+1 −18
Original line number Diff line number Diff line
@@ -603,9 +603,8 @@ public class UiccProfile extends IccCard {
                }
            }
            log("setExternalState: set mPhoneId=" + mPhoneId + " mExternalState=" + mExternalState);
            mTelephonyManager.setSimStateForPhone(mPhoneId, getState().toString());

            UiccController.updateInternalIccState(getIccStateIntentString(mExternalState),
            UiccController.updateInternalIccState(mContext, mExternalState,
                    getIccStateReason(mExternalState), mPhoneId);
        }
    }
@@ -627,22 +626,6 @@ public class UiccProfile extends IccCard {
        }
    }

    private String getIccStateIntentString(IccCardConstants.State state) {
        switch (state) {
            case ABSENT: return IccCardConstants.INTENT_VALUE_ICC_ABSENT;
            case PIN_REQUIRED: return IccCardConstants.INTENT_VALUE_ICC_LOCKED;
            case PUK_REQUIRED: return IccCardConstants.INTENT_VALUE_ICC_LOCKED;
            case NETWORK_LOCKED: return IccCardConstants.INTENT_VALUE_ICC_LOCKED;
            case READY: return IccCardConstants.INTENT_VALUE_ICC_READY;
            case NOT_READY: return IccCardConstants.INTENT_VALUE_ICC_NOT_READY;
            case PERM_DISABLED: return IccCardConstants.INTENT_VALUE_ICC_LOCKED;
            case CARD_IO_ERROR: return IccCardConstants.INTENT_VALUE_ICC_CARD_IO_ERROR;
            case CARD_RESTRICTED: return IccCardConstants.INTENT_VALUE_ICC_CARD_RESTRICTED;
            case LOADED: return IccCardConstants.INTENT_VALUE_ICC_LOADED;
            default: return IccCardConstants.INTENT_VALUE_ICC_UNKNOWN;
        }
    }

    /**
     * Locked state have a reason (PIN, PUK, NETWORK, PERM_DISABLED, CARD_IO_ERROR)
     * @return reason
+2 −2
Original line number Diff line number Diff line
@@ -174,7 +174,7 @@ public class UiccSlot extends Handler {
        }

        UiccController.updateInternalIccState(
                IccCardConstants.INTENT_VALUE_ICC_ABSENT, null, mPhoneId);
                mContext, IccCardConstants.State.ABSENT, null, mPhoneId);

        // no card present in the slot now; dispose card and make mUiccCard null
        if (mUiccCard != null) {
@@ -362,7 +362,7 @@ public class UiccSlot extends Handler {

        if (mPhoneId != INVALID_PHONE_ID) {
            UiccController.updateInternalIccState(
                    IccCardConstants.INTENT_VALUE_ICC_UNKNOWN, null, mPhoneId);
                    mContext, IccCardConstants.State.UNKNOWN, null, mPhoneId);
        }

        mCardState = CardState.CARDSTATE_ABSENT;