UsimFileHandler.java revision 2f837b8058eba0bc59e983c67efbc00cd9a80eee
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 = "RIL_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_EXT6:
40        case EF_MWIS:
41        case EF_MBI:
42        case EF_SPN:
43        case EF_AD:
44        case EF_MBDN:
45        case EF_PNN:
46        case EF_OPL:
47        case EF_SPDI:
48        case EF_SST:
49        case EF_CFIS:
50        case EF_MAILBOX_CPHS:
51        case EF_VOICE_MAIL_INDICATOR_CPHS:
52        case EF_CFF_CPHS:
53        case EF_SPN_CPHS:
54        case EF_SPN_SHORT_CPHS:
55        case EF_FDN:
56        case EF_MSISDN:
57        case EF_EXT2:
58        case EF_INFO_CPHS:
59        case EF_CSP_CPHS:
60        case EF_GID1:
61            return MF_SIM + DF_ADF;
62
63        case EF_PBR:
64            // we only support global phonebook.
65            return MF_SIM + DF_TELECOM + DF_PHONEBOOK;
66        }
67        String path = getCommonIccEFPath(efid);
68        if (path == null) {
69            // The EFids in USIM phone book entries are decided by the card manufacturer.
70            // So if we don't match any of the cases above and if its a USIM return
71            // the phone book path.
72            return MF_SIM + DF_TELECOM + DF_PHONEBOOK;
73        }
74        return path;
75    }
76
77    @Override
78    protected void logd(String msg) {
79        Rlog.d(LOG_TAG, msg);
80    }
81
82    @Override
83    protected void loge(String msg) {
84        Rlog.e(LOG_TAG, msg);
85    }
86}
87