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