Telephony: Remove coupling between phone and IccRecords
Change-Id: I7af0f0f37c59b7554fa329a5b00ff28cb149b4d9
This commit is contained in:
committed by
Wink Saville
parent
cdbf566770
commit
80198f2235
@@ -33,7 +33,7 @@ import java.util.Iterator;
|
||||
public final class AdnRecordCache extends Handler implements IccConstants {
|
||||
//***** Instance Variables
|
||||
|
||||
PhoneBase phone;
|
||||
private IccFileHandler mFh;
|
||||
private UsimPhoneBookManager mUsimPhoneBookManager;
|
||||
|
||||
// Indexed by EF ID
|
||||
@@ -56,9 +56,9 @@ public final class AdnRecordCache extends Handler implements IccConstants {
|
||||
|
||||
|
||||
|
||||
public AdnRecordCache(PhoneBase phone) {
|
||||
this.phone = phone;
|
||||
mUsimPhoneBookManager = new UsimPhoneBookManager(phone, this);
|
||||
public AdnRecordCache(IccFileHandler fh) {
|
||||
mFh = fh;
|
||||
mUsimPhoneBookManager = new UsimPhoneBookManager(mFh, this);
|
||||
}
|
||||
|
||||
//***** Called from SIMRecords
|
||||
@@ -155,7 +155,7 @@ public final class AdnRecordCache extends Handler implements IccConstants {
|
||||
|
||||
userWriteResponse.put(efid, response);
|
||||
|
||||
new AdnRecordLoader(phone).updateEF(adn, efid, extensionEF,
|
||||
new AdnRecordLoader(mFh).updateEF(adn, efid, extensionEF,
|
||||
recordIndex, pin2,
|
||||
obtainMessage(EVENT_UPDATE_ADN_DONE, efid, recordIndex, adn));
|
||||
}
|
||||
@@ -233,7 +233,7 @@ public final class AdnRecordCache extends Handler implements IccConstants {
|
||||
|
||||
userWriteResponse.put(efid, response);
|
||||
|
||||
new AdnRecordLoader(phone).updateEF(newAdn, efid, extensionEF,
|
||||
new AdnRecordLoader(mFh).updateEF(newAdn, efid, extensionEF,
|
||||
index, pin2,
|
||||
obtainMessage(EVENT_UPDATE_ADN_DONE, efid, index, newAdn));
|
||||
}
|
||||
@@ -296,7 +296,7 @@ public final class AdnRecordCache extends Handler implements IccConstants {
|
||||
return;
|
||||
}
|
||||
|
||||
new AdnRecordLoader(phone).loadAllFromEF(efid, extensionEf,
|
||||
new AdnRecordLoader(mFh).loadAllFromEF(efid, extensionEf,
|
||||
obtainMessage(EVENT_LOAD_ALL_ADN_LIKE_DONE, efid, 0));
|
||||
}
|
||||
|
||||
|
||||
@@ -20,16 +20,17 @@ import java.util.ArrayList;
|
||||
|
||||
import android.os.AsyncResult;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.os.Message;
|
||||
import android.util.Log;
|
||||
|
||||
|
||||
public class AdnRecordLoader extends Handler {
|
||||
static String LOG_TAG;
|
||||
final static String LOG_TAG = "RIL_AdnRecordLoader";
|
||||
|
||||
//***** Instance Variables
|
||||
|
||||
PhoneBase phone;
|
||||
private IccFileHandler mFh;
|
||||
int ef;
|
||||
int extensionEF;
|
||||
int pendingExtLoads;
|
||||
@@ -56,13 +57,11 @@ public class AdnRecordLoader extends Handler {
|
||||
|
||||
//***** Constructor
|
||||
|
||||
public AdnRecordLoader(PhoneBase phone) {
|
||||
public AdnRecordLoader(IccFileHandler fh) {
|
||||
// The telephony unit-test cases may create AdnRecords
|
||||
// in secondary threads
|
||||
super(phone.getHandler().getLooper());
|
||||
|
||||
this.phone = phone;
|
||||
LOG_TAG = phone.getPhoneName();
|
||||
super(Looper.getMainLooper());
|
||||
mFh = fh;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -77,7 +76,7 @@ public class AdnRecordLoader extends Handler {
|
||||
this.recordNumber = recordNumber;
|
||||
this.userResponse = response;
|
||||
|
||||
phone.mIccFileHandler.loadEFLinearFixed(
|
||||
mFh.loadEFLinearFixed(
|
||||
ef, recordNumber,
|
||||
obtainMessage(EVENT_ADN_LOAD_DONE));
|
||||
|
||||
@@ -95,7 +94,7 @@ public class AdnRecordLoader extends Handler {
|
||||
this.extensionEF = extensionEF;
|
||||
this.userResponse = response;
|
||||
|
||||
phone.mIccFileHandler.loadEFLinearFixedAll(
|
||||
mFh.loadEFLinearFixedAll(
|
||||
ef,
|
||||
obtainMessage(EVENT_ADN_LOAD_ALL_DONE));
|
||||
|
||||
@@ -122,7 +121,7 @@ public class AdnRecordLoader extends Handler {
|
||||
this.userResponse = response;
|
||||
this.pin2 = pin2;
|
||||
|
||||
phone.mIccFileHandler.getEFLinearRecordSize( ef,
|
||||
mFh.getEFLinearRecordSize( ef,
|
||||
obtainMessage(EVENT_EF_LINEAR_RECORD_SIZE_DONE, adn));
|
||||
}
|
||||
|
||||
@@ -163,7 +162,7 @@ public class AdnRecordLoader extends Handler {
|
||||
ar.exception);
|
||||
}
|
||||
|
||||
phone.mIccFileHandler.updateEFLinearFixed(ef, recordNumber,
|
||||
mFh.updateEFLinearFixed(ef, recordNumber,
|
||||
data, pin2, obtainMessage(EVENT_UPDATE_RECORD_DONE));
|
||||
|
||||
pendingExtLoads = 1;
|
||||
@@ -203,7 +202,7 @@ public class AdnRecordLoader extends Handler {
|
||||
|
||||
pendingExtLoads = 1;
|
||||
|
||||
phone.mIccFileHandler.loadEFLinearFixed(
|
||||
mFh.loadEFLinearFixed(
|
||||
extensionEF, adn.extRecord,
|
||||
obtainMessage(EVENT_EXT_RECORD_LOAD_DONE, adn));
|
||||
}
|
||||
@@ -253,7 +252,7 @@ public class AdnRecordLoader extends Handler {
|
||||
|
||||
pendingExtLoads++;
|
||||
|
||||
phone.mIccFileHandler.loadEFLinearFixed(
|
||||
mFh.loadEFLinearFixed(
|
||||
extensionEF, adn.extRecord,
|
||||
obtainMessage(EVENT_EXT_RECORD_LOAD_DONE, adn));
|
||||
}
|
||||
|
||||
@@ -185,13 +185,14 @@ public class IccCard {
|
||||
mPhone.mCM, mHandler, EVENT_CDMA_SUBSCRIPTION_SOURCE_CHANGED, null);
|
||||
if (phone.mCM.getLteOnCdmaMode() == Phone.LTE_ON_CDMA_TRUE
|
||||
&& phone instanceof CDMALTEPhone) {
|
||||
mIccRecords = new CdmaLteUiccRecords(phone);
|
||||
mIccFileHandler = new CdmaLteUiccFileHandler(this, "", mPhone.mCM);
|
||||
mIccRecords = new CdmaLteUiccRecords(this, mPhone.mContext, mPhone.mCM);
|
||||
} else {
|
||||
mIccRecords = is3gpp ? new SIMRecords(phone) : new RuimRecords(phone);
|
||||
// Correct aid will be set later (when GET_SIM_STATUS returns)
|
||||
mIccFileHandler = is3gpp ? new SIMFileHandler(this, "", mPhone.mCM) :
|
||||
new RuimFileHandler(this, "", mPhone.mCM);
|
||||
mIccRecords = is3gpp ? new SIMRecords(this, mPhone.mContext, mPhone.mCM) :
|
||||
new RuimRecords(this, mPhone.mContext, mPhone.mCM);
|
||||
}
|
||||
mPhone.mCM.registerForOffOrNotAvailable(mHandler, EVENT_RADIO_OFF_OR_NOT_AVAILABLE, null);
|
||||
mPhone.mCM.registerForOn(mHandler, EVENT_RADIO_ON, null);
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package com.android.internal.telephony;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.AsyncResult;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
@@ -32,9 +33,16 @@ public abstract class IccRecords extends Handler implements IccConstants {
|
||||
|
||||
protected static final boolean DBG = true;
|
||||
// ***** Instance Variables
|
||||
protected boolean mDestroyed = false; // set to true once this object needs to be disposed of
|
||||
protected Context mContext;
|
||||
protected CommandsInterface mCi;
|
||||
protected IccFileHandler mFh;
|
||||
protected IccCard mParentCard;
|
||||
|
||||
protected PhoneBase phone;
|
||||
protected RegistrantList recordsLoadedRegistrants = new RegistrantList();
|
||||
protected RegistrantList mRecordsEventsRegistrants = new RegistrantList();
|
||||
protected RegistrantList mNewSmsRegistrants = new RegistrantList();
|
||||
protected RegistrantList mNetworkSelectionModeAutomaticRegistrants = new RegistrantList();
|
||||
|
||||
protected int recordsToLoad; // number of pending load requests
|
||||
|
||||
@@ -71,6 +79,9 @@ public abstract class IccRecords extends Handler implements IccConstants {
|
||||
|
||||
// ***** Event Constants
|
||||
protected static final int EVENT_SET_MSISDN_DONE = 30;
|
||||
public static final int EVENT_MWI = 0;
|
||||
public static final int EVENT_CFI = 1;
|
||||
public static final int EVENT_SPN = 2;
|
||||
|
||||
public static final int EVENT_GET_ICC_RECORD_DONE = 100;
|
||||
|
||||
@@ -91,15 +102,23 @@ public abstract class IccRecords extends Handler implements IccConstants {
|
||||
}
|
||||
|
||||
// ***** Constructor
|
||||
|
||||
public IccRecords(PhoneBase p) {
|
||||
this.phone = p;
|
||||
public IccRecords(IccCard card, Context c, CommandsInterface ci) {
|
||||
mContext = c;
|
||||
mCi = ci;
|
||||
mFh = card.getIccFileHandler();
|
||||
mParentCard = card;
|
||||
}
|
||||
|
||||
/**
|
||||
* Call when the IccRecords object is no longer going to be used.
|
||||
*/
|
||||
public abstract void dispose();
|
||||
public void dispose() {
|
||||
mDestroyed = true;
|
||||
mParentCard = null;
|
||||
mFh = null;
|
||||
mCi = null;
|
||||
mContext = null;
|
||||
}
|
||||
|
||||
protected abstract void onRadioOffOrNotAvailable();
|
||||
public abstract void onReady();
|
||||
@@ -109,7 +128,15 @@ public abstract class IccRecords extends Handler implements IccConstants {
|
||||
return adnCache;
|
||||
}
|
||||
|
||||
public IccCard getIccCard() {
|
||||
return mParentCard;
|
||||
}
|
||||
|
||||
public void registerForRecordsLoaded(Handler h, int what, Object obj) {
|
||||
if (mDestroyed) {
|
||||
return;
|
||||
}
|
||||
|
||||
Registrant r = new Registrant(h, what, obj);
|
||||
recordsLoadedRegistrants.add(r);
|
||||
|
||||
@@ -117,11 +144,35 @@ public abstract class IccRecords extends Handler implements IccConstants {
|
||||
r.notifyRegistrant(new AsyncResult(null, null, null));
|
||||
}
|
||||
}
|
||||
|
||||
public void unregisterForRecordsLoaded(Handler h) {
|
||||
recordsLoadedRegistrants.remove(h);
|
||||
}
|
||||
|
||||
public void registerForRecordsEvents(Handler h, int what, Object obj) {
|
||||
Registrant r = new Registrant (h, what, obj);
|
||||
mRecordsEventsRegistrants.add(r);
|
||||
}
|
||||
public void unregisterForRecordsEvents(Handler h) {
|
||||
mRecordsEventsRegistrants.remove(h);
|
||||
}
|
||||
|
||||
public void registerForNewSms(Handler h, int what, Object obj) {
|
||||
Registrant r = new Registrant (h, what, obj);
|
||||
mNewSmsRegistrants.add(r);
|
||||
}
|
||||
public void unregisterForNewSms(Handler h) {
|
||||
mNewSmsRegistrants.remove(h);
|
||||
}
|
||||
|
||||
public void registerForNetworkSelectionModeAutomatic(
|
||||
Handler h, int what, Object obj) {
|
||||
Registrant r = new Registrant (h, what, obj);
|
||||
mNetworkSelectionModeAutomaticRegistrants.add(r);
|
||||
}
|
||||
public void unregisterForNetworkSelectionModeAutomatic(Handler h) {
|
||||
mNetworkSelectionModeAutomaticRegistrants.remove(h);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the International Mobile Subscriber ID (IMSI) on a SIM
|
||||
* for GSM, UMTS and like networks. Default is null if IMSI is
|
||||
@@ -163,7 +214,7 @@ public abstract class IccRecords extends Handler implements IccConstants {
|
||||
|
||||
AdnRecord adn = new AdnRecord(msisdnTag, msisdn);
|
||||
|
||||
new AdnRecordLoader(phone).updateEF(adn, EF_MSISDN, EF_EXT1, 1, null,
|
||||
new AdnRecordLoader(mFh).updateEF(adn, EF_MSISDN, EF_EXT1, 1, null,
|
||||
obtainMessage(EVENT_SET_MSISDN_DONE, onComplete));
|
||||
}
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ package com.android.internal.telephony;
|
||||
|
||||
import android.app.ActivityManagerNative;
|
||||
import android.app.AlarmManager;
|
||||
import android.app.IActivityManager;
|
||||
import android.content.Context;
|
||||
import android.content.res.Configuration;
|
||||
import android.net.wifi.WifiManager;
|
||||
@@ -167,10 +168,10 @@ public final class MccTable
|
||||
/**
|
||||
* Updates MCC and MNC device configuration information for application retrieving
|
||||
* correct version of resources. If either MCC or MNC is 0, they will be ignored (not set).
|
||||
* @param phone PhoneBae to act on.
|
||||
* @param context Context to act on.
|
||||
* @param mccmnc truncated imsi with just the MCC and MNC - MNC assumed to be from 4th to end
|
||||
*/
|
||||
public static void updateMccMncConfiguration(PhoneBase phone, String mccmnc) {
|
||||
public static void updateMccMncConfiguration(Context context, String mccmnc) {
|
||||
if (!TextUtils.isEmpty(mccmnc)) {
|
||||
int mcc, mnc;
|
||||
|
||||
@@ -185,9 +186,9 @@ public final class MccTable
|
||||
Log.d(LOG_TAG, "updateMccMncConfiguration: mcc=" + mcc + ", mnc=" + mnc);
|
||||
|
||||
if (mcc != 0) {
|
||||
setTimezoneFromMccIfNeeded(phone, mcc);
|
||||
setLocaleFromMccIfNeeded(phone, mcc);
|
||||
setWifiCountryCodeFromMcc(phone, mcc);
|
||||
setTimezoneFromMccIfNeeded(context, mcc);
|
||||
setLocaleFromMccIfNeeded(context, mcc);
|
||||
setWifiCountryCodeFromMcc(context, mcc);
|
||||
}
|
||||
try {
|
||||
Configuration config = ActivityManagerNative.getDefault().getConfiguration();
|
||||
@@ -204,17 +205,69 @@ public final class MccTable
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Utility code to set the system locale if it's not set already
|
||||
* @param context Context to act on.
|
||||
* @param language Two character language code desired
|
||||
* @param country Two character country code desired
|
||||
*
|
||||
* {@hide}
|
||||
*/
|
||||
public static void setSystemLocale(Context context, String language, String country) {
|
||||
String l = SystemProperties.get("persist.sys.language");
|
||||
String c = SystemProperties.get("persist.sys.country");
|
||||
|
||||
if (null == language) {
|
||||
return; // no match possible
|
||||
}
|
||||
language = language.toLowerCase();
|
||||
if (null == country) {
|
||||
country = "";
|
||||
}
|
||||
country = country.toUpperCase();
|
||||
|
||||
if((null == l || 0 == l.length()) && (null == c || 0 == c.length())) {
|
||||
try {
|
||||
// try to find a good match
|
||||
String[] locales = context.getAssets().getLocales();
|
||||
final int N = locales.length;
|
||||
String bestMatch = null;
|
||||
for(int i = 0; i < N; i++) {
|
||||
// only match full (lang + country) locales
|
||||
if (locales[i]!=null && locales[i].length() >= 5 &&
|
||||
locales[i].substring(0,2).equals(language)) {
|
||||
if (locales[i].substring(3,5).equals(country)) {
|
||||
bestMatch = locales[i];
|
||||
break;
|
||||
} else if (null == bestMatch) {
|
||||
bestMatch = locales[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
if (null != bestMatch) {
|
||||
IActivityManager am = ActivityManagerNative.getDefault();
|
||||
Configuration config = am.getConfiguration();
|
||||
config.locale = new Locale(bestMatch.substring(0,2),
|
||||
bestMatch.substring(3,5));
|
||||
config.userSetLocale = true;
|
||||
am.updateConfiguration(config);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// Intentionally left blank
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* If the timezone is not already set, set it based on the MCC of the SIM.
|
||||
* @param phone PhoneBase to act on (get context from).
|
||||
* @param context Context to act on.
|
||||
* @param mcc Mobile Country Code of the SIM or SIM-like entity (build prop on CDMA)
|
||||
*/
|
||||
private static void setTimezoneFromMccIfNeeded(PhoneBase phone, int mcc) {
|
||||
private static void setTimezoneFromMccIfNeeded(Context context, int mcc) {
|
||||
String timezone = SystemProperties.get(ServiceStateTracker.TIMEZONE_PROPERTY);
|
||||
if (timezone == null || timezone.length() == 0) {
|
||||
String zoneId = defaultTimeZoneForMcc(mcc);
|
||||
if (zoneId != null && zoneId.length() > 0) {
|
||||
Context context = phone.getContext();
|
||||
// Set time zone based on MCC
|
||||
AlarmManager alarm =
|
||||
(AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
|
||||
@@ -226,27 +279,31 @@ public final class MccTable
|
||||
|
||||
/**
|
||||
* If the locale is not already set, set it based on the MCC of the SIM.
|
||||
* @param phone PhoneBase to act on.
|
||||
* @param context Context to act on.
|
||||
* @param mcc Mobile Country Code of the SIM or SIM-like entity (build prop on CDMA)
|
||||
*/
|
||||
private static void setLocaleFromMccIfNeeded(PhoneBase phone, int mcc) {
|
||||
private static void setLocaleFromMccIfNeeded(Context context, int mcc) {
|
||||
if (BaseCommands.getLteOnCdmaModeStatic() == Phone.LTE_ON_CDMA_TRUE) {
|
||||
// Avoid system locale is set from MCC table if CDMALTEPhone is used.
|
||||
// The locale will be picked up based on EFpl/EFli once CSIM records are loaded.
|
||||
return;
|
||||
}
|
||||
String language = MccTable.defaultLanguageForMcc(mcc);
|
||||
String country = MccTable.countryCodeForMcc(mcc);
|
||||
|
||||
Log.d(LOG_TAG, "locale set to "+language+"_"+country);
|
||||
phone.setSystemLocale(language, country, true);
|
||||
setSystemLocale(context, language, country);
|
||||
}
|
||||
|
||||
/**
|
||||
* If the number of allowed wifi channels has not been set, set it based on
|
||||
* the MCC of the SIM.
|
||||
* @param phone PhoneBase to act on (get context from).
|
||||
* @param context Context to act on.
|
||||
* @param mcc Mobile Country Code of the SIM or SIM-like entity (build prop on CDMA)
|
||||
*/
|
||||
private static void setWifiCountryCodeFromMcc(PhoneBase phone, int mcc) {
|
||||
private static void setWifiCountryCodeFromMcc(Context context, int mcc) {
|
||||
String country = MccTable.countryCodeForMcc(mcc);
|
||||
if (!country.isEmpty()) {
|
||||
Context context = phone.getContext();
|
||||
Log.d(LOG_TAG, "WIFI_COUNTRY_CODE set to " + country);
|
||||
WifiManager wM = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
|
||||
//persist
|
||||
|
||||
@@ -103,6 +103,10 @@ public abstract class PhoneBase extends Handler implements Phone {
|
||||
protected static final int EVENT_EMERGENCY_CALLBACK_MODE_ENTER = 25;
|
||||
protected static final int EVENT_EXIT_EMERGENCY_CALLBACK_RESPONSE = 26;
|
||||
protected static final int EVENT_CDMA_SUBSCRIPTION_SOURCE_CHANGED = 27;
|
||||
// other
|
||||
protected static final int EVENT_SET_NETWORK_AUTOMATIC = 28;
|
||||
protected static final int EVENT_NEW_ICC_SMS = 29;
|
||||
protected static final int EVENT_ICC_RECORD_EVENTS = 30;
|
||||
|
||||
// Key used to read/write current CLIR setting
|
||||
public static final String CLIR_KEY = "clir_key";
|
||||
@@ -600,7 +604,7 @@ public abstract class PhoneBase extends Handler implements Phone {
|
||||
if (l.length() >=5) {
|
||||
country = l.substring(3, 5);
|
||||
}
|
||||
setSystemLocale(language, country, false);
|
||||
MccTable.setSystemLocale(mContext, language, country);
|
||||
|
||||
if (!country.isEmpty()) {
|
||||
try {
|
||||
@@ -618,62 +622,6 @@ public abstract class PhoneBase extends Handler implements Phone {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Utility code to set the system locale if it's not set already
|
||||
* @param language Two character language code desired
|
||||
* @param country Two character country code desired
|
||||
* @param fromMcc Indicating whether the locale is set according to MCC table.
|
||||
* This flag wil be ignored by default implementation.
|
||||
* TODO: Use a source enumeration so that source of the locale
|
||||
* can be prioritized.
|
||||
*
|
||||
* {@hide}
|
||||
*/
|
||||
public void setSystemLocale(String language, String country, boolean fromMcc) {
|
||||
String l = SystemProperties.get("persist.sys.language");
|
||||
String c = SystemProperties.get("persist.sys.country");
|
||||
|
||||
if (null == language) {
|
||||
return; // no match possible
|
||||
}
|
||||
language = language.toLowerCase();
|
||||
if (null == country) {
|
||||
country = "";
|
||||
}
|
||||
country = country.toUpperCase();
|
||||
|
||||
if((null == l || 0 == l.length()) && (null == c || 0 == c.length())) {
|
||||
try {
|
||||
// try to find a good match
|
||||
String[] locales = mContext.getAssets().getLocales();
|
||||
final int N = locales.length;
|
||||
String bestMatch = null;
|
||||
for(int i = 0; i < N; i++) {
|
||||
// only match full (lang + country) locales
|
||||
if (locales[i]!=null && locales[i].length() >= 5 &&
|
||||
locales[i].substring(0,2).equals(language)) {
|
||||
if (locales[i].substring(3,5).equals(country)) {
|
||||
bestMatch = locales[i];
|
||||
break;
|
||||
} else if (null == bestMatch) {
|
||||
bestMatch = locales[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
if (null != bestMatch) {
|
||||
IActivityManager am = ActivityManagerNative.getDefault();
|
||||
Configuration config = am.getConfiguration();
|
||||
config.locale = new Locale(bestMatch.substring(0,2),
|
||||
bestMatch.substring(3,5));
|
||||
config.userSetLocale = true;
|
||||
am.updateConfiguration(config);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// Intentionally left blank
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get state
|
||||
*/
|
||||
|
||||
@@ -35,6 +35,7 @@ import com.android.internal.telephony.PhoneNotifier;
|
||||
import com.android.internal.telephony.PhoneProxy;
|
||||
import com.android.internal.telephony.SMSDispatcher;
|
||||
import com.android.internal.telephony.gsm.GsmSMSDispatcher;
|
||||
import com.android.internal.telephony.gsm.SmsMessage;
|
||||
import com.android.internal.telephony.ims.IsimRecords;
|
||||
import com.android.internal.telephony.uicc.UiccController;
|
||||
|
||||
@@ -62,17 +63,21 @@ public class CDMALTEPhone extends CDMAPhone {
|
||||
public CDMALTEPhone(Context context, CommandsInterface ci, PhoneNotifier notifier) {
|
||||
super(context, ci, notifier, false);
|
||||
m3gppSMS = new GsmSMSDispatcher(this, mSmsStorageMonitor, mSmsUsageMonitor);
|
||||
mIccRecords.registerForNewSms(this, EVENT_NEW_ICC_SMS, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleMessage (Message msg) {
|
||||
AsyncResult ar;
|
||||
Message onComplete;
|
||||
switch (msg.what) {
|
||||
// handle the select network completion callbacks.
|
||||
case EVENT_SET_NETWORK_MANUAL_COMPLETE:
|
||||
handleSetSelectNetwork((AsyncResult) msg.obj);
|
||||
break;
|
||||
case EVENT_NEW_ICC_SMS:
|
||||
ar = (AsyncResult)msg.obj;
|
||||
m3gppSMS.dispatchMessage((SmsMessage)ar.result);
|
||||
break;
|
||||
default:
|
||||
super.handleMessage(msg);
|
||||
}
|
||||
@@ -93,6 +98,7 @@ public class CDMALTEPhone extends CDMAPhone {
|
||||
synchronized(PhoneProxy.lockForRadioTechnologyChange) {
|
||||
super.dispose();
|
||||
m3gppSMS.dispose();
|
||||
mIccRecords.unregisterForNewSms(this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -214,15 +220,6 @@ public class CDMALTEPhone extends CDMAPhone {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSystemLocale(String language, String country, boolean fromMcc) {
|
||||
// Avoid system locale is set from MCC table if CDMALTEPhone is used.
|
||||
// The locale will be picked up based on EFpl/EFli once CSIM records are loaded.
|
||||
if (fromMcc) return;
|
||||
|
||||
super.setSystemLocale(language, country, false);
|
||||
}
|
||||
|
||||
// return IMSI from USIM as subscriber ID.
|
||||
@Override
|
||||
public String getSubscriberId() {
|
||||
|
||||
@@ -173,7 +173,7 @@ public class CDMAPhone extends PhoneBase {
|
||||
mIccFileHandler, mIccCard);
|
||||
|
||||
mCM.registerForAvailable(this, EVENT_RADIO_AVAILABLE, null);
|
||||
mIccRecords.registerForRecordsLoaded(this, EVENT_RUIM_RECORDS_LOADED, null);
|
||||
registerForRuimRecordEvents();
|
||||
mCM.registerForOffOrNotAvailable(this, EVENT_RADIO_OFF_OR_NOT_AVAILABLE, null);
|
||||
mCM.registerForOn(this, EVENT_RADIO_ON, null);
|
||||
mCM.setOnSuppServiceNotification(this, EVENT_SSN, null);
|
||||
@@ -225,7 +225,7 @@ public class CDMAPhone extends PhoneBase {
|
||||
log("dispose");
|
||||
|
||||
//Unregister from all former registered events
|
||||
mIccRecords.unregisterForRecordsLoaded(this); //EVENT_RUIM_RECORDS_LOADED
|
||||
unregisterForRuimRecordEvents();
|
||||
mCM.unregisterForAvailable(this); //EVENT_RADIO_AVAILABLE
|
||||
mCM.unregisterForOffOrNotAvailable(this); //EVENT_RADIO_OFF_OR_NOT_AVAILABLE
|
||||
mCM.unregisterForOn(this); //EVENT_RADIO_ON
|
||||
@@ -241,8 +241,6 @@ public class CDMAPhone extends PhoneBase {
|
||||
mSST.dispose();
|
||||
mCdmaSSM.dispose(this);
|
||||
mSMS.dispose();
|
||||
mIccFileHandler.dispose(); // instance of RuimFileHandler
|
||||
mIccRecords.dispose();
|
||||
mRuimPhoneBookInterfaceManager.dispose();
|
||||
mRuimSmsInterfaceManager.dispose();
|
||||
mSubInfo.dispose();
|
||||
@@ -999,6 +997,11 @@ public class CDMAPhone extends PhoneBase {
|
||||
}
|
||||
break;
|
||||
|
||||
case EVENT_ICC_RECORD_EVENTS:
|
||||
ar = (AsyncResult)msg.obj;
|
||||
processIccRecordEvents((Integer)ar.result);
|
||||
break;
|
||||
|
||||
case EVENT_EXIT_EMERGENCY_CALLBACK_RESPONSE:{
|
||||
handleExitEmergencyCallbackMode(msg);
|
||||
}
|
||||
@@ -1063,10 +1066,22 @@ public class CDMAPhone extends PhoneBase {
|
||||
}
|
||||
}
|
||||
|
||||
private void processIccRecordEvents(int eventCode) {
|
||||
switch (eventCode) {
|
||||
case RuimRecords.EVENT_MWI:
|
||||
notifyMessageWaitingIndicator();
|
||||
break;
|
||||
|
||||
default:
|
||||
Log.e(LOG_TAG,"Unknown icc records event code " + eventCode);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles the call to get the subscription source
|
||||
*
|
||||
* @param holds the new CDMA subscription source value
|
||||
* @param newSubscriptionSource holds the new CDMA subscription source value
|
||||
*/
|
||||
private void handleCdmaSubscriptionSource(int newSubscriptionSource) {
|
||||
if (newSubscriptionSource != mCdmaSubscriptionSource) {
|
||||
@@ -1423,7 +1438,7 @@ public class CDMAPhone extends PhoneBase {
|
||||
getContext().getContentResolver().insert(uri, map);
|
||||
|
||||
// Updates MCC MNC device configuration information
|
||||
MccTable.updateMccMncConfiguration(this, operatorNumeric);
|
||||
MccTable.updateMccMncConfiguration(mContext, operatorNumeric);
|
||||
|
||||
return true;
|
||||
} catch (SQLException e) {
|
||||
@@ -1456,6 +1471,16 @@ public class CDMAPhone extends PhoneBase {
|
||||
return mEriManager.isEriFileLoaded();
|
||||
}
|
||||
|
||||
private void registerForRuimRecordEvents() {
|
||||
mIccRecords.registerForRecordsEvents(this, EVENT_ICC_RECORD_EVENTS, null);
|
||||
mIccRecords.registerForRecordsLoaded(this, EVENT_RUIM_RECORDS_LOADED, null);
|
||||
}
|
||||
|
||||
private void unregisterForRuimRecordEvents() {
|
||||
mIccRecords.unregisterForRecordsEvents(this);
|
||||
mIccRecords.unregisterForRecordsLoaded(this);
|
||||
}
|
||||
|
||||
protected void log(String s) {
|
||||
if (DBG)
|
||||
Log.d(LOG_TAG, "[CDMAPhone] " + s);
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package com.android.internal.telephony.cdma;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.AsyncResult;
|
||||
import android.os.SystemProperties;
|
||||
import android.util.Log;
|
||||
@@ -22,6 +23,8 @@ import android.util.Log;
|
||||
import com.android.internal.telephony.AdnRecordLoader;
|
||||
import com.android.internal.telephony.GsmAlphabet;
|
||||
import com.android.internal.telephony.IccCardApplication.AppType;
|
||||
import com.android.internal.telephony.CommandsInterface;
|
||||
import com.android.internal.telephony.IccCard;
|
||||
import com.android.internal.telephony.IccFileHandler;
|
||||
import com.android.internal.telephony.IccUtils;
|
||||
import com.android.internal.telephony.MccTable;
|
||||
@@ -54,8 +57,8 @@ public final class CdmaLteUiccRecords extends SIMRecords {
|
||||
|
||||
private final IsimUiccRecords mIsimUiccRecords = new IsimUiccRecords();
|
||||
|
||||
public CdmaLteUiccRecords(PhoneBase p) {
|
||||
super(p);
|
||||
public CdmaLteUiccRecords(IccCard card, Context c, CommandsInterface ci) {
|
||||
super(card, c, ci);
|
||||
}
|
||||
|
||||
// Refer to ETSI TS 102.221
|
||||
@@ -146,7 +149,7 @@ public final class CdmaLteUiccRecords extends SIMRecords {
|
||||
}
|
||||
if (DBG) log("spn=" + spn);
|
||||
if (DBG) log("spnCondition=" + mCsimSpnDisplayCondition);
|
||||
phone.setSystemProperty(PROPERTY_ICC_OPERATOR_ALPHA, spn);
|
||||
SystemProperties.set(PROPERTY_ICC_OPERATOR_ALPHA, spn);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -262,55 +265,54 @@ public final class CdmaLteUiccRecords extends SIMRecords {
|
||||
|
||||
@Override
|
||||
protected void fetchSimRecords() {
|
||||
IccFileHandler iccFh = phone.getIccFileHandler();
|
||||
recordsRequested = true;
|
||||
|
||||
phone.mCM.getIMSI(obtainMessage(EVENT_GET_IMSI_DONE));
|
||||
mCi.getIMSIForApp(mParentCard.getAid(), obtainMessage(EVENT_GET_IMSI_DONE));
|
||||
recordsToLoad++;
|
||||
|
||||
iccFh.loadEFTransparent(EF_ICCID, obtainMessage(EVENT_GET_ICCID_DONE));
|
||||
mFh.loadEFTransparent(EF_ICCID, obtainMessage(EVENT_GET_ICCID_DONE));
|
||||
recordsToLoad++;
|
||||
|
||||
iccFh.loadEFTransparent(EF_AD, obtainMessage(EVENT_GET_AD_DONE));
|
||||
mFh.loadEFTransparent(EF_AD, obtainMessage(EVENT_GET_AD_DONE));
|
||||
recordsToLoad++;
|
||||
|
||||
iccFh.loadEFTransparent(EF_PL,
|
||||
mFh.loadEFTransparent(EF_PL,
|
||||
obtainMessage(EVENT_GET_ICC_RECORD_DONE, new EfPlLoaded()));
|
||||
recordsToLoad++;
|
||||
|
||||
new AdnRecordLoader(phone).loadFromEF(EF_MSISDN, EF_EXT1, 1,
|
||||
new AdnRecordLoader(mFh).loadFromEF(EF_MSISDN, EF_EXT1, 1,
|
||||
obtainMessage(EVENT_GET_MSISDN_DONE));
|
||||
recordsToLoad++;
|
||||
|
||||
iccFh.loadEFTransparent(EF_SST, obtainMessage(EVENT_GET_SST_DONE));
|
||||
mFh.loadEFTransparent(EF_SST, obtainMessage(EVENT_GET_SST_DONE));
|
||||
recordsToLoad++;
|
||||
|
||||
iccFh.loadEFTransparent(EF_CSIM_LI,
|
||||
mFh.loadEFTransparent(EF_CSIM_LI,
|
||||
obtainMessage(EVENT_GET_ICC_RECORD_DONE, new EfCsimLiLoaded()));
|
||||
recordsToLoad++;
|
||||
|
||||
iccFh.loadEFTransparent(EF_CSIM_SPN,
|
||||
mFh.loadEFTransparent(EF_CSIM_SPN,
|
||||
obtainMessage(EVENT_GET_ICC_RECORD_DONE, new EfCsimSpnLoaded()));
|
||||
recordsToLoad++;
|
||||
|
||||
iccFh.loadEFLinearFixed(EF_CSIM_MDN, 1,
|
||||
mFh.loadEFLinearFixed(EF_CSIM_MDN, 1,
|
||||
obtainMessage(EVENT_GET_ICC_RECORD_DONE, new EfCsimMdnLoaded()));
|
||||
recordsToLoad++;
|
||||
|
||||
iccFh.loadEFTransparent(EF_CSIM_IMSIM,
|
||||
mFh.loadEFTransparent(EF_CSIM_IMSIM,
|
||||
obtainMessage(EVENT_GET_ICC_RECORD_DONE, new EfCsimImsimLoaded()));
|
||||
recordsToLoad++;
|
||||
|
||||
iccFh.loadEFLinearFixedAll(EF_CSIM_CDMAHOME,
|
||||
mFh.loadEFLinearFixedAll(EF_CSIM_CDMAHOME,
|
||||
obtainMessage(EVENT_GET_ICC_RECORD_DONE, new EfCsimCdmaHomeLoaded()));
|
||||
recordsToLoad++;
|
||||
|
||||
iccFh.loadEFTransparent(EF_CSIM_EPRL,
|
||||
mFh.loadEFTransparent(EF_CSIM_EPRL,
|
||||
obtainMessage(EVENT_GET_ICC_RECORD_DONE, new EfCsimEprlLoaded()));
|
||||
recordsToLoad++;
|
||||
|
||||
// load ISIM records
|
||||
recordsToLoad += mIsimUiccRecords.fetchIsimRecords(iccFh, this);
|
||||
recordsToLoad += mIsimUiccRecords.fetchIsimRecords(mFh, this);
|
||||
}
|
||||
|
||||
private int adjstMinDigits (int digits) {
|
||||
@@ -354,7 +356,7 @@ public final class CdmaLteUiccRecords extends SIMRecords {
|
||||
Integer.parseInt(imsi.substring(0,3)));
|
||||
}
|
||||
log("Setting locale to " + prefLang + "_" + country);
|
||||
phone.setSystemLocale(prefLang, country, false);
|
||||
MccTable.setSystemLocale(mContext, prefLang, country);
|
||||
} else {
|
||||
log ("No suitable CSIM selected locale");
|
||||
}
|
||||
@@ -362,7 +364,7 @@ public final class CdmaLteUiccRecords extends SIMRecords {
|
||||
|
||||
private String findBestLanguage(byte[] languages) {
|
||||
String bestMatch = null;
|
||||
String[] locales = phone.getContext().getAssets().getLocales();
|
||||
String[] locales = mContext.getAssets().getLocales();
|
||||
|
||||
if ((languages == null) || (locales == null)) return null;
|
||||
|
||||
@@ -436,23 +438,14 @@ public final class CdmaLteUiccRecords extends SIMRecords {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (phone == null || phone.mIccCard == null) {
|
||||
if (mParentCard == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (phone.mIccCard.isApplicationOnIcc(AppType.APPTYPE_CSIM) &&
|
||||
if (mParentCard.isApplicationOnIcc(AppType.APPTYPE_CSIM) &&
|
||||
((mMdn == null) || (mMin == null))) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Dispatch 3GPP format message. For CDMA/LTE phones,
|
||||
* send the message to the secondary 3GPP format SMS dispatcher.
|
||||
*/
|
||||
@Override
|
||||
protected int dispatchGsmMessage(SmsMessageBase message) {
|
||||
return ((CDMALTEPhone) phone).m3gppSMS.dispatchMessage(message);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,9 +45,6 @@ public final class RuimFileHandler extends IccFileHandler {
|
||||
super(card, aid, ci);
|
||||
}
|
||||
|
||||
public void dispose() {
|
||||
}
|
||||
|
||||
protected void finalize() {
|
||||
Log.d(LOG_TAG, "RuimFileHandler finalized");
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ package com.android.internal.telephony.cdma;
|
||||
|
||||
import static com.android.internal.telephony.TelephonyProperties.PROPERTY_ICC_OPERATOR_ISO_COUNTRY;
|
||||
import static com.android.internal.telephony.TelephonyProperties.PROPERTY_ICC_OPERATOR_NUMERIC;
|
||||
import android.content.Context;
|
||||
import android.os.AsyncResult;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
@@ -78,19 +79,19 @@ public final class RuimRecords extends IccRecords {
|
||||
private static final int EVENT_RUIM_REFRESH = 31;
|
||||
|
||||
|
||||
public RuimRecords(PhoneBase p) {
|
||||
super(p);
|
||||
public RuimRecords(IccCard card, Context c, CommandsInterface ci) {
|
||||
super(card, c, ci);
|
||||
|
||||
adnCache = new AdnRecordCache(phone);
|
||||
adnCache = new AdnRecordCache(mFh);
|
||||
|
||||
recordsRequested = false; // No load request is made till SIM ready
|
||||
|
||||
// recordsToLoad is set to 0 because no requests are made yet
|
||||
recordsToLoad = 0;
|
||||
|
||||
p.mCM.registerForOffOrNotAvailable(this, EVENT_RADIO_OFF_OR_NOT_AVAILABLE, null);
|
||||
mCi.registerForOffOrNotAvailable(this, EVENT_RADIO_OFF_OR_NOT_AVAILABLE, null);
|
||||
// NOTE the EVENT_SMS_ON_RUIM is not registered
|
||||
p.mCM.registerForIccRefresh(this, EVENT_RUIM_REFRESH, null);
|
||||
mCi.registerForIccRefresh(this, EVENT_RUIM_REFRESH, null);
|
||||
|
||||
// Start off by setting empty state
|
||||
onRadioOffOrNotAvailable();
|
||||
@@ -99,9 +100,11 @@ public final class RuimRecords extends IccRecords {
|
||||
|
||||
@Override
|
||||
public void dispose() {
|
||||
if (DBG) log("Disposing RuimRecords " + this);
|
||||
//Unregister for all events
|
||||
phone.mCM.unregisterForOffOrNotAvailable( this);
|
||||
phone.mCM.unregisterForIccRefresh(this);
|
||||
mCi.unregisterForOffOrNotAvailable( this);
|
||||
mCi.unregisterForIccRefresh(this);
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -196,7 +199,7 @@ public final class RuimRecords extends IccRecords {
|
||||
|
||||
boolean isRecordLoadResponse = false;
|
||||
|
||||
if (!phone.mIsTheCurrentActivePhone) {
|
||||
if (mDestroyed) {
|
||||
loge("Received message " + msg +
|
||||
"[" + msg.what + "] while being destroyed. Ignoring.");
|
||||
return;
|
||||
@@ -235,7 +238,7 @@ public final class RuimRecords extends IccRecords {
|
||||
String operatorNumeric = getRUIMOperatorNumeric();
|
||||
if (operatorNumeric != null) {
|
||||
if(operatorNumeric.length() <= 6){
|
||||
MccTable.updateMccMncConfiguration(phone, operatorNumeric);
|
||||
MccTable.updateMccMncConfiguration(mContext, operatorNumeric);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -314,6 +317,7 @@ public final class RuimRecords extends IccRecords {
|
||||
// One record loaded successfully or failed, In either case
|
||||
// we need to update the recordsToLoad count
|
||||
recordsToLoad -= 1;
|
||||
if (DBG) log("RuimRecords:onRecordLoaded " + recordsToLoad + " requested: " + recordsRequested);
|
||||
|
||||
if (recordsToLoad == 0 && recordsRequested == true) {
|
||||
onAllRecordsLoaded();
|
||||
@@ -338,7 +342,7 @@ public final class RuimRecords extends IccRecords {
|
||||
}
|
||||
recordsLoadedRegistrants.notifyRegistrants(
|
||||
new AsyncResult(null, null, null));
|
||||
phone.mIccCard.broadcastIccStateChangedIntent(
|
||||
mParentCard.broadcastIccStateChangedIntent(
|
||||
IccCard.INTENT_VALUE_ICC_LOADED, null);
|
||||
}
|
||||
|
||||
@@ -348,13 +352,12 @@ public final class RuimRecords extends IccRecords {
|
||||
READY is sent before IMSI ready
|
||||
*/
|
||||
|
||||
phone.mIccCard.broadcastIccStateChangedIntent(
|
||||
mParentCard.broadcastIccStateChangedIntent(
|
||||
IccCard.INTENT_VALUE_ICC_READY, null);
|
||||
|
||||
fetchRuimRecords();
|
||||
|
||||
phone.mCM.getCDMASubscription(obtainMessage(EVENT_GET_CDMA_SUBSCRIPTION_DONE));
|
||||
|
||||
mCi.getCDMASubscription(obtainMessage(EVENT_GET_CDMA_SUBSCRIPTION_DONE));
|
||||
}
|
||||
|
||||
|
||||
@@ -363,13 +366,14 @@ public final class RuimRecords extends IccRecords {
|
||||
|
||||
Log.v(LOG_TAG, "RuimRecords:fetchRuimRecords " + recordsToLoad);
|
||||
|
||||
phone.mCM.getIMSI(obtainMessage(EVENT_GET_IMSI_DONE));
|
||||
mCi.getIMSI(obtainMessage(EVENT_GET_IMSI_DONE));
|
||||
recordsToLoad++;
|
||||
|
||||
phone.getIccFileHandler().loadEFTransparent(EF_ICCID,
|
||||
mFh.loadEFTransparent(EF_ICCID,
|
||||
obtainMessage(EVENT_GET_ICCID_DONE));
|
||||
recordsToLoad++;
|
||||
|
||||
log("RuimRecords:fetchRuimRecords " + recordsToLoad + " requested: " + recordsRequested);
|
||||
// Further records that can be inserted are Operator/OEM dependent
|
||||
}
|
||||
|
||||
@@ -401,7 +405,7 @@ public final class RuimRecords extends IccRecords {
|
||||
}
|
||||
countVoiceMessages = countWaiting;
|
||||
|
||||
((CDMAPhone) phone).notifyMessageWaitingIndicator();
|
||||
mRecordsEventsRegistrants.notifyResult(EVENT_MWI);
|
||||
}
|
||||
|
||||
private void handleRuimRefresh(IccRefreshResponse refreshResponse) {
|
||||
@@ -411,7 +415,7 @@ public final class RuimRecords extends IccRecords {
|
||||
}
|
||||
|
||||
if (refreshResponse.aid != null &&
|
||||
!refreshResponse.aid.equals(phone.getIccCard().getAid())) {
|
||||
!refreshResponse.aid.equals(mParentCard.getAid())) {
|
||||
// This is for different app. Ignore.
|
||||
return;
|
||||
}
|
||||
@@ -429,7 +433,7 @@ public final class RuimRecords extends IccRecords {
|
||||
break;
|
||||
case IccRefreshResponse.REFRESH_RESULT_RESET:
|
||||
if (DBG) log("handleRuimRefresh with SIM_REFRESH_RESET");
|
||||
phone.mCM.setRadioPower(false, null);
|
||||
mCi.setRadioPower(false, null);
|
||||
/* Note: no need to call setRadioPower(true). Assuming the desired
|
||||
* radio power state is still ON (as tracked by ServiceStateTracker),
|
||||
* ServiceStateTracker will call setRadioPower when it receives the
|
||||
|
||||
@@ -152,7 +152,7 @@ public class GSMPhone extends PhoneBase {
|
||||
mStkService = CatService.getInstance(mCM, mIccRecords, mContext, mIccFileHandler, mIccCard);
|
||||
|
||||
mCM.registerForAvailable(this, EVENT_RADIO_AVAILABLE, null);
|
||||
mIccRecords.registerForRecordsLoaded(this, EVENT_SIM_RECORDS_LOADED, null);
|
||||
registerForSimRecordEvents();
|
||||
mCM.registerForOffOrNotAvailable(this, EVENT_RADIO_OFF_OR_NOT_AVAILABLE, null);
|
||||
mCM.registerForOn(this, EVENT_RADIO_ON, null);
|
||||
mCM.setOnUSSD(this, EVENT_USSD, null);
|
||||
@@ -205,7 +205,7 @@ public class GSMPhone extends PhoneBase {
|
||||
|
||||
//Unregister from all former registered events
|
||||
mCM.unregisterForAvailable(this); //EVENT_RADIO_AVAILABLE
|
||||
mIccRecords.unregisterForRecordsLoaded(this); //EVENT_SIM_RECORDS_LOADED
|
||||
unregisterForSimRecordEvents();
|
||||
mCM.unregisterForOffOrNotAvailable(this); //EVENT_RADIO_OFF_OR_NOT_AVAILABLE
|
||||
mCM.unregisterForOn(this); //EVENT_RADIO_ON
|
||||
mSST.unregisterForNetworkAttached(this); //EVENT_REGISTERED_TO_NETWORK
|
||||
@@ -219,8 +219,6 @@ public class GSMPhone extends PhoneBase {
|
||||
mCT.dispose();
|
||||
mDataConnectionTracker.dispose();
|
||||
mSST.dispose();
|
||||
mIccFileHandler.dispose(); // instance of SimFileHandler
|
||||
mIccRecords.dispose();
|
||||
mSimPhoneBookIntManager.dispose();
|
||||
mSimSmsIntManager.dispose();
|
||||
mSubInfo.dispose();
|
||||
@@ -1288,6 +1286,21 @@ public class GSMPhone extends PhoneBase {
|
||||
}
|
||||
break;
|
||||
|
||||
case EVENT_NEW_ICC_SMS:
|
||||
ar = (AsyncResult)msg.obj;
|
||||
mSMS.dispatchMessage((SmsMessage)ar.result);
|
||||
break;
|
||||
|
||||
case EVENT_SET_NETWORK_AUTOMATIC:
|
||||
ar = (AsyncResult)msg.obj;
|
||||
setNetworkSelectionModeAutomatic((Message)ar.result);
|
||||
break;
|
||||
|
||||
case EVENT_ICC_RECORD_EVENTS:
|
||||
ar = (AsyncResult)msg.obj;
|
||||
processIccRecordEvents((Integer)ar.result);
|
||||
break;
|
||||
|
||||
// handle the select network completion callbacks.
|
||||
case EVENT_SET_NETWORK_MANUAL_COMPLETE:
|
||||
case EVENT_SET_NETWORK_AUTOMATIC_COMPLETE:
|
||||
@@ -1311,7 +1324,18 @@ public class GSMPhone extends PhoneBase {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
private void processIccRecordEvents(int eventCode) {
|
||||
switch (eventCode) {
|
||||
case SIMRecords.EVENT_CFI:
|
||||
notifyCallForwardingIndicator();
|
||||
break;
|
||||
case SIMRecords.EVENT_MWI:
|
||||
notifyMessageWaitingIndicator();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the "current" field in the telephony provider according to the SIM's operator
|
||||
*
|
||||
* @return true for success; false otherwise.
|
||||
@@ -1460,4 +1484,20 @@ public class GSMPhone extends PhoneBase {
|
||||
public boolean isCspPlmnEnabled() {
|
||||
return mIccRecords.isCspPlmnEnabled();
|
||||
}
|
||||
|
||||
private void registerForSimRecordEvents() {
|
||||
mIccRecords.registerForNetworkSelectionModeAutomatic(
|
||||
this, EVENT_SET_NETWORK_AUTOMATIC, null);
|
||||
mIccRecords.registerForNewSms(this, EVENT_NEW_ICC_SMS, null);
|
||||
mIccRecords.registerForRecordsEvents(this, EVENT_ICC_RECORD_EVENTS, null);
|
||||
mIccRecords.registerForRecordsLoaded(this, EVENT_SIM_RECORDS_LOADED, null);
|
||||
}
|
||||
|
||||
private void unregisterForSimRecordEvents() {
|
||||
mIccRecords.unregisterForNetworkSelectionModeAutomatic(this);
|
||||
mIccRecords.unregisterForNewSms(this);
|
||||
mIccRecords.unregisterForRecordsEvents(this);
|
||||
mIccRecords.unregisterForRecordsLoaded(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -40,10 +40,6 @@ public final class SIMFileHandler extends IccFileHandler implements IccConstants
|
||||
super(card, aid, ci);
|
||||
}
|
||||
|
||||
public void dispose() {
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
protected void finalize() {
|
||||
Log.d(LOG_TAG, "SIMFileHandler finalized");
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ import static com.android.internal.telephony.TelephonyProperties.PROPERTY_ICC_OP
|
||||
import static com.android.internal.telephony.TelephonyProperties.PROPERTY_ICC_OPERATOR_NUMERIC;
|
||||
import android.content.Context;
|
||||
import android.os.AsyncResult;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.os.SystemProperties;
|
||||
import android.util.Log;
|
||||
@@ -174,10 +175,10 @@ public class SIMRecords extends IccRecords {
|
||||
|
||||
// ***** Constructor
|
||||
|
||||
public SIMRecords(PhoneBase p) {
|
||||
super(p);
|
||||
public SIMRecords(IccCard card, Context c, CommandsInterface ci) {
|
||||
super(card, c, ci);
|
||||
|
||||
adnCache = new AdnRecordCache(phone);
|
||||
adnCache = new AdnRecordCache(mFh);
|
||||
|
||||
mVmConfig = new VoiceMailConstants();
|
||||
mSpnOverride = new SpnOverride();
|
||||
@@ -187,10 +188,10 @@ public class SIMRecords extends IccRecords {
|
||||
// recordsToLoad is set to 0 because no requests are made yet
|
||||
recordsToLoad = 0;
|
||||
|
||||
p.mCM.registerForOffOrNotAvailable(
|
||||
mCi.registerForOffOrNotAvailable(
|
||||
this, EVENT_RADIO_OFF_OR_NOT_AVAILABLE, null);
|
||||
p.mCM.setOnSmsOnSim(this, EVENT_SMS_ON_SIM, null);
|
||||
p.mCM.registerForIccRefresh(this, EVENT_SIM_REFRESH, null);
|
||||
mCi.setOnSmsOnSim(this, EVENT_SMS_ON_SIM, null);
|
||||
mCi.registerForIccRefresh(this, EVENT_SIM_REFRESH, null);
|
||||
|
||||
// Start off by setting empty state
|
||||
onRadioOffOrNotAvailable();
|
||||
@@ -199,9 +200,12 @@ public class SIMRecords extends IccRecords {
|
||||
|
||||
@Override
|
||||
public void dispose() {
|
||||
if (DBG) log("Disposing SIMRecords " + this);
|
||||
//Unregister for all events
|
||||
phone.mCM.unregisterForOffOrNotAvailable( this);
|
||||
phone.mCM.unregisterForIccRefresh(this);
|
||||
mCi.unregisterForOffOrNotAvailable( this);
|
||||
mCi.unregisterForIccRefresh(this);
|
||||
mCi.unSetOnSmsOnSim(this);
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
protected void finalize() {
|
||||
@@ -224,9 +228,9 @@ public class SIMRecords extends IccRecords {
|
||||
|
||||
adnCache.reset();
|
||||
|
||||
phone.setSystemProperty(PROPERTY_ICC_OPERATOR_NUMERIC, null);
|
||||
phone.setSystemProperty(PROPERTY_ICC_OPERATOR_ALPHA, null);
|
||||
phone.setSystemProperty(PROPERTY_ICC_OPERATOR_ISO_COUNTRY, null);
|
||||
SystemProperties.set(PROPERTY_ICC_OPERATOR_NUMERIC, null);
|
||||
SystemProperties.set(PROPERTY_ICC_OPERATOR_ALPHA, null);
|
||||
SystemProperties.set(PROPERTY_ICC_OPERATOR_ISO_COUNTRY, null);
|
||||
|
||||
// recordsRequested is set to false indicating that the SIM
|
||||
// read requests made so far are not valid. This is set to
|
||||
@@ -280,7 +284,7 @@ public class SIMRecords extends IccRecords {
|
||||
|
||||
AdnRecord adn = new AdnRecord(msisdnTag, msisdn);
|
||||
|
||||
new AdnRecordLoader(phone).updateEF(adn, EF_MSISDN, EF_EXT1, 1, null,
|
||||
new AdnRecordLoader(mFh).updateEF(adn, EF_MSISDN, EF_EXT1, 1, null,
|
||||
obtainMessage(EVENT_SET_MSISDN_DONE, onComplete));
|
||||
}
|
||||
|
||||
@@ -332,13 +336,13 @@ public class SIMRecords extends IccRecords {
|
||||
|
||||
if (mailboxIndex != 0 && mailboxIndex != 0xff) {
|
||||
|
||||
new AdnRecordLoader(phone).updateEF(adn, EF_MBDN, EF_EXT6,
|
||||
new AdnRecordLoader(mFh).updateEF(adn, EF_MBDN, EF_EXT6,
|
||||
mailboxIndex, null,
|
||||
obtainMessage(EVENT_SET_MBDN_DONE, onComplete));
|
||||
|
||||
} else if (isCphsMailboxEnabled()) {
|
||||
|
||||
new AdnRecordLoader(phone).updateEF(adn, EF_MAILBOX_CPHS,
|
||||
new AdnRecordLoader(mFh).updateEF(adn, EF_MAILBOX_CPHS,
|
||||
EF_EXT1, 1, null,
|
||||
obtainMessage(EVENT_SET_CPHS_MAILBOX_DONE, onComplete));
|
||||
|
||||
@@ -379,7 +383,7 @@ public class SIMRecords extends IccRecords {
|
||||
|
||||
countVoiceMessages = countWaiting;
|
||||
|
||||
phone.notifyMessageWaitingIndicator();
|
||||
mRecordsEventsRegistrants.notifyResult(EVENT_MWI);
|
||||
|
||||
try {
|
||||
if (efMWIS != null) {
|
||||
@@ -398,7 +402,7 @@ public class SIMRecords extends IccRecords {
|
||||
efMWIS[1] = (byte) countWaiting;
|
||||
}
|
||||
|
||||
phone.getIccFileHandler().updateEFLinearFixed(
|
||||
mFh.updateEFLinearFixed(
|
||||
EF_MWIS, 1, efMWIS, null,
|
||||
obtainMessage (EVENT_UPDATE_DONE, EF_MWIS));
|
||||
}
|
||||
@@ -408,7 +412,7 @@ public class SIMRecords extends IccRecords {
|
||||
efCPHS_MWI[0] = (byte)((efCPHS_MWI[0] & 0xf0)
|
||||
| (countVoiceMessages == 0 ? 0x5 : 0xa));
|
||||
|
||||
phone.getIccFileHandler().updateEFTransparent(
|
||||
mFh.updateEFTransparent(
|
||||
EF_VOICE_MAIL_INDICATOR_CPHS, efCPHS_MWI,
|
||||
obtainMessage (EVENT_UPDATE_DONE, EF_VOICE_MAIL_INDICATOR_CPHS));
|
||||
}
|
||||
@@ -435,7 +439,7 @@ public class SIMRecords extends IccRecords {
|
||||
|
||||
callForwardingEnabled = enable;
|
||||
|
||||
phone.notifyCallForwardingIndicator();
|
||||
mRecordsEventsRegistrants.notifyResult(EVENT_CFI);
|
||||
|
||||
try {
|
||||
if (mEfCfis != null) {
|
||||
@@ -449,7 +453,7 @@ public class SIMRecords extends IccRecords {
|
||||
// TODO: Should really update other fields in EF_CFIS, eg,
|
||||
// dialing number. We don't read or use it right now.
|
||||
|
||||
phone.getIccFileHandler().updateEFLinearFixed(
|
||||
mFh.updateEFLinearFixed(
|
||||
EF_CFIS, 1, mEfCfis, null,
|
||||
obtainMessage (EVENT_UPDATE_DONE, EF_CFIS));
|
||||
}
|
||||
@@ -463,7 +467,7 @@ public class SIMRecords extends IccRecords {
|
||||
| CFF_UNCONDITIONAL_DEACTIVE);
|
||||
}
|
||||
|
||||
phone.getIccFileHandler().updateEFTransparent(
|
||||
mFh.updateEFTransparent(
|
||||
EF_CFF_CPHS, mEfCff,
|
||||
obtainMessage (EVENT_UPDATE_DONE, EF_CFF_CPHS));
|
||||
}
|
||||
@@ -516,7 +520,7 @@ public class SIMRecords extends IccRecords {
|
||||
|
||||
boolean isRecordLoadResponse = false;
|
||||
|
||||
if (!phone.mIsTheCurrentActivePhone) {
|
||||
if (mDestroyed) {
|
||||
loge("Received message " + msg + "[" + msg.what + "] " +
|
||||
" while being destroyed. Ignoring.");
|
||||
return;
|
||||
@@ -574,9 +578,9 @@ public class SIMRecords extends IccRecords {
|
||||
|
||||
if (mncLength != UNKNOWN && mncLength != UNINITIALIZED) {
|
||||
// finally have both the imsi and the mncLength and can parse the imsi properly
|
||||
MccTable.updateMccMncConfiguration(phone, imsi.substring(0, 3 + mncLength));
|
||||
MccTable.updateMccMncConfiguration(mContext, imsi.substring(0, 3 + mncLength));
|
||||
}
|
||||
phone.mIccCard.broadcastIccStateChangedIntent(
|
||||
mParentCard.broadcastIccStateChangedIntent(
|
||||
IccCard.INTENT_VALUE_ICC_IMSI, null);
|
||||
break;
|
||||
|
||||
@@ -607,12 +611,12 @@ public class SIMRecords extends IccRecords {
|
||||
|
||||
if (isValidMbdn) {
|
||||
// Note: MBDN was not included in NUM_OF_SIM_RECORDS_LOADED
|
||||
new AdnRecordLoader(phone).loadFromEF(EF_MBDN, EF_EXT6,
|
||||
new AdnRecordLoader(mFh).loadFromEF(EF_MBDN, EF_EXT6,
|
||||
mailboxIndex, obtainMessage(EVENT_GET_MBDN_DONE));
|
||||
} else {
|
||||
// If this EF not present, try mailbox as in CPHS standard
|
||||
// CPHS (CPHS4_2.WW6) is a european standard.
|
||||
new AdnRecordLoader(phone).loadFromEF(EF_MAILBOX_CPHS,
|
||||
new AdnRecordLoader(mFh).loadFromEF(EF_MAILBOX_CPHS,
|
||||
EF_EXT1, 1,
|
||||
obtainMessage(EVENT_GET_CPHS_MAILBOX_DONE));
|
||||
}
|
||||
@@ -644,7 +648,7 @@ public class SIMRecords extends IccRecords {
|
||||
// FIXME right now, only load line1's CPHS voice mail entry
|
||||
|
||||
recordsToLoad += 1;
|
||||
new AdnRecordLoader(phone).loadFromEF(
|
||||
new AdnRecordLoader(mFh).loadFromEF(
|
||||
EF_MAILBOX_CPHS, EF_EXT1, 1,
|
||||
obtainMessage(EVENT_GET_CPHS_MAILBOX_DONE));
|
||||
}
|
||||
@@ -661,7 +665,7 @@ public class SIMRecords extends IccRecords {
|
||||
// FIXME should use SST to decide
|
||||
// FIXME right now, only load line1's CPHS voice mail entry
|
||||
recordsToLoad += 1;
|
||||
new AdnRecordLoader(phone).loadFromEF(
|
||||
new AdnRecordLoader(mFh).loadFromEF(
|
||||
EF_MAILBOX_CPHS, EF_EXT1, 1,
|
||||
obtainMessage(EVENT_GET_CPHS_MAILBOX_DONE));
|
||||
|
||||
@@ -729,7 +733,7 @@ public class SIMRecords extends IccRecords {
|
||||
countVoiceMessages = -1;
|
||||
}
|
||||
|
||||
phone.notifyMessageWaitingIndicator();
|
||||
mRecordsEventsRegistrants.notifyResult(EVENT_MWI);
|
||||
break;
|
||||
|
||||
case EVENT_GET_VOICE_MAIL_INDICATOR_CPHS_DONE:
|
||||
@@ -758,7 +762,7 @@ public class SIMRecords extends IccRecords {
|
||||
countVoiceMessages = 0;
|
||||
}
|
||||
|
||||
phone.notifyMessageWaitingIndicator();
|
||||
mRecordsEventsRegistrants.notifyResult(EVENT_MWI);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -839,7 +843,8 @@ public class SIMRecords extends IccRecords {
|
||||
if (imsi != null && mncLength != UNKNOWN) {
|
||||
// finally have both imsi and the length of the mnc and can parse
|
||||
// the imsi properly
|
||||
MccTable.updateMccMncConfiguration(phone, imsi.substring(0, 3 + mncLength));
|
||||
MccTable.updateMccMncConfiguration(mContext,
|
||||
imsi.substring(0, 3 + mncLength));
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -867,7 +872,7 @@ public class SIMRecords extends IccRecords {
|
||||
callForwardingEnabled =
|
||||
((data[0] & CFF_LINE1_MASK) == CFF_UNCONDITIONAL_ACTIVE);
|
||||
|
||||
phone.notifyCallForwardingIndicator();
|
||||
mRecordsEventsRegistrants.notifyResult(EVENT_CFI);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -940,7 +945,7 @@ public class SIMRecords extends IccRecords {
|
||||
+ ar.exception + " length " + index.length);
|
||||
} else {
|
||||
log("READ EF_SMS RECORD index=" + index[0]);
|
||||
phone.getIccFileHandler().loadEFLinearFixed(EF_SMS,index[0],
|
||||
mFh.loadEFLinearFixed(EF_SMS,index[0],
|
||||
obtainMessage(EVENT_GET_SMS_DONE));
|
||||
}
|
||||
break;
|
||||
@@ -1012,7 +1017,7 @@ public class SIMRecords extends IccRecords {
|
||||
onCphsCompleted = null;
|
||||
}
|
||||
|
||||
new AdnRecordLoader(phone).
|
||||
new AdnRecordLoader(mFh).
|
||||
updateEF(adn, EF_MAILBOX_CPHS, EF_EXT1, 1, null,
|
||||
obtainMessage(EVENT_SET_CPHS_MAILBOX_DONE,
|
||||
onCphsCompleted));
|
||||
@@ -1066,7 +1071,7 @@ public class SIMRecords extends IccRecords {
|
||||
// Refer TS 51.011 Section 10.3.46 for the content description
|
||||
callForwardingEnabled = ((data[1] & 0x01) != 0);
|
||||
|
||||
phone.notifyCallForwardingIndicator();
|
||||
mRecordsEventsRegistrants.notifyResult(EVENT_CFI);
|
||||
break;
|
||||
|
||||
case EVENT_GET_CSP_CPHS_DONE:
|
||||
@@ -1103,18 +1108,18 @@ public class SIMRecords extends IccRecords {
|
||||
switch(efid) {
|
||||
case EF_MBDN:
|
||||
recordsToLoad++;
|
||||
new AdnRecordLoader(phone).loadFromEF(EF_MBDN, EF_EXT6,
|
||||
new AdnRecordLoader(mFh).loadFromEF(EF_MBDN, EF_EXT6,
|
||||
mailboxIndex, obtainMessage(EVENT_GET_MBDN_DONE));
|
||||
break;
|
||||
case EF_MAILBOX_CPHS:
|
||||
recordsToLoad++;
|
||||
new AdnRecordLoader(phone).loadFromEF(EF_MAILBOX_CPHS, EF_EXT1,
|
||||
new AdnRecordLoader(mFh).loadFromEF(EF_MAILBOX_CPHS, EF_EXT1,
|
||||
1, obtainMessage(EVENT_GET_CPHS_MAILBOX_DONE));
|
||||
break;
|
||||
case EF_CSP_CPHS:
|
||||
recordsToLoad++;
|
||||
log("[CSP] SIM Refresh for EF_CSP_CPHS");
|
||||
phone.getIccFileHandler().loadEFTransparent(EF_CSP_CPHS,
|
||||
mFh.loadEFTransparent(EF_CSP_CPHS,
|
||||
obtainMessage(EVENT_GET_CSP_CPHS_DONE));
|
||||
break;
|
||||
default:
|
||||
@@ -1134,7 +1139,7 @@ public class SIMRecords extends IccRecords {
|
||||
}
|
||||
|
||||
if (refreshResponse.aid != null &&
|
||||
!refreshResponse.aid.equals(phone.getIccCard().getAid())) {
|
||||
!refreshResponse.aid.equals(mParentCard.getAid())) {
|
||||
// This is for different app. Ignore.
|
||||
return;
|
||||
}
|
||||
@@ -1152,7 +1157,7 @@ public class SIMRecords extends IccRecords {
|
||||
break;
|
||||
case IccRefreshResponse.REFRESH_RESULT_RESET:
|
||||
if (DBG) log("handleSimRefresh with SIM_REFRESH_RESET");
|
||||
phone.mCM.setRadioPower(false, null);
|
||||
mCi.setRadioPower(false, null);
|
||||
/* Note: no need to call setRadioPower(true). Assuming the desired
|
||||
* radio power state is still ON (as tracked by ServiceStateTracker),
|
||||
* ServiceStateTracker will call setRadioPower when it receives the
|
||||
@@ -1174,7 +1179,8 @@ public class SIMRecords extends IccRecords {
|
||||
* to send messages to the secondary 3GPP format SMS dispatcher.
|
||||
*/
|
||||
protected int dispatchGsmMessage(SmsMessageBase message) {
|
||||
return phone.mSMS.dispatchMessage(message);
|
||||
mNewSmsRegistrants.notifyResult(message);
|
||||
return 0;
|
||||
}
|
||||
|
||||
private void handleSms(byte[] ba) {
|
||||
@@ -1226,7 +1232,7 @@ public class SIMRecords extends IccRecords {
|
||||
ba[0] = 1;
|
||||
|
||||
if (false) { // XXX writing seems to crash RdoServD
|
||||
phone.getIccFileHandler().updateEFLinearFixed(EF_SMS,
|
||||
mFh.updateEFLinearFixed(EF_SMS,
|
||||
i, ba, null, obtainMessage(EVENT_MARK_SMS_READ_DONE, i));
|
||||
}
|
||||
}
|
||||
@@ -1237,6 +1243,7 @@ public class SIMRecords extends IccRecords {
|
||||
// One record loaded successfully or failed, In either case
|
||||
// we need to update the recordsToLoad count
|
||||
recordsToLoad -= 1;
|
||||
if (DBG) log("onRecordLoaded " + recordsToLoad + " requested: " + recordsRequested);
|
||||
|
||||
if (recordsToLoad == 0 && recordsRequested == true) {
|
||||
onAllRecordsLoaded();
|
||||
@@ -1253,10 +1260,10 @@ public class SIMRecords extends IccRecords {
|
||||
|
||||
// Some fields require more than one SIM record to set
|
||||
|
||||
phone.setSystemProperty(PROPERTY_ICC_OPERATOR_NUMERIC, operator);
|
||||
SystemProperties.set(PROPERTY_ICC_OPERATOR_NUMERIC, operator);
|
||||
|
||||
if (imsi != null) {
|
||||
phone.setSystemProperty(PROPERTY_ICC_OPERATOR_ISO_COUNTRY,
|
||||
SystemProperties.set(PROPERTY_ICC_OPERATOR_ISO_COUNTRY,
|
||||
MccTable.countryCodeForMcc(Integer.parseInt(imsi.substring(0,3))));
|
||||
}
|
||||
else {
|
||||
@@ -1268,7 +1275,7 @@ public class SIMRecords extends IccRecords {
|
||||
|
||||
recordsLoadedRegistrants.notifyRegistrants(
|
||||
new AsyncResult(null, null, null));
|
||||
phone.mIccCard.broadcastIccStateChangedIntent(
|
||||
mParentCard.broadcastIccStateChangedIntent(
|
||||
IccCard.INTENT_VALUE_ICC_LOADED, null);
|
||||
}
|
||||
|
||||
@@ -1294,7 +1301,7 @@ public class SIMRecords extends IccRecords {
|
||||
/* broadcast intent SIM_READY here so that we can make sure
|
||||
READY is sent before IMSI ready
|
||||
*/
|
||||
phone.mIccCard.broadcastIccStateChangedIntent(
|
||||
mParentCard.broadcastIccStateChangedIntent(
|
||||
IccCard.INTENT_VALUE_ICC_READY, null);
|
||||
|
||||
fetchSimRecords();
|
||||
@@ -1302,31 +1309,30 @@ public class SIMRecords extends IccRecords {
|
||||
|
||||
protected void fetchSimRecords() {
|
||||
recordsRequested = true;
|
||||
IccFileHandler iccFh = phone.getIccFileHandler();
|
||||
|
||||
logv("fetchSimRecords " + recordsToLoad);
|
||||
if (DBG) log("fetchSimRecords " + recordsToLoad);
|
||||
|
||||
phone.mCM.getIMSIForApp(phone.getIccCard().getAid(), obtainMessage(EVENT_GET_IMSI_DONE));
|
||||
mCi.getIMSIForApp(mParentCard.getAid(), obtainMessage(EVENT_GET_IMSI_DONE));
|
||||
recordsToLoad++;
|
||||
|
||||
iccFh.loadEFTransparent(EF_ICCID, obtainMessage(EVENT_GET_ICCID_DONE));
|
||||
mFh.loadEFTransparent(EF_ICCID, obtainMessage(EVENT_GET_ICCID_DONE));
|
||||
recordsToLoad++;
|
||||
|
||||
// FIXME should examine EF[MSISDN]'s capability configuration
|
||||
// to determine which is the voice/data/fax line
|
||||
new AdnRecordLoader(phone).loadFromEF(EF_MSISDN, EF_EXT1, 1,
|
||||
new AdnRecordLoader(mFh).loadFromEF(EF_MSISDN, EF_EXT1, 1,
|
||||
obtainMessage(EVENT_GET_MSISDN_DONE));
|
||||
recordsToLoad++;
|
||||
|
||||
// Record number is subscriber profile
|
||||
iccFh.loadEFLinearFixed(EF_MBI, 1, obtainMessage(EVENT_GET_MBI_DONE));
|
||||
mFh.loadEFLinearFixed(EF_MBI, 1, obtainMessage(EVENT_GET_MBI_DONE));
|
||||
recordsToLoad++;
|
||||
|
||||
iccFh.loadEFTransparent(EF_AD, obtainMessage(EVENT_GET_AD_DONE));
|
||||
mFh.loadEFTransparent(EF_AD, obtainMessage(EVENT_GET_AD_DONE));
|
||||
recordsToLoad++;
|
||||
|
||||
// Record number is subscriber profile
|
||||
iccFh.loadEFLinearFixed(EF_MWIS, 1, obtainMessage(EVENT_GET_MWIS_DONE));
|
||||
mFh.loadEFLinearFixed(EF_MWIS, 1, obtainMessage(EVENT_GET_MWIS_DONE));
|
||||
recordsToLoad++;
|
||||
|
||||
|
||||
@@ -1334,39 +1340,39 @@ public class SIMRecords extends IccRecords {
|
||||
// the same info as EF[MWIS]. If both exist, both are updated
|
||||
// but the EF[MWIS] data is preferred
|
||||
// Please note this must be loaded after EF[MWIS]
|
||||
iccFh.loadEFTransparent(
|
||||
mFh.loadEFTransparent(
|
||||
EF_VOICE_MAIL_INDICATOR_CPHS,
|
||||
obtainMessage(EVENT_GET_VOICE_MAIL_INDICATOR_CPHS_DONE));
|
||||
recordsToLoad++;
|
||||
|
||||
// Same goes for Call Forward Status indicator: fetch both
|
||||
// EF[CFIS] and CPHS-EF, with EF[CFIS] preferred.
|
||||
iccFh.loadEFLinearFixed(EF_CFIS, 1, obtainMessage(EVENT_GET_CFIS_DONE));
|
||||
mFh.loadEFLinearFixed(EF_CFIS, 1, obtainMessage(EVENT_GET_CFIS_DONE));
|
||||
recordsToLoad++;
|
||||
iccFh.loadEFTransparent(EF_CFF_CPHS, obtainMessage(EVENT_GET_CFF_DONE));
|
||||
mFh.loadEFTransparent(EF_CFF_CPHS, obtainMessage(EVENT_GET_CFF_DONE));
|
||||
recordsToLoad++;
|
||||
|
||||
|
||||
getSpnFsm(true, null);
|
||||
|
||||
iccFh.loadEFTransparent(EF_SPDI, obtainMessage(EVENT_GET_SPDI_DONE));
|
||||
mFh.loadEFTransparent(EF_SPDI, obtainMessage(EVENT_GET_SPDI_DONE));
|
||||
recordsToLoad++;
|
||||
|
||||
iccFh.loadEFLinearFixed(EF_PNN, 1, obtainMessage(EVENT_GET_PNN_DONE));
|
||||
mFh.loadEFLinearFixed(EF_PNN, 1, obtainMessage(EVENT_GET_PNN_DONE));
|
||||
recordsToLoad++;
|
||||
|
||||
iccFh.loadEFTransparent(EF_SST, obtainMessage(EVENT_GET_SST_DONE));
|
||||
mFh.loadEFTransparent(EF_SST, obtainMessage(EVENT_GET_SST_DONE));
|
||||
recordsToLoad++;
|
||||
|
||||
iccFh.loadEFTransparent(EF_INFO_CPHS, obtainMessage(EVENT_GET_INFO_CPHS_DONE));
|
||||
mFh.loadEFTransparent(EF_INFO_CPHS, obtainMessage(EVENT_GET_INFO_CPHS_DONE));
|
||||
recordsToLoad++;
|
||||
|
||||
iccFh.loadEFTransparent(EF_CSP_CPHS,obtainMessage(EVENT_GET_CSP_CPHS_DONE));
|
||||
mFh.loadEFTransparent(EF_CSP_CPHS,obtainMessage(EVENT_GET_CSP_CPHS_DONE));
|
||||
recordsToLoad++;
|
||||
|
||||
// XXX should seek instead of examining them all
|
||||
if (false) { // XXX
|
||||
iccFh.loadEFLinearFixedAll(EF_SMS, obtainMessage(EVENT_GET_ALL_SMS_DONE));
|
||||
mFh.loadEFLinearFixedAll(EF_SMS, obtainMessage(EVENT_GET_ALL_SMS_DONE));
|
||||
recordsToLoad++;
|
||||
}
|
||||
|
||||
@@ -1379,9 +1385,10 @@ public class SIMRecords extends IccRecords {
|
||||
+ "ffffffffffffffffffffffffffffff";
|
||||
byte[] ba = IccUtils.hexStringToBytes(sms);
|
||||
|
||||
iccFh.updateEFLinearFixed(EF_SMS, 1, ba, null,
|
||||
mFh.updateEFLinearFixed(EF_SMS, 1, ba, null,
|
||||
obtainMessage(EVENT_MARK_SMS_READ_DONE, 1));
|
||||
}
|
||||
if (DBG) log("fetchSimRecords " + recordsToLoad + " requested: " + recordsRequested);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1467,7 +1474,7 @@ public class SIMRecords extends IccRecords {
|
||||
case INIT:
|
||||
spn = null;
|
||||
|
||||
phone.getIccFileHandler().loadEFTransparent( EF_SPN,
|
||||
mFh.loadEFTransparent(EF_SPN,
|
||||
obtainMessage(EVENT_GET_SPN_DONE));
|
||||
recordsToLoad++;
|
||||
|
||||
@@ -1481,11 +1488,11 @@ public class SIMRecords extends IccRecords {
|
||||
|
||||
if (DBG) log("Load EF_SPN: " + spn
|
||||
+ " spnDisplayCondition: " + spnDisplayCondition);
|
||||
phone.setSystemProperty(PROPERTY_ICC_OPERATOR_ALPHA, spn);
|
||||
SystemProperties.set(PROPERTY_ICC_OPERATOR_ALPHA, spn);
|
||||
|
||||
spnState = Get_Spn_Fsm_State.IDLE;
|
||||
} else {
|
||||
phone.getIccFileHandler().loadEFTransparent( EF_SPN_CPHS,
|
||||
mFh.loadEFTransparent( EF_SPN_CPHS,
|
||||
obtainMessage(EVENT_GET_SPN_DONE));
|
||||
recordsToLoad++;
|
||||
|
||||
@@ -1503,11 +1510,11 @@ public class SIMRecords extends IccRecords {
|
||||
data, 0, data.length - 1 );
|
||||
|
||||
if (DBG) log("Load EF_SPN_CPHS: " + spn);
|
||||
phone.setSystemProperty(PROPERTY_ICC_OPERATOR_ALPHA, spn);
|
||||
SystemProperties.set(PROPERTY_ICC_OPERATOR_ALPHA, spn);
|
||||
|
||||
spnState = Get_Spn_Fsm_State.IDLE;
|
||||
} else {
|
||||
phone.getIccFileHandler().loadEFTransparent(
|
||||
mFh.loadEFTransparent(
|
||||
EF_SPN_SHORT_CPHS, obtainMessage(EVENT_GET_SPN_DONE));
|
||||
recordsToLoad++;
|
||||
|
||||
@@ -1521,7 +1528,7 @@ public class SIMRecords extends IccRecords {
|
||||
data, 0, data.length - 1);
|
||||
|
||||
if (DBG) log("Load EF_SPN_SHORT_CPHS: " + spn);
|
||||
phone.setSystemProperty(PROPERTY_ICC_OPERATOR_ALPHA, spn);
|
||||
SystemProperties.set(PROPERTY_ICC_OPERATOR_ALPHA, spn);
|
||||
}else {
|
||||
if (DBG) log("No SPN loaded in either CHPS or 3GPP");
|
||||
}
|
||||
@@ -1638,7 +1645,7 @@ public class SIMRecords extends IccRecords {
|
||||
// Operator Selection menu should be disabled.
|
||||
// Operator Selection Mode should be set to Automatic.
|
||||
log("[CSP] Set Automatic Network Selection");
|
||||
phone.setNetworkSelectionModeAutomatic(null);
|
||||
mNetworkSelectionModeAutomaticRegistrants.notifyRegistrants();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ import android.util.Log;
|
||||
import com.android.internal.telephony.AdnRecord;
|
||||
import com.android.internal.telephony.AdnRecordCache;
|
||||
import com.android.internal.telephony.IccConstants;
|
||||
import com.android.internal.telephony.IccFileHandler;
|
||||
import com.android.internal.telephony.IccUtils;
|
||||
import com.android.internal.telephony.PhoneBase;
|
||||
|
||||
@@ -42,7 +43,7 @@ public class UsimPhoneBookManager extends Handler implements IccConstants {
|
||||
private static final boolean DBG = true;
|
||||
private PbrFile mPbrFile;
|
||||
private Boolean mIsPbrPresent;
|
||||
private PhoneBase mPhone;
|
||||
private IccFileHandler mFh;
|
||||
private AdnRecordCache mAdnCache;
|
||||
private Object mLock = new Object();
|
||||
private ArrayList<AdnRecord> mPhoneBookRecords;
|
||||
@@ -74,8 +75,8 @@ public class UsimPhoneBookManager extends Handler implements IccConstants {
|
||||
private static final int USIM_EFEMAIL_TAG = 0xCA;
|
||||
private static final int USIM_EFCCP1_TAG = 0xCB;
|
||||
|
||||
public UsimPhoneBookManager(PhoneBase phone, AdnRecordCache cache) {
|
||||
mPhone = phone;
|
||||
public UsimPhoneBookManager(IccFileHandler fh, AdnRecordCache cache) {
|
||||
mFh = fh;
|
||||
mPhoneBookRecords = new ArrayList<AdnRecord>();
|
||||
mPbrFile = null;
|
||||
// We assume its present, after the first read this is updated.
|
||||
@@ -138,7 +139,7 @@ public class UsimPhoneBookManager extends Handler implements IccConstants {
|
||||
}
|
||||
|
||||
private void readPbrFileAndWait() {
|
||||
mPhone.getIccFileHandler().loadEFLinearFixedAll(EF_PBR, obtainMessage(EVENT_PBR_LOAD_DONE));
|
||||
mFh.loadEFLinearFixedAll(EF_PBR, obtainMessage(EVENT_PBR_LOAD_DONE));
|
||||
try {
|
||||
mLock.wait();
|
||||
} catch (InterruptedException e) {
|
||||
@@ -165,7 +166,7 @@ public class UsimPhoneBookManager extends Handler implements IccConstants {
|
||||
}
|
||||
}
|
||||
// Read the EFEmail file.
|
||||
mPhone.getIccFileHandler().loadEFLinearFixedAll(fileIds.get(USIM_EFEMAIL_TAG),
|
||||
mFh.loadEFLinearFixedAll(fileIds.get(USIM_EFEMAIL_TAG),
|
||||
obtainMessage(EVENT_EMAIL_LOAD_DONE));
|
||||
try {
|
||||
mLock.wait();
|
||||
@@ -183,7 +184,7 @@ public class UsimPhoneBookManager extends Handler implements IccConstants {
|
||||
}
|
||||
|
||||
private void readIapFileAndWait(int efid) {
|
||||
mPhone.getIccFileHandler().loadEFLinearFixedAll(efid, obtainMessage(EVENT_IAP_LOAD_DONE));
|
||||
mFh.loadEFLinearFixedAll(efid, obtainMessage(EVENT_IAP_LOAD_DONE));
|
||||
try {
|
||||
mLock.wait();
|
||||
} catch (InterruptedException e) {
|
||||
|
||||
Reference in New Issue
Block a user