1c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville/*
2c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville * Copyright (C) 2006 The Android Open Source Project
3c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville *
4c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville * Licensed under the Apache License, Version 2.0 (the "License");
5c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville * you may not use this file except in compliance with the License.
6c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville * You may obtain a copy of the License at
7c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville *
8c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville *      http://www.apache.org/licenses/LICENSE-2.0
9c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville *
10c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville * Unless required by applicable law or agreed to in writing, software
11c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville * distributed under the License is distributed on an "AS IS" BASIS,
12c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville * See the License for the specific language governing permissions and
14c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville * limitations under the License.
15c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville */
16c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville
17d720945f2be5ea5fe0faf67e67d9ea0e184eba67Alex Yakavenkapackage com.android.internal.telephony.uicc;
18c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville
19c99e7c34aaca14bb1d8f9962f79d9465ccc04575Wink Savilleimport android.telephony.Rlog;
20c99e7c34aaca14bb1d8f9962f79d9465ccc04575Wink Saville
21d720945f2be5ea5fe0faf67e67d9ea0e184eba67Alex Yakavenkaimport com.android.internal.telephony.uicc.IccCardStatus.PinState;
22c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville
23c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville
24c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville/**
25c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville * See also RIL_AppStatus in include/telephony/ril.h
26c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville *
27c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville * {@hide}
28c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville */
29e287feac673ff68565b766e0e463d105fa9cef9dAlex Yakavenkapublic class IccCardApplicationStatus {
30a8467dd0c524787104b1ccdddc5e8af10ba729edWink Saville    // TODO: Replace with constants from PhoneConstants.APPTYPE_xxx
31c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville    public enum AppType{
32c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        APPTYPE_UNKNOWN,
33c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        APPTYPE_SIM,
34c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        APPTYPE_USIM,
35c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        APPTYPE_RUIM,
36c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        APPTYPE_CSIM,
37c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        APPTYPE_ISIM
38cbaa45bbf2cab852b6c9c3a887e9f803d4e857eaWink Saville    }
39c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville
40c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville    public enum AppState{
41c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        APPSTATE_UNKNOWN,
42c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        APPSTATE_DETECTED,
43c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        APPSTATE_PIN,
44c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        APPSTATE_PUK,
45c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        APPSTATE_SUBSCRIPTION_PERSO,
46c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        APPSTATE_READY;
47c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville
48c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        boolean isPinRequired() {
49c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville            return this == APPSTATE_PIN;
50c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        }
51c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville
52c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        boolean isPukRequired() {
53c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville            return this == APPSTATE_PUK;
54c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        }
55c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville
56c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        boolean isSubscriptionPersoEnabled() {
57c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville            return this == APPSTATE_SUBSCRIPTION_PERSO;
58c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        }
59c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville
60c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        boolean isAppReady() {
61c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville            return this == APPSTATE_READY;
62c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        }
63c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville
64c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        boolean isAppNotReady() {
65c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville            return this == APPSTATE_UNKNOWN  ||
66c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville                   this == APPSTATE_DETECTED;
67c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        }
68cbaa45bbf2cab852b6c9c3a887e9f803d4e857eaWink Saville    }
69c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville
70c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville    public enum PersoSubState{
71c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        PERSOSUBSTATE_UNKNOWN,
72c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        PERSOSUBSTATE_IN_PROGRESS,
73c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        PERSOSUBSTATE_READY,
74c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        PERSOSUBSTATE_SIM_NETWORK,
75c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        PERSOSUBSTATE_SIM_NETWORK_SUBSET,
76c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        PERSOSUBSTATE_SIM_CORPORATE,
77c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        PERSOSUBSTATE_SIM_SERVICE_PROVIDER,
78c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        PERSOSUBSTATE_SIM_SIM,
79c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        PERSOSUBSTATE_SIM_NETWORK_PUK,
80c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        PERSOSUBSTATE_SIM_NETWORK_SUBSET_PUK,
81c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        PERSOSUBSTATE_SIM_CORPORATE_PUK,
82c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        PERSOSUBSTATE_SIM_SERVICE_PROVIDER_PUK,
83c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        PERSOSUBSTATE_SIM_SIM_PUK,
84c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        PERSOSUBSTATE_RUIM_NETWORK1,
85c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        PERSOSUBSTATE_RUIM_NETWORK2,
86c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        PERSOSUBSTATE_RUIM_HRPD,
87c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        PERSOSUBSTATE_RUIM_CORPORATE,
88c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        PERSOSUBSTATE_RUIM_SERVICE_PROVIDER,
89c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        PERSOSUBSTATE_RUIM_RUIM,
90c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        PERSOSUBSTATE_RUIM_NETWORK1_PUK,
91c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        PERSOSUBSTATE_RUIM_NETWORK2_PUK,
92c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        PERSOSUBSTATE_RUIM_HRPD_PUK,
93c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        PERSOSUBSTATE_RUIM_CORPORATE_PUK,
94c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        PERSOSUBSTATE_RUIM_SERVICE_PROVIDER_PUK,
95c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        PERSOSUBSTATE_RUIM_RUIM_PUK;
96c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville
97c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        boolean isPersoSubStateUnknown() {
98c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville            return this == PERSOSUBSTATE_UNKNOWN;
99c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        }
100cbaa45bbf2cab852b6c9c3a887e9f803d4e857eaWink Saville    }
101c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville
102c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville    public AppType        app_type;
103c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville    public AppState       app_state;
104c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville    // applicable only if app_state == RIL_APPSTATE_SUBSCRIPTION_PERSO
105c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville    public PersoSubState  perso_substate;
106c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville    // null terminated string, e.g., from 0xA0, 0x00 -> 0x41, 0x30, 0x30, 0x30 */
107c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville    public String         aid;
108c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville    // null terminated string
109c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville    public String         app_label;
110c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville    // applicable to USIM and CSIM
111c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville    public int            pin1_replaced;
112c99e7c34aaca14bb1d8f9962f79d9465ccc04575Wink Saville    public PinState       pin1;
113c99e7c34aaca14bb1d8f9962f79d9465ccc04575Wink Saville    public PinState       pin2;
114c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville
115d720945f2be5ea5fe0faf67e67d9ea0e184eba67Alex Yakavenka    public AppType AppTypeFromRILInt(int type) {
116c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        AppType newType;
117c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        /* RIL_AppType ril.h */
118c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        switch(type) {
119c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville            case 0: newType = AppType.APPTYPE_UNKNOWN; break;
120c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville            case 1: newType = AppType.APPTYPE_SIM;     break;
121c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville            case 2: newType = AppType.APPTYPE_USIM;    break;
122c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville            case 3: newType = AppType.APPTYPE_RUIM;    break;
123c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville            case 4: newType = AppType.APPTYPE_CSIM;    break;
124c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville            case 5: newType = AppType.APPTYPE_ISIM;    break;
125c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville            default:
126c99e7c34aaca14bb1d8f9962f79d9465ccc04575Wink Saville                newType = AppType.APPTYPE_UNKNOWN;
127c99e7c34aaca14bb1d8f9962f79d9465ccc04575Wink Saville                loge("AppTypeFromRILInt: bad RIL_AppType: " + type + " use APPTYPE_UNKNOWN");
128c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        }
129c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        return newType;
130c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville    }
131c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville
132d720945f2be5ea5fe0faf67e67d9ea0e184eba67Alex Yakavenka    public AppState AppStateFromRILInt(int state) {
133c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        AppState newState;
134c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        /* RIL_AppState ril.h */
135c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        switch(state) {
136c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville            case 0: newState = AppState.APPSTATE_UNKNOWN;  break;
137c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville            case 1: newState = AppState.APPSTATE_DETECTED; break;
138c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville            case 2: newState = AppState.APPSTATE_PIN; break;
139c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville            case 3: newState = AppState.APPSTATE_PUK; break;
140c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville            case 4: newState = AppState.APPSTATE_SUBSCRIPTION_PERSO; break;
141c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville            case 5: newState = AppState.APPSTATE_READY; break;
142c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville            default:
143c99e7c34aaca14bb1d8f9962f79d9465ccc04575Wink Saville                newState = AppState.APPSTATE_UNKNOWN;
144c99e7c34aaca14bb1d8f9962f79d9465ccc04575Wink Saville                loge("AppStateFromRILInt: bad state: " + state + " use APPSTATE_UNKNOWN");
145c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        }
146c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        return newState;
147c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville    }
148c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville
149d720945f2be5ea5fe0faf67e67d9ea0e184eba67Alex Yakavenka    public PersoSubState PersoSubstateFromRILInt(int substate) {
150c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        PersoSubState newSubState;
151c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        /* RIL_PeroSubstate ril.h */
152c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        switch(substate) {
153c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville            case 0:  newSubState = PersoSubState.PERSOSUBSTATE_UNKNOWN;  break;
154c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville            case 1:  newSubState = PersoSubState.PERSOSUBSTATE_IN_PROGRESS; break;
155c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville            case 2:  newSubState = PersoSubState.PERSOSUBSTATE_READY; break;
156c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville            case 3:  newSubState = PersoSubState.PERSOSUBSTATE_SIM_NETWORK; break;
157c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville            case 4:  newSubState = PersoSubState.PERSOSUBSTATE_SIM_NETWORK_SUBSET; break;
158c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville            case 5:  newSubState = PersoSubState.PERSOSUBSTATE_SIM_CORPORATE; break;
159c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville            case 6:  newSubState = PersoSubState.PERSOSUBSTATE_SIM_SERVICE_PROVIDER; break;
160c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville            case 7:  newSubState = PersoSubState.PERSOSUBSTATE_SIM_SIM;  break;
161c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville            case 8:  newSubState = PersoSubState.PERSOSUBSTATE_SIM_NETWORK_PUK; break;
162c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville            case 9:  newSubState = PersoSubState.PERSOSUBSTATE_SIM_NETWORK_SUBSET_PUK; break;
163c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville            case 10: newSubState = PersoSubState.PERSOSUBSTATE_SIM_CORPORATE_PUK; break;
164c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville            case 11: newSubState = PersoSubState.PERSOSUBSTATE_SIM_SERVICE_PROVIDER_PUK; break;
165c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville            case 12: newSubState = PersoSubState.PERSOSUBSTATE_SIM_SIM_PUK; break;
166c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville            case 13: newSubState = PersoSubState.PERSOSUBSTATE_RUIM_NETWORK1; break;
167c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville            case 14: newSubState = PersoSubState.PERSOSUBSTATE_RUIM_NETWORK2; break;
168c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville            case 15: newSubState = PersoSubState.PERSOSUBSTATE_RUIM_HRPD; break;
169c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville            case 16: newSubState = PersoSubState.PERSOSUBSTATE_RUIM_CORPORATE; break;
170c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville            case 17: newSubState = PersoSubState.PERSOSUBSTATE_RUIM_SERVICE_PROVIDER; break;
171c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville            case 18: newSubState = PersoSubState.PERSOSUBSTATE_RUIM_RUIM; break;
172c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville            case 19: newSubState = PersoSubState.PERSOSUBSTATE_RUIM_NETWORK1_PUK; break;
173c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville            case 20: newSubState = PersoSubState.PERSOSUBSTATE_RUIM_NETWORK2_PUK; break;
174c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville            case 21: newSubState = PersoSubState.PERSOSUBSTATE_RUIM_HRPD_PUK ; break;
175c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville            case 22: newSubState = PersoSubState.PERSOSUBSTATE_RUIM_CORPORATE_PUK; break;
176c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville            case 23: newSubState = PersoSubState.PERSOSUBSTATE_RUIM_SERVICE_PROVIDER_PUK; break;
177c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville            case 24: newSubState = PersoSubState.PERSOSUBSTATE_RUIM_RUIM_PUK; break;
178c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville            default:
179c99e7c34aaca14bb1d8f9962f79d9465ccc04575Wink Saville                newSubState = PersoSubState.PERSOSUBSTATE_UNKNOWN;
180c99e7c34aaca14bb1d8f9962f79d9465ccc04575Wink Saville                loge("PersoSubstateFromRILInt: bad substate: " + substate
181c99e7c34aaca14bb1d8f9962f79d9465ccc04575Wink Saville                        + " use PERSOSUBSTATE_UNKNOWN");
182c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        }
183c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        return newSubState;
184c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville    }
185c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville
186d720945f2be5ea5fe0faf67e67d9ea0e184eba67Alex Yakavenka    public PinState PinStateFromRILInt(int state) {
187c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        PinState newPinState;
188c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        switch(state) {
189c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville            case 0:
190c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville                newPinState = PinState.PINSTATE_UNKNOWN;
191c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville                break;
192c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville            case 1:
193c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville                newPinState = PinState.PINSTATE_ENABLED_NOT_VERIFIED;
194c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville                break;
195c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville            case 2:
196c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville                newPinState = PinState.PINSTATE_ENABLED_VERIFIED;
197c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville                break;
198c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville            case 3:
199c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville                newPinState = PinState.PINSTATE_DISABLED;
200c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville                break;
201c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville            case 4:
202c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville                newPinState = PinState.PINSTATE_ENABLED_BLOCKED;
203c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville                break;
204c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville            case 5:
205c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville                newPinState = PinState.PINSTATE_ENABLED_PERM_BLOCKED;
206c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville                break;
207c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville            default:
208c99e7c34aaca14bb1d8f9962f79d9465ccc04575Wink Saville                newPinState = PinState.PINSTATE_UNKNOWN;
209c99e7c34aaca14bb1d8f9962f79d9465ccc04575Wink Saville                loge("PinStateFromRILInt: bad pin state: " + state + " use PINSTATE_UNKNOWN");
210c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        }
211c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        return newPinState;
212c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville    }
213c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville
214c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville    @Override
215c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville    public String toString() {
216c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        StringBuilder sb = new StringBuilder();
217c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville
218c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        sb.append("{").append(app_type).append(",").append(app_state);
219c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        if (app_state == AppState.APPSTATE_SUBSCRIPTION_PERSO) {
220c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville            sb.append(",").append(perso_substate);
221c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        }
222c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        if (app_type == AppType.APPTYPE_CSIM ||
223c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville                app_type == AppType.APPTYPE_USIM ||
224c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville                app_type == AppType.APPTYPE_ISIM) {
225c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville            sb.append(",pin1=").append(pin1);
226c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville            sb.append(",pin2=").append(pin2);
227c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        }
228c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        sb.append("}");
229c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville        return sb.toString();
230c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville    }
231c99e7c34aaca14bb1d8f9962f79d9465ccc04575Wink Saville
232c99e7c34aaca14bb1d8f9962f79d9465ccc04575Wink Saville    private void loge(String s) {
233c99e7c34aaca14bb1d8f9962f79d9465ccc04575Wink Saville        Rlog.e("IccCardApplicationStatus", s);
234c99e7c34aaca14bb1d8f9962f79d9465ccc04575Wink Saville    }
235c38bb60d867c5d61d90b7179a9ed2b2d1848124fWink Saville}
236