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