• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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     /* CARD_IO_ERROR means for three consecutive times there was SIM IO error */
32     static public final String INTENT_VALUE_ICC_CARD_IO_ERROR = "CARD_IO_ERROR";
33     /* LOCKED means ICC is locked by pin or by network */
34     public static final String INTENT_VALUE_ICC_LOCKED = "LOCKED";
35     /* READY means ICC is ready to access */
36     public static final String INTENT_VALUE_ICC_READY = "READY";
37     /* IMSI means ICC IMSI is ready in property */
38     public static final String INTENT_VALUE_ICC_IMSI = "IMSI";
39     /* LOADED means all ICC records, including IMSI, are loaded */
40     public static final String INTENT_VALUE_ICC_LOADED = "LOADED";
41     /* The extra data for broacasting intent INTENT_ICC_STATE_CHANGE */
42     public static final String INTENT_KEY_LOCKED_REASON = "reason";
43     /* PIN means ICC is locked on PIN1 */
44     public static final String INTENT_VALUE_LOCKED_ON_PIN = "PIN";
45     /* PUK means ICC is locked on PUK1 */
46     public static final String INTENT_VALUE_LOCKED_ON_PUK = "PUK";
47     /* NETWORK means ICC is locked on NETWORK PERSONALIZATION */
48     public static final String INTENT_VALUE_LOCKED_NETWORK = "NETWORK";
49     /* PERM_DISABLED means ICC is permanently disabled due to puk fails */
50     public static final String INTENT_VALUE_ABSENT_ON_PERM_DISABLED = "PERM_DISABLED";
51 
52     /**
53      * This is combination of IccCardStatus.CardState and IccCardApplicationStatus.AppState
54      * for external apps (like PhoneApp) to use
55      *
56      * UNKNOWN is a transient state, for example, after user inputs ICC pin under
57      * PIN_REQUIRED state, the query for ICC status returns UNKNOWN before it
58      * turns to READY
59      */
60     public enum State {
61         UNKNOWN,
62         ABSENT,
63         PIN_REQUIRED,
64         PUK_REQUIRED,
65         NETWORK_LOCKED,
66         READY,
67         NOT_READY,
68         PERM_DISABLED,
69         CARD_IO_ERROR;
70 
isPinLocked()71         public boolean isPinLocked() {
72             return ((this == PIN_REQUIRED) || (this == PUK_REQUIRED));
73         }
74 
iccCardExist()75         public boolean iccCardExist() {
76             return ((this == PIN_REQUIRED) || (this == PUK_REQUIRED)
77                     || (this == NETWORK_LOCKED) || (this == READY)
78                     || (this == PERM_DISABLED) || (this == CARD_IO_ERROR));
79         }
80     }
81 }
82