1/*
2 * Copyright (C) 2011 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.cdma;
18
19import android.util.Log;
20
21import com.android.internal.telephony.CommandsInterface;
22import com.android.internal.telephony.IccCard;
23import com.android.internal.telephony.IccConstants;
24import com.android.internal.telephony.IccFileHandler;
25import android.os.Message;
26
27/**
28 * {@hide}
29 */
30public final class CdmaLteUiccFileHandler extends IccFileHandler {
31    static final String LOG_TAG = "CDMA";
32
33    public CdmaLteUiccFileHandler(IccCard card, String aid, CommandsInterface ci) {
34        super(card, aid, ci);
35    }
36
37    protected String getEFPath(int efid) {
38        switch(efid) {
39        case EF_CSIM_SPN:
40        case EF_CSIM_LI:
41        case EF_CSIM_MDN:
42        case EF_CSIM_IMSIM:
43        case EF_CSIM_CDMAHOME:
44        case EF_CSIM_EPRL:
45            return MF_SIM + DF_CDMA;
46        case EF_AD:
47            return MF_SIM + DF_GSM;
48        case EF_IMPI:
49        case EF_DOMAIN:
50        case EF_IMPU:
51            return MF_SIM + DF_ADFISIM;
52        }
53        return getCommonIccEFPath(efid);
54    }
55
56    @Override
57    public void loadEFTransparent(int fileid, Message onLoaded) {
58        if (fileid == EF_CSIM_EPRL) {
59            // Entire PRL could be huge. We are only interested in
60            // the first 4 bytes of the record.
61            mCi.iccIOForApp(COMMAND_READ_BINARY, fileid, getEFPath(fileid),
62                            0, 0, 4, null, null, mAid,
63                            obtainMessage(EVENT_READ_BINARY_DONE,
64                                          fileid, 0, onLoaded));
65        } else {
66            super.loadEFTransparent(fileid, onLoaded);
67        }
68    }
69
70
71    protected void logd(String msg) {
72        Log.d(LOG_TAG, "[CdmaLteUiccFileHandler] " + msg);
73    }
74
75    protected void loge(String msg) {
76        Log.e(LOG_TAG, "[CdmaLteUiccFileHandler] " + msg);
77    }
78
79}
80