1 /*
2  * Copyright (C) 2006, 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 
17 package com.android.internal.telephony.uicc;
18 
19 import com.android.internal.telephony.CommandsInterface;
20 import com.android.telephony.Rlog;
21 
22 /**
23  * {@hide}
24  * This class should be used to access files in USIM ADF
25  */
26 public final class UsimFileHandler extends IccFileHandler implements IccConstants {
27     static final String LOG_TAG = "UsimFH";
28 
UsimFileHandler(UiccCardApplication app, String aid, CommandsInterface ci)29     public UsimFileHandler(UiccCardApplication app, String aid, CommandsInterface ci) {
30         super(app, aid, ci);
31     }
32 
33     @Override
getEFPath(int efid)34     protected String getEFPath(int efid) {
35         switch(efid) {
36         case EF_SMS:
37         case EF_EXT5:
38         case EF_EXT6:
39         case EF_MWIS:
40         case EF_MBI:
41         case EF_SPN:
42         case EF_AD:
43         case EF_MBDN:
44         case EF_PNN:
45         case EF_OPL:
46         case EF_SPDI:
47         case EF_SST:
48         case EF_CFIS:
49         case EF_MAILBOX_CPHS:
50         case EF_VOICE_MAIL_INDICATOR_CPHS:
51         case EF_CFF_CPHS:
52         case EF_SPN_CPHS:
53         case EF_SPN_SHORT_CPHS:
54         case EF_FDN:
55         case EF_SDN:
56         case EF_EXT3:
57         case EF_MSISDN:
58         case EF_EXT2:
59         case EF_INFO_CPHS:
60         case EF_CSP_CPHS:
61         case EF_GID1:
62         case EF_GID2:
63         case EF_LI:
64         case EF_PLMN_W_ACT:
65         case EF_OPLMN_W_ACT:
66         case EF_HPLMN_W_ACT:
67         case EF_EHPLMN:
68         case EF_FPLMN:
69         case EF_LRPLMNSI:
70         case EF_HPPLMN:
71             return MF_SIM + DF_ADF;
72 
73         case EF_PBR:
74             // we only support global phonebook.
75             return MF_SIM + DF_TELECOM + DF_PHONEBOOK;
76         }
77         String path = getCommonIccEFPath(efid);
78         if (path == null) {
79             // The EFids in USIM phone book entries are decided by the card manufacturer.
80             // So if we don't match any of the cases above and if its a USIM return
81             // the phone book path.
82             return MF_SIM + DF_TELECOM + DF_PHONEBOOK;
83         }
84         return path;
85     }
86 
87     @Override
logd(String msg)88     protected void logd(String msg) {
89         Rlog.d(LOG_TAG, msg);
90     }
91 
92     @Override
loge(String msg)93     protected void loge(String msg) {
94         Rlog.e(LOG_TAG, msg);
95     }
96 }
97