IccCardConstants.java revision ceb9bbc5df7c384d5a6b3dec916e1c838f994536
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 */
16package com.android.internal.telephony;
17
18/**
19 * {@hide}
20 */
21public 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      UNKNOWN is a transient state, for example, after uesr inputs ICC pin under
52      PIN_REQUIRED state, the query for ICC status returns UNKNOWN before it
53      turns to READY
54     */
55    public enum State {
56        UNKNOWN,
57        ABSENT,
58        PIN_REQUIRED,
59        PUK_REQUIRED,
60        NETWORK_LOCKED,
61        READY,
62        NOT_READY,
63        PERM_DISABLED;
64
65        public boolean isPinLocked() {
66            return ((this == PIN_REQUIRED) || (this == PUK_REQUIRED));
67        }
68
69        public boolean iccCardExist() {
70            return ((this == PIN_REQUIRED) || (this == PUK_REQUIRED)
71                    || (this == NETWORK_LOCKED) || (this == READY)
72                    || (this == PERM_DISABLED));
73        }
74    }
75}
76