UsimFileHandler.java revision d720945f2be5ea5fe0faf67e67d9ea0e184eba67
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            return MF_SIM + DF_ADF;
61
62        case EF_PBR:
63            // we only support global phonebook.
64            return MF_SIM + DF_TELECOM + DF_PHONEBOOK;
65        }
66        String path = getCommonIccEFPath(efid);
67        if (path == null) {
68            // The EFids in USIM phone book entries are decided by the card manufacturer.
69            // So if we don't match any of the cases above and if its a USIM return
70            // the phone book path.
71            return MF_SIM + DF_TELECOM + DF_PHONEBOOK;
72        }
73        return path;
74    }
75
76    @Override
77    protected void logd(String msg) {
78        Rlog.d(LOG_TAG, msg);
79    }
80
81    @Override
82    protected void loge(String msg) {
83        Rlog.e(LOG_TAG, msg);
84    }
85}
86