1/*
2 * Copyright (C) 2008 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.os.*;
20import android.telephony.Rlog;
21
22import com.android.internal.telephony.CommandsInterface;
23
24/**
25 * {@hide}
26 */
27public final class RuimFileHandler extends IccFileHandler {
28    static final String LOG_TAG = "RuimFH";
29
30    //***** Instance Variables
31
32    //***** Constructor
33    public RuimFileHandler(UiccCardApplication app, String aid, CommandsInterface ci) {
34        super(app, aid, ci);
35    }
36
37    //***** Overridden from IccFileHandler
38
39    @Override
40    public void loadEFImgTransparent(int fileid, int highOffset, int lowOffset,
41            int length, Message onLoaded) {
42        Message response = obtainMessage(EVENT_READ_ICON_DONE, fileid, 0,
43                onLoaded);
44
45        /* Per TS 31.102, for displaying of Icon, under
46         * DF Telecom and DF Graphics , EF instance(s) (4FXX,transparent files)
47         * are present. The possible image file identifiers (EF instance) for
48         * EF img ( 4F20, linear fixed file) are : 4F01 ... 4F05.
49         * It should be MF_SIM + DF_TELECOM + DF_GRAPHICS, same path as EF IMG
50         */
51        mCi.iccIOForApp(COMMAND_GET_RESPONSE, fileid, getEFPath(EF_IMG), 0, 0,
52                GET_RESPONSE_EF_IMG_SIZE_BYTES, null, null,
53                mAid, response);
54    }
55
56    @Override
57    protected String getEFPath(int efid) {
58        switch(efid) {
59        case EF_SMS:
60        case EF_CST:
61        case EF_RUIM_SPN:
62        case EF_CSIM_LI:
63        case EF_CSIM_MDN:
64        case EF_CSIM_IMSIM:
65        case EF_CSIM_CDMAHOME:
66        case EF_CSIM_EPRL:
67        case EF_CSIM_MIPUPP:
68            return MF_SIM + DF_CDMA;
69        }
70        return getCommonIccEFPath(efid);
71    }
72
73    @Override
74    protected void logd(String msg) {
75        Rlog.d(LOG_TAG, "[RuimFileHandler] " + msg);
76    }
77
78    @Override
79    protected void loge(String msg) {
80        Rlog.e(LOG_TAG, "[RuimFileHandler] " + msg);
81    }
82
83}
84