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