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