TelephonyManager.java
public int getSimState()
public int getSimState(int slotIdx) (hide)
最终实现在
SubscriptionManager.java getSimStateForSubscriber(int subId)
IccCard icc = phone.getIccCard() (实现在IccCardProxy.java,根据不同情况下setExternalState())
icc.getState()
public static final int SIM_STATE_UNKNOWN = 0;
/** SIM card state: no SIM card is available in the device */
public static final int SIM_STATE_ABSENT = 1;
/** SIM card state: Locked: requires the user's SIM PIN to unlock */
public static final int SIM_STATE_PIN_REQUIRED = 2;
/** SIM card state: Locked: requires the user's SIM PUK to unlock */
public static final int SIM_STATE_PUK_REQUIRED = 3;
/** SIM card state: Locked: requires a network PIN to unlock */
public static final int SIM_STATE_NETWORK_LOCKED = 4;
/** SIM card state: Ready */
public static final int SIM_STATE_READY = 5;
/** SIM card state: SIM Card is NOT READY
*@hide
*/
public static final int SIM_STATE_NOT_READY = 6;
/** SIM card state: SIM Card Error, permanently disabled
*@hide
*/
public static final int SIM_STATE_PERM_DISABLED = 7;
/** SIM card state: SIM Card Error, present but faulty
*@hide
*/
public static final int SIM_STATE_CARD_IO_ERROR = 8;
IccCardConstants.java
public enum State {
UNKNOWN, /** ordinal(0) == {@See TelephonyManager#SIM_STATE_UNKNOWN} */
ABSENT, /** ordinal(1) == {@See TelephonyManager#SIM_STATE_ABSENT} */
PIN_REQUIRED, /** ordinal(2) == {@See TelephonyManager#SIM_STATE_PIN_REQUIRED} */
PUK_REQUIRED, /** ordinal(3) == {@See TelephonyManager#SIM_STATE_PUK_REQUIRED} */
PERSO_LOCKED, /** ordinal(4) == {@See TelephonyManager#SIM_STATE_NETWORK_LOCKED} */
READY, /** ordinal(5) == {@See TelephonyManager#SIM_STATE_READY} */
NOT_READY, /** ordinal(6) == {@See TelephonyManager#SIM_STATE_NOT_READY} */
PERM_DISABLED, /** ordinal(7) == {@See TelephonyManager#SIM_STATE_PERM_DISABLED} */
CARD_IO_ERROR; /** ordinal(8) == {@See TelephonyManager#SIM_STATE_CARD_IO_ERROR} */
}