Merge "Calling super.finalize() in finalize() methods. Also cleanup code, mostly removing unused handlers and casts."
This commit is contained in:
@@ -22,10 +22,7 @@ import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.os.Message;
|
||||
import android.os.ServiceManager;
|
||||
import android.telephony.PhoneNumberUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -37,7 +34,7 @@ public abstract class IccPhoneBookInterfaceManager extends IIccPhoneBook.Stub {
|
||||
|
||||
protected PhoneBase phone;
|
||||
protected AdnRecordCache adnCache;
|
||||
protected Object mLock = new Object();
|
||||
protected final Object mLock = new Object();
|
||||
protected int recordSize[];
|
||||
protected boolean success;
|
||||
protected List<AdnRecord> records;
|
||||
@@ -80,8 +77,7 @@ public abstract class IccPhoneBookInterfaceManager extends IIccPhoneBook.Stub {
|
||||
ar = (AsyncResult)msg.obj;
|
||||
synchronized (mLock) {
|
||||
if (ar.exception == null) {
|
||||
records = (List<AdnRecord>)
|
||||
((ArrayList<AdnRecord>) ar.result);
|
||||
records = (List<AdnRecord>) ar.result;
|
||||
} else {
|
||||
if(DBG) logd("Cannot load ADN records");
|
||||
if (records != null) {
|
||||
|
||||
@@ -39,6 +39,11 @@ public class PhoneSubInfo extends IPhoneSubInfo.Stub {
|
||||
}
|
||||
|
||||
protected void finalize() {
|
||||
try {
|
||||
super.finalize();
|
||||
} catch (Throwable throwable) {
|
||||
Log.e(LOG_TAG, "Error while finalizing:", throwable);
|
||||
}
|
||||
Log.d(LOG_TAG, "PhoneSubInfo finalized");
|
||||
}
|
||||
|
||||
|
||||
@@ -16,22 +16,10 @@
|
||||
|
||||
package com.android.internal.telephony.cdma;
|
||||
|
||||
import android.content.pm.PackageManager;
|
||||
import android.os.AsyncResult;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.os.Message;
|
||||
import android.os.ServiceManager;
|
||||
import android.telephony.PhoneNumberUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import com.android.internal.telephony.AdnRecord;
|
||||
import com.android.internal.telephony.AdnRecordCache;
|
||||
import com.android.internal.telephony.IccPhoneBookInterfaceManager;
|
||||
import com.android.internal.telephony.PhoneProxy;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* RuimPhoneBookInterfaceManager to provide an inter-process communication to
|
||||
@@ -42,20 +30,6 @@ import java.util.List;
|
||||
public class RuimPhoneBookInterfaceManager extends IccPhoneBookInterfaceManager {
|
||||
static final String LOG_TAG = "CDMA";
|
||||
|
||||
|
||||
Handler mHandler = new Handler() {
|
||||
@Override
|
||||
public void handleMessage(Message msg) {
|
||||
AsyncResult ar;
|
||||
|
||||
switch(msg.what) {
|
||||
default:
|
||||
mBaseHandler.handleMessage(msg);
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
public RuimPhoneBookInterfaceManager(CDMAPhone phone) {
|
||||
super(phone);
|
||||
adnCache = phone.mRuimRecords.getAdnCache();
|
||||
@@ -67,6 +41,11 @@ public class RuimPhoneBookInterfaceManager extends IccPhoneBookInterfaceManager
|
||||
}
|
||||
|
||||
protected void finalize() {
|
||||
try {
|
||||
super.finalize();
|
||||
} catch (Throwable throwable) {
|
||||
Log.e(LOG_TAG, "Error while finalizing:", throwable);
|
||||
}
|
||||
if(DBG) Log.d(LOG_TAG, "RuimPhoneBookInterfaceManager finalized");
|
||||
}
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@ import com.android.internal.telephony.PhoneProxy;
|
||||
import com.android.internal.telephony.SmsRawData;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import static android.telephony.SmsManager.STATUS_ON_ICC_FREE;
|
||||
@@ -89,6 +90,11 @@ public class RuimSmsInterfaceManager extends IccSmsInterfaceManager {
|
||||
}
|
||||
|
||||
protected void finalize() {
|
||||
try {
|
||||
super.finalize();
|
||||
} catch (Throwable throwable) {
|
||||
Log.e(LOG_TAG, "Error while finalizing:", throwable);
|
||||
}
|
||||
if(DBG) Log.d(LOG_TAG, "RuimSmsInterfaceManager finalized");
|
||||
}
|
||||
|
||||
@@ -143,7 +149,7 @@ public class RuimSmsInterfaceManager extends IccSmsInterfaceManager {
|
||||
public boolean copyMessageToIccEf(int status, byte[] pdu, byte[] smsc) {
|
||||
//NOTE smsc not used in RUIM
|
||||
if (DBG) log("copyMessageToIccEf: status=" + status + " ==> " +
|
||||
"pdu=("+ pdu + ")");
|
||||
"pdu=("+ Arrays.toString(pdu) + ")");
|
||||
enforceReceiveAndSend("Copying message to RUIM");
|
||||
synchronized(mLock) {
|
||||
mSuccess = false;
|
||||
|
||||
@@ -16,22 +16,10 @@
|
||||
|
||||
package com.android.internal.telephony.gsm;
|
||||
|
||||
import android.content.pm.PackageManager;
|
||||
import android.os.AsyncResult;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.os.Message;
|
||||
import android.os.ServiceManager;
|
||||
import android.telephony.PhoneNumberUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import com.android.internal.telephony.AdnRecord;
|
||||
import com.android.internal.telephony.AdnRecordCache;
|
||||
import com.android.internal.telephony.IccPhoneBookInterfaceManager;
|
||||
import com.android.internal.telephony.PhoneProxy;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* SimPhoneBookInterfaceManager to provide an inter-process communication to
|
||||
@@ -42,20 +30,6 @@ import java.util.List;
|
||||
public class SimPhoneBookInterfaceManager extends IccPhoneBookInterfaceManager {
|
||||
static final String LOG_TAG = "GSM";
|
||||
|
||||
|
||||
Handler mHandler = new Handler() {
|
||||
@Override
|
||||
public void handleMessage(Message msg) {
|
||||
AsyncResult ar;
|
||||
|
||||
switch(msg.what) {
|
||||
default:
|
||||
mBaseHandler.handleMessage(msg);
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
public SimPhoneBookInterfaceManager(GSMPhone phone) {
|
||||
super(phone);
|
||||
adnCache = phone.mSIMRecords.getAdnCache();
|
||||
@@ -67,6 +41,11 @@ public class SimPhoneBookInterfaceManager extends IccPhoneBookInterfaceManager {
|
||||
}
|
||||
|
||||
protected void finalize() {
|
||||
try {
|
||||
super.finalize();
|
||||
} catch (Throwable throwable) {
|
||||
Log.e(LOG_TAG, "Error while finalizing:", throwable);
|
||||
}
|
||||
if(DBG) Log.d(LOG_TAG, "SimPhoneBookInterfaceManager finalized");
|
||||
}
|
||||
|
||||
|
||||
@@ -25,10 +25,10 @@ import android.util.Log;
|
||||
import com.android.internal.telephony.IccConstants;
|
||||
import com.android.internal.telephony.IccSmsInterfaceManager;
|
||||
import com.android.internal.telephony.IccUtils;
|
||||
import com.android.internal.telephony.PhoneProxy;
|
||||
import com.android.internal.telephony.SmsRawData;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import static android.telephony.SmsManager.STATUS_ON_ICC_FREE;
|
||||
@@ -65,8 +65,7 @@ public class SimSmsInterfaceManager extends IccSmsInterfaceManager {
|
||||
ar = (AsyncResult)msg.obj;
|
||||
synchronized (mLock) {
|
||||
if (ar.exception == null) {
|
||||
mSms = (List<SmsRawData>)
|
||||
buildValidRawData((ArrayList<byte[]>) ar.result);
|
||||
mSms = buildValidRawData((ArrayList<byte[]>) ar.result);
|
||||
} else {
|
||||
if(DBG) log("Cannot load Sms records");
|
||||
if (mSms != null)
|
||||
@@ -88,6 +87,11 @@ public class SimSmsInterfaceManager extends IccSmsInterfaceManager {
|
||||
}
|
||||
|
||||
protected void finalize() {
|
||||
try {
|
||||
super.finalize();
|
||||
} catch (Throwable throwable) {
|
||||
Log.e(LOG_TAG, "Error while finalizing:", throwable);
|
||||
}
|
||||
if(DBG) Log.d(LOG_TAG, "SimSmsInterfaceManager finalized");
|
||||
}
|
||||
|
||||
@@ -106,7 +110,7 @@ public class SimSmsInterfaceManager extends IccSmsInterfaceManager {
|
||||
updateMessageOnIccEf(int index, int status, byte[] pdu) {
|
||||
if (DBG) log("updateMessageOnIccEf: index=" + index +
|
||||
" status=" + status + " ==> " +
|
||||
"("+ pdu + ")");
|
||||
"("+ Arrays.toString(pdu) + ")");
|
||||
enforceReceiveAndSend("Updating message on SIM");
|
||||
synchronized(mLock) {
|
||||
mSuccess = false;
|
||||
@@ -118,7 +122,7 @@ public class SimSmsInterfaceManager extends IccSmsInterfaceManager {
|
||||
mPhone.mCM.deleteSmsOnSim(index, response);
|
||||
} else {
|
||||
byte[] record = makeSmsRecordData(status, pdu);
|
||||
((SIMFileHandler)mPhone.getIccFileHandler()).updateEFLinearFixed(
|
||||
mPhone.getIccFileHandler().updateEFLinearFixed(
|
||||
IccConstants.EF_SMS,
|
||||
index, record, null, response);
|
||||
}
|
||||
@@ -142,7 +146,8 @@ public class SimSmsInterfaceManager extends IccSmsInterfaceManager {
|
||||
*/
|
||||
public boolean copyMessageToIccEf(int status, byte[] pdu, byte[] smsc) {
|
||||
if (DBG) log("copyMessageToIccEf: status=" + status + " ==> " +
|
||||
"pdu=("+ pdu + "), smsm=(" + smsc +")");
|
||||
"pdu=("+ Arrays.toString(pdu) +
|
||||
"), smsm=(" + Arrays.toString(smsc) +")");
|
||||
enforceReceiveAndSend("Copying message to SIM");
|
||||
synchronized(mLock) {
|
||||
mSuccess = false;
|
||||
@@ -175,8 +180,7 @@ public class SimSmsInterfaceManager extends IccSmsInterfaceManager {
|
||||
"Reading messages from SIM");
|
||||
synchronized(mLock) {
|
||||
Message response = mHandler.obtainMessage(EVENT_LOAD_DONE);
|
||||
((SIMFileHandler)mPhone.getIccFileHandler()).loadEFLinearFixedAll(IccConstants.EF_SMS,
|
||||
response);
|
||||
mPhone.getIccFileHandler().loadEFLinearFixedAll(IccConstants.EF_SMS, response);
|
||||
|
||||
try {
|
||||
mLock.wait();
|
||||
|
||||
Reference in New Issue
Block a user