OSDN Git Service

Merge "cherrypick from master: Change-Id: I169749dc594ca1d79a802db4c53ec330924fdd2c...
[android-x86/frameworks-base.git] / telephony / java / com / android / internal / telephony / cdma / RuimPhoneBookInterfaceManager.java
1 /*
2 ** Copyright 2007, 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
17 package com.android.internal.telephony.cdma;
18
19 import android.os.Message;
20 import android.util.Log;
21
22 import com.android.internal.telephony.IccPhoneBookInterfaceManager;
23
24 /**
25  * RuimPhoneBookInterfaceManager to provide an inter-process communication to
26  * access ADN-like SIM records.
27  */
28
29
30 public class RuimPhoneBookInterfaceManager extends IccPhoneBookInterfaceManager {
31     static final String LOG_TAG = "CDMA";
32
33     public RuimPhoneBookInterfaceManager(CDMAPhone phone) {
34         super(phone);
35         adnCache = phone.mRuimRecords.getAdnCache();
36         //NOTE service "simphonebook" added by IccSmsInterfaceManagerProxy
37     }
38
39     public void dispose() {
40         super.dispose();
41     }
42
43     protected void finalize() {
44         try {
45             super.finalize();
46         } catch (Throwable throwable) {
47             Log.e(LOG_TAG, "Error while finalizing:", throwable);
48         }
49         if(DBG) Log.d(LOG_TAG, "RuimPhoneBookInterfaceManager finalized");
50     }
51
52     public int[] getAdnRecordsSize(int efid) {
53         if (DBG) logd("getAdnRecordsSize: efid=" + efid);
54         synchronized(mLock) {
55             checkThread();
56             recordSize = new int[3];
57
58             //Using mBaseHandler, no difference in EVENT_GET_SIZE_DONE handling
59             Message response = mBaseHandler.obtainMessage(EVENT_GET_SIZE_DONE);
60
61             phone.getIccFileHandler().getEFLinearRecordSize(efid, response);
62             try {
63                 mLock.wait();
64             } catch (InterruptedException e) {
65                 logd("interrupted while trying to load from the RUIM");
66             }
67         }
68
69         return recordSize;
70     }
71
72     protected void logd(String msg) {
73         Log.d(LOG_TAG, "[RuimPbInterfaceManager] " + msg);
74     }
75
76     protected void loge(String msg) {
77         Log.e(LOG_TAG, "[RuimPbInterfaceManager] " + msg);
78     }
79 }
80