Home | History | Annotate | Download | only in telephony
      1 /*
      2  * Copyright (C) 2012 The Android Open Source Project
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 package com.android.internal.telephony;
     17 
     18 /**
     19  * {@hide}
     20  */
     21 public class IccCardConstants {
     22 
     23     /* The extra data for broacasting intent INTENT_ICC_STATE_CHANGE */
     24     public static final String INTENT_KEY_ICC_STATE = "ss";
     25     /* UNKNOWN means the ICC state is unknown */
     26     public static final String INTENT_VALUE_ICC_UNKNOWN = "UNKNOWN";
     27     /* NOT_READY means the ICC interface is not ready (eg, radio is off or powering on) */
     28     public static final String INTENT_VALUE_ICC_NOT_READY = "NOT_READY";
     29     /* ABSENT means ICC is missing */
     30     public static final String INTENT_VALUE_ICC_ABSENT = "ABSENT";
     31     /* LOCKED means ICC is locked by pin or by network */
     32     public static final String INTENT_VALUE_ICC_LOCKED = "LOCKED";
     33     /* READY means ICC is ready to access */
     34     public static final String INTENT_VALUE_ICC_READY = "READY";
     35     /* IMSI means ICC IMSI is ready in property */
     36     public static final String INTENT_VALUE_ICC_IMSI = "IMSI";
     37     /* LOADED means all ICC records, including IMSI, are loaded */
     38     public static final String INTENT_VALUE_ICC_LOADED = "LOADED";
     39     /* The extra data for broacasting intent INTENT_ICC_STATE_CHANGE */
     40     public static final String INTENT_KEY_LOCKED_REASON = "reason";
     41     /* PIN means ICC is locked on PIN1 */
     42     public static final String INTENT_VALUE_LOCKED_ON_PIN = "PIN";
     43     /* PUK means ICC is locked on PUK1 */
     44     public static final String INTENT_VALUE_LOCKED_ON_PUK = "PUK";
     45     /* NETWORK means ICC is locked on NETWORK PERSONALIZATION */
     46     public static final String INTENT_VALUE_LOCKED_NETWORK = "NETWORK";
     47     /* PERM_DISABLED means ICC is permanently disabled due to puk fails */
     48     public static final String INTENT_VALUE_ABSENT_ON_PERM_DISABLED = "PERM_DISABLED";
     49 
     50     /**
     51      * This is combination of IccCardStatus.CardState and IccCardApplicationStatus.AppState
     52      * for external apps (like PhoneApp) to use
     53      *
     54      * UNKNOWN is a transient state, for example, after user inputs ICC pin under
     55      * PIN_REQUIRED state, the query for ICC status returns UNKNOWN before it
     56      * turns to READY
     57      */
     58     public enum State {
     59         UNKNOWN,
     60         ABSENT,
     61         PIN_REQUIRED,
     62         PUK_REQUIRED,
     63         NETWORK_LOCKED,
     64         READY,
     65         NOT_READY,
     66         PERM_DISABLED;
     67 
     68         public boolean isPinLocked() {
     69             return ((this == PIN_REQUIRED) || (this == PUK_REQUIRED));
     70         }
     71 
     72         public boolean iccCardExist() {
     73             return ((this == PIN_REQUIRED) || (this == PUK_REQUIRED)
     74                     || (this == NETWORK_LOCKED) || (this == READY)
     75                     || (this == PERM_DISABLED));
     76         }
     77     }
     78 }
     79