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;
18
19import android.util.Log;
20
21import com.android.internal.telephony.CommandsInterface;
22import com.android.internal.telephony.IccConstants;
23import com.android.internal.telephony.IccFileHandler;
24import com.android.internal.telephony.UiccCardApplication;
25
26/**
27 * {@hide}
28 * This class should be used to access files in CSIM ADF
29 */
30public final class CsimFileHandler extends IccFileHandler implements IccConstants {
31    static final String LOG_TAG = "RIL_CsimFH";
32
33    public CsimFileHandler(UiccCardApplication app, String aid, CommandsInterface ci) {
34        super(app, aid, ci);
35    }
36
37    @Override
38    protected String getEFPath(int efid) {
39        switch(efid) {
40        case EF_SMS:
41        case EF_CST:
42        case EF_FDN:
43        case EF_MSISDN:
44        case EF_RUIM_SPN:
45        case EF_CSIM_LI:
46        case EF_CSIM_MDN:
47        case EF_CSIM_IMSIM:
48        case EF_CSIM_CDMAHOME:
49        case EF_CSIM_EPRL:
50            return MF_SIM + DF_ADF;
51        }
52        String path = getCommonIccEFPath(efid);
53        if (path == null) {
54            // The EFids in UICC phone book entries are decided by the card manufacturer.
55            // So if we don't match any of the cases above and if its a UICC return
56            // the global 3g phone book path.
57            return MF_SIM + DF_TELECOM + DF_PHONEBOOK;
58        }
59        return path;
60    }
61
62    @Override
63    protected void logd(String msg) {
64        Log.d(LOG_TAG, msg);
65    }
66
67    @Override
68    protected void loge(String msg) {
69        Log.e(LOG_TAG, msg);
70    }
71}
72