use of com.android.internal.telephony.AdnRecordLoader in project XobotOS by xamarin.
the class CdmaLteUiccRecords method fetchSimRecords.
@Override
protected void fetchSimRecords() {
IccFileHandler iccFh = phone.getIccFileHandler();
recordsRequested = true;
phone.mCM.getIMSI(obtainMessage(EVENT_GET_IMSI_DONE));
recordsToLoad++;
iccFh.loadEFTransparent(EF_ICCID, obtainMessage(EVENT_GET_ICCID_DONE));
recordsToLoad++;
iccFh.loadEFTransparent(EF_AD, obtainMessage(EVENT_GET_AD_DONE));
recordsToLoad++;
iccFh.loadEFTransparent(EF_PL, obtainMessage(EVENT_GET_ICC_RECORD_DONE, new EfPlLoaded()));
recordsToLoad++;
new AdnRecordLoader(phone).loadFromEF(EF_MSISDN, EF_EXT1, 1, obtainMessage(EVENT_GET_MSISDN_DONE));
recordsToLoad++;
iccFh.loadEFTransparent(EF_CSIM_LI, obtainMessage(EVENT_GET_ICC_RECORD_DONE, new EfCsimLiLoaded()));
recordsToLoad++;
iccFh.loadEFTransparent(EF_CSIM_SPN, obtainMessage(EVENT_GET_ICC_RECORD_DONE, new EfCsimSpnLoaded()));
recordsToLoad++;
iccFh.loadEFLinearFixed(EF_CSIM_MDN, 1, obtainMessage(EVENT_GET_ICC_RECORD_DONE, new EfCsimMdnLoaded()));
recordsToLoad++;
iccFh.loadEFTransparent(EF_CSIM_IMSIM, obtainMessage(EVENT_GET_ICC_RECORD_DONE, new EfCsimImsimLoaded()));
recordsToLoad++;
iccFh.loadEFLinearFixedAll(EF_CSIM_CDMAHOME, obtainMessage(EVENT_GET_ICC_RECORD_DONE, new EfCsimCdmaHomeLoaded()));
recordsToLoad++;
iccFh.loadEFTransparent(EF_CSIM_EPRL, obtainMessage(EVENT_GET_ICC_RECORD_DONE, new EfCsimEprlLoaded()));
recordsToLoad++;
// load ISIM records
recordsToLoad += mIsimUiccRecords.fetchIsimRecords(iccFh, this);
}
use of com.android.internal.telephony.AdnRecordLoader in project XobotOS by xamarin.
the class SIMRecords method handleMessage.
// ***** Overridden from Handler
public void handleMessage(Message msg) {
AsyncResult ar;
AdnRecord adn;
byte[] data;
boolean isRecordLoadResponse = false;
try {
switch(msg.what) {
case EVENT_SIM_READY:
onSimReady();
break;
case EVENT_RADIO_OFF_OR_NOT_AVAILABLE:
onRadioOffOrNotAvailable();
break;
/* IO events */
case EVENT_GET_IMSI_DONE:
isRecordLoadResponse = true;
ar = (AsyncResult) msg.obj;
if (ar.exception != null) {
Log.e(LOG_TAG, "Exception querying IMSI, Exception:" + ar.exception);
break;
}
imsi = (String) ar.result;
// than 15 (and usually 15).
if (imsi != null && (imsi.length() < 6 || imsi.length() > 15)) {
Log.e(LOG_TAG, "invalid IMSI " + imsi);
imsi = null;
}
Log.d(LOG_TAG, "IMSI: " + /* imsi.substring(0, 6) +*/
"xxxxxxx");
if (((mncLength == UNKNOWN) || (mncLength == 2)) && ((imsi != null) && (imsi.length() >= 6))) {
String mccmncCode = imsi.substring(0, 6);
for (String mccmnc : MCCMNC_CODES_HAVING_3DIGITS_MNC) {
if (mccmnc.equals(mccmncCode)) {
mncLength = 3;
break;
}
}
}
if (mncLength == UNKNOWN) {
// guess using the mcc
try {
int mcc = Integer.parseInt(imsi.substring(0, 3));
mncLength = MccTable.smallestDigitsMccForMnc(mcc);
} catch (NumberFormatException e) {
mncLength = UNKNOWN;
Log.e(LOG_TAG, "SIMRecords: Corrupt IMSI!");
}
}
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));
}
phone.mIccCard.broadcastIccStateChangedIntent(SimCard.INTENT_VALUE_ICC_IMSI, null);
break;
case EVENT_GET_MBI_DONE:
boolean isValidMbdn;
isRecordLoadResponse = true;
ar = (AsyncResult) msg.obj;
data = (byte[]) ar.result;
isValidMbdn = false;
if (ar.exception == null) {
// Refer TS 51.011 Section 10.3.44 for content details
Log.d(LOG_TAG, "EF_MBI: " + IccUtils.bytesToHexString(data));
// Voice mail record number stored first
mailboxIndex = (int) data[0] & 0xff;
// check if dailing numbe id valid
if (mailboxIndex != 0 && mailboxIndex != 0xff) {
Log.d(LOG_TAG, "Got valid mailbox number for MBDN");
isValidMbdn = true;
}
}
// one more record to load
recordsToLoad += 1;
if (isValidMbdn) {
// Note: MBDN was not included in NUM_OF_SIM_RECORDS_LOADED
new AdnRecordLoader(phone).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, EF_EXT1, 1, obtainMessage(EVENT_GET_CPHS_MAILBOX_DONE));
}
break;
case EVENT_GET_CPHS_MAILBOX_DONE:
case EVENT_GET_MBDN_DONE:
//Resetting the voice mail number and voice mail tag to null
//as these should be updated from the data read from EF_MBDN.
//If they are not reset, incase of invalid data/exception these
//variables are retaining their previous values and are
//causing invalid voice mailbox info display to user.
voiceMailNum = null;
voiceMailTag = null;
isRecordLoadResponse = true;
ar = (AsyncResult) msg.obj;
if (ar.exception != null) {
Log.d(LOG_TAG, "Invalid or missing EF" + ((msg.what == EVENT_GET_CPHS_MAILBOX_DONE) ? "[MAILBOX]" : "[MBDN]"));
if (msg.what == EVENT_GET_MBDN_DONE) {
//load CPHS on fail...
// FIXME right now, only load line1's CPHS voice mail entry
recordsToLoad += 1;
new AdnRecordLoader(phone).loadFromEF(EF_MAILBOX_CPHS, EF_EXT1, 1, obtainMessage(EVENT_GET_CPHS_MAILBOX_DONE));
}
break;
}
adn = (AdnRecord) ar.result;
Log.d(LOG_TAG, "VM: " + adn + ((msg.what == EVENT_GET_CPHS_MAILBOX_DONE) ? " EF[MAILBOX]" : " EF[MBDN]"));
if (adn.isEmpty() && msg.what == EVENT_GET_MBDN_DONE) {
// Bug #645770 fall back to CPHS
// FIXME should use SST to decide
// FIXME right now, only load line1's CPHS voice mail entry
recordsToLoad += 1;
new AdnRecordLoader(phone).loadFromEF(EF_MAILBOX_CPHS, EF_EXT1, 1, obtainMessage(EVENT_GET_CPHS_MAILBOX_DONE));
break;
}
voiceMailNum = adn.getNumber();
voiceMailTag = adn.getAlphaTag();
break;
case EVENT_GET_MSISDN_DONE:
isRecordLoadResponse = true;
ar = (AsyncResult) msg.obj;
if (ar.exception != null) {
Log.d(LOG_TAG, "Invalid or missing EF[MSISDN]");
break;
}
adn = (AdnRecord) ar.result;
msisdn = adn.getNumber();
msisdnTag = adn.getAlphaTag();
Log.d(LOG_TAG, "MSISDN: " + /*msisdn*/
"xxxxxxx");
break;
case EVENT_SET_MSISDN_DONE:
isRecordLoadResponse = false;
ar = (AsyncResult) msg.obj;
if (ar.userObj != null) {
AsyncResult.forMessage(((Message) ar.userObj)).exception = ar.exception;
((Message) ar.userObj).sendToTarget();
}
break;
case EVENT_GET_MWIS_DONE:
isRecordLoadResponse = true;
ar = (AsyncResult) msg.obj;
data = (byte[]) ar.result;
if (ar.exception != null) {
break;
}
Log.d(LOG_TAG, "EF_MWIS: " + IccUtils.bytesToHexString(data));
efMWIS = data;
if ((data[0] & 0xff) == 0xff) {
Log.d(LOG_TAG, "SIMRecords: Uninitialized record MWIS");
break;
}
// Refer TS 51.011 Section 10.3.45 for the content description
boolean voiceMailWaiting = ((data[0] & 0x01) != 0);
countVoiceMessages = data[1] & 0xff;
if (voiceMailWaiting && countVoiceMessages == 0) {
// Unknown count = -1
countVoiceMessages = -1;
}
phone.notifyMessageWaitingIndicator();
break;
case EVENT_GET_VOICE_MAIL_INDICATOR_CPHS_DONE:
isRecordLoadResponse = true;
ar = (AsyncResult) msg.obj;
data = (byte[]) ar.result;
if (ar.exception != null) {
break;
}
efCPHS_MWI = data;
if (efMWIS == null) {
int indicator = (int) (data[0] & 0xf);
// Refer CPHS4_2.WW6 B4.2.3
if (indicator == 0xA) {
// Unknown count = -1
countVoiceMessages = -1;
} else if (indicator == 0x5) {
countVoiceMessages = 0;
}
phone.notifyMessageWaitingIndicator();
}
break;
case EVENT_GET_ICCID_DONE:
isRecordLoadResponse = true;
ar = (AsyncResult) msg.obj;
data = (byte[]) ar.result;
if (ar.exception != null) {
break;
}
iccid = IccUtils.bcdToString(data, 0, data.length);
Log.d(LOG_TAG, "iccid: " + iccid);
break;
case EVENT_GET_AD_DONE:
try {
isRecordLoadResponse = true;
ar = (AsyncResult) msg.obj;
data = (byte[]) ar.result;
if (ar.exception != null) {
break;
}
Log.d(LOG_TAG, "EF_AD: " + IccUtils.bytesToHexString(data));
if (data.length < 3) {
Log.d(LOG_TAG, "SIMRecords: Corrupt AD data on SIM");
break;
}
if (data.length == 3) {
Log.d(LOG_TAG, "SIMRecords: MNC length not present in EF_AD");
break;
}
mncLength = (int) data[3] & 0xf;
if (mncLength == 0xf) {
mncLength = UNKNOWN;
}
} finally {
if (((mncLength == UNINITIALIZED) || (mncLength == UNKNOWN) || (mncLength == 2)) && ((imsi != null) && (imsi.length() >= 6))) {
String mccmncCode = imsi.substring(0, 6);
for (String mccmnc : MCCMNC_CODES_HAVING_3DIGITS_MNC) {
if (mccmnc.equals(mccmncCode)) {
mncLength = 3;
break;
}
}
}
if (mncLength == UNKNOWN || mncLength == UNINITIALIZED) {
if (imsi != null) {
try {
int mcc = Integer.parseInt(imsi.substring(0, 3));
mncLength = MccTable.smallestDigitsMccForMnc(mcc);
} catch (NumberFormatException e) {
mncLength = UNKNOWN;
Log.e(LOG_TAG, "SIMRecords: Corrupt IMSI!");
}
} else {
// Indicate we got this info, but it didn't contain the length.
mncLength = UNKNOWN;
Log.d(LOG_TAG, "SIMRecords: MNC length not present in EF_AD");
}
}
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));
}
}
break;
case EVENT_GET_SPN_DONE:
isRecordLoadResponse = true;
ar = (AsyncResult) msg.obj;
getSpnFsm(false, ar);
break;
case EVENT_GET_CFF_DONE:
isRecordLoadResponse = true;
ar = (AsyncResult) msg.obj;
data = (byte[]) ar.result;
if (ar.exception != null) {
break;
}
Log.d(LOG_TAG, "EF_CFF_CPHS: " + IccUtils.bytesToHexString(data));
mEfCff = data;
if (mEfCfis == null) {
callForwardingEnabled = ((data[0] & CFF_LINE1_MASK) == CFF_UNCONDITIONAL_ACTIVE);
phone.notifyCallForwardingIndicator();
}
break;
case EVENT_GET_SPDI_DONE:
isRecordLoadResponse = true;
ar = (AsyncResult) msg.obj;
data = (byte[]) ar.result;
if (ar.exception != null) {
break;
}
parseEfSpdi(data);
break;
case EVENT_UPDATE_DONE:
ar = (AsyncResult) msg.obj;
if (ar.exception != null) {
Log.i(LOG_TAG, "SIMRecords update failed", ar.exception);
}
break;
case EVENT_GET_PNN_DONE:
isRecordLoadResponse = true;
ar = (AsyncResult) msg.obj;
data = (byte[]) ar.result;
if (ar.exception != null) {
break;
}
SimTlv tlv = new SimTlv(data, 0, data.length);
for (; tlv.isValidObject(); tlv.nextObject()) {
if (tlv.getTag() == TAG_FULL_NETWORK_NAME) {
pnnHomeName = IccUtils.networkNameToString(tlv.getData(), 0, tlv.getData().length);
break;
}
}
break;
case EVENT_GET_ALL_SMS_DONE:
isRecordLoadResponse = true;
ar = (AsyncResult) msg.obj;
if (ar.exception != null)
break;
handleSmses((ArrayList) ar.result);
break;
case EVENT_MARK_SMS_READ_DONE:
Log.i("ENF", "marked read: sms " + msg.arg1);
break;
case EVENT_SMS_ON_SIM:
isRecordLoadResponse = false;
ar = (AsyncResult) msg.obj;
int[] index = (int[]) ar.result;
if (ar.exception != null || index.length != 1) {
Log.e(LOG_TAG, "[SIMRecords] Error on SMS_ON_SIM with exp " + ar.exception + " length " + index.length);
} else {
Log.d(LOG_TAG, "READ EF_SMS RECORD index=" + index[0]);
phone.getIccFileHandler().loadEFLinearFixed(EF_SMS, index[0], obtainMessage(EVENT_GET_SMS_DONE));
}
break;
case EVENT_GET_SMS_DONE:
isRecordLoadResponse = false;
ar = (AsyncResult) msg.obj;
if (ar.exception == null) {
handleSms((byte[]) ar.result);
} else {
Log.e(LOG_TAG, "[SIMRecords] Error on GET_SMS with exp " + ar.exception);
}
break;
case EVENT_GET_SST_DONE:
isRecordLoadResponse = true;
ar = (AsyncResult) msg.obj;
data = (byte[]) ar.result;
if (ar.exception != null) {
break;
}
//Log.d(LOG_TAG, "SST: " + IccUtils.bytesToHexString(data));
break;
case EVENT_GET_INFO_CPHS_DONE:
isRecordLoadResponse = true;
ar = (AsyncResult) msg.obj;
if (ar.exception != null) {
break;
}
mCphsInfo = (byte[]) ar.result;
if (DBG)
log("iCPHS: " + IccUtils.bytesToHexString(mCphsInfo));
break;
case EVENT_SET_MBDN_DONE:
isRecordLoadResponse = false;
ar = (AsyncResult) msg.obj;
if (ar.exception == null) {
voiceMailNum = newVoiceMailNum;
voiceMailTag = newVoiceMailTag;
}
if (isCphsMailboxEnabled()) {
adn = new AdnRecord(voiceMailTag, voiceMailNum);
Message onCphsCompleted = (Message) ar.userObj;
/* write to cphs mailbox whenever it is available but
* we only need notify caller once if both updating are
* successful.
*
* so if set_mbdn successful, notify caller here and set
* onCphsCompleted to null
*/
if (ar.exception == null && ar.userObj != null) {
AsyncResult.forMessage(((Message) ar.userObj)).exception = null;
((Message) ar.userObj).sendToTarget();
if (DBG)
log("Callback with MBDN successful.");
onCphsCompleted = null;
}
new AdnRecordLoader(phone).updateEF(adn, EF_MAILBOX_CPHS, EF_EXT1, 1, null, obtainMessage(EVENT_SET_CPHS_MAILBOX_DONE, onCphsCompleted));
} else {
if (ar.userObj != null) {
AsyncResult.forMessage(((Message) ar.userObj)).exception = ar.exception;
((Message) ar.userObj).sendToTarget();
}
}
break;
case EVENT_SET_CPHS_MAILBOX_DONE:
isRecordLoadResponse = false;
ar = (AsyncResult) msg.obj;
if (ar.exception == null) {
voiceMailNum = newVoiceMailNum;
voiceMailTag = newVoiceMailTag;
} else {
if (DBG)
log("Set CPHS MailBox with exception: " + ar.exception);
}
if (ar.userObj != null) {
if (DBG)
log("Callback with CPHS MB successful.");
AsyncResult.forMessage(((Message) ar.userObj)).exception = ar.exception;
((Message) ar.userObj).sendToTarget();
}
break;
case EVENT_SIM_REFRESH:
isRecordLoadResponse = false;
ar = (AsyncResult) msg.obj;
if (DBG)
log("Sim REFRESH with exception: " + ar.exception);
if (ar.exception == null) {
handleSimRefresh((int[]) (ar.result));
}
break;
case EVENT_GET_CFIS_DONE:
isRecordLoadResponse = true;
ar = (AsyncResult) msg.obj;
data = (byte[]) ar.result;
if (ar.exception != null) {
break;
}
Log.d(LOG_TAG, "EF_CFIS: " + IccUtils.bytesToHexString(data));
mEfCfis = data;
// Refer TS 51.011 Section 10.3.46 for the content description
callForwardingEnabled = ((data[1] & 0x01) != 0);
phone.notifyCallForwardingIndicator();
break;
case EVENT_GET_CSP_CPHS_DONE:
isRecordLoadResponse = true;
ar = (AsyncResult) msg.obj;
if (ar.exception != null) {
Log.e(LOG_TAG, "Exception in fetching EF_CSP data " + ar.exception);
break;
}
data = (byte[]) ar.result;
Log.i(LOG_TAG, "EF_CSP: " + IccUtils.bytesToHexString(data));
handleEfCspData(data);
break;
default:
// IccRecords handles generic record load responses
super.handleMessage(msg);
}
} catch (RuntimeException exc) {
// I don't want these exceptions to be fatal
Log.w(LOG_TAG, "Exception parsing SIM record", exc);
} finally {
// Count up record load responses even if they are fails
if (isRecordLoadResponse) {
onRecordLoaded();
}
}
}
use of com.android.internal.telephony.AdnRecordLoader in project XobotOS by xamarin.
the class SIMRecords method fetchSimRecords.
protected void fetchSimRecords() {
recordsRequested = true;
IccFileHandler iccFh = phone.getIccFileHandler();
Log.v(LOG_TAG, "SIMRecords:fetchSimRecords " + recordsToLoad);
phone.mCM.getIMSI(obtainMessage(EVENT_GET_IMSI_DONE));
recordsToLoad++;
iccFh.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, obtainMessage(EVENT_GET_MSISDN_DONE));
recordsToLoad++;
// Record number is subscriber profile
iccFh.loadEFLinearFixed(EF_MBI, 1, obtainMessage(EVENT_GET_MBI_DONE));
recordsToLoad++;
iccFh.loadEFTransparent(EF_AD, obtainMessage(EVENT_GET_AD_DONE));
recordsToLoad++;
// Record number is subscriber profile
iccFh.loadEFLinearFixed(EF_MWIS, 1, obtainMessage(EVENT_GET_MWIS_DONE));
recordsToLoad++;
// Also load CPHS-style voice mail indicator, which stores
// 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(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));
recordsToLoad++;
iccFh.loadEFTransparent(EF_CFF_CPHS, obtainMessage(EVENT_GET_CFF_DONE));
recordsToLoad++;
getSpnFsm(true, null);
iccFh.loadEFTransparent(EF_SPDI, obtainMessage(EVENT_GET_SPDI_DONE));
recordsToLoad++;
iccFh.loadEFLinearFixed(EF_PNN, 1, obtainMessage(EVENT_GET_PNN_DONE));
recordsToLoad++;
iccFh.loadEFTransparent(EF_SST, obtainMessage(EVENT_GET_SST_DONE));
recordsToLoad++;
iccFh.loadEFTransparent(EF_INFO_CPHS, obtainMessage(EVENT_GET_INFO_CPHS_DONE));
recordsToLoad++;
iccFh.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));
recordsToLoad++;
}
if (CRASH_RIL) {
String sms = "0107912160130310f20404d0110041007030208054832b0120" + "fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" + "fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" + "fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" + "fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" + "ffffffffffffffffffffffffffffff";
byte[] ba = IccUtils.hexStringToBytes(sms);
iccFh.updateEFLinearFixed(EF_SMS, 1, ba, null, obtainMessage(EVENT_MARK_SMS_READ_DONE, 1));
}
}
use of com.android.internal.telephony.AdnRecordLoader in project XobotOS by xamarin.
the class SIMRecords method setMsisdnNumber.
/**
* Set subscriber number to SIM record
*
* The subscriber number is stored in EF_MSISDN (TS 51.011)
*
* When the operation is complete, onComplete will be sent to its handler
*
* @param alphaTag alpha-tagging of the dailing nubmer (up to 10 characters)
* @param number dailing nubmer (up to 20 digits)
* if the number starts with '+', then set to international TOA
* @param onComplete
* onComplete.obj will be an AsyncResult
* ((AsyncResult)onComplete.obj).exception == null on success
* ((AsyncResult)onComplete.obj).exception != null on fail
*/
public void setMsisdnNumber(String alphaTag, String number, Message onComplete) {
msisdn = number;
msisdnTag = alphaTag;
if (DBG)
log("Set MSISDN: " + msisdnTag + " " + /*msisdn*/
"xxxxxxx");
AdnRecord adn = new AdnRecord(msisdnTag, msisdn);
new AdnRecordLoader(phone).updateEF(adn, EF_MSISDN, EF_EXT1, 1, null, obtainMessage(EVENT_SET_MSISDN_DONE, onComplete));
}
use of com.android.internal.telephony.AdnRecordLoader in project XobotOS by xamarin.
the class SIMRecords method setVoiceMailNumber.
/**
* Set voice mail number to SIM record
*
* The voice mail number can be stored either in EF_MBDN (TS 51.011) or
* EF_MAILBOX_CPHS (CPHS 4.2)
*
* If EF_MBDN is available, store the voice mail number to EF_MBDN
*
* If EF_MAILBOX_CPHS is enabled, store the voice mail number to EF_CHPS
*
* So the voice mail number will be stored in both EFs if both are available
*
* Return error only if both EF_MBDN and EF_MAILBOX_CPHS fail.
*
* When the operation is complete, onComplete will be sent to its handler
*
* @param alphaTag alpha-tagging of the dailing nubmer (upto 10 characters)
* @param voiceNumber dailing nubmer (upto 20 digits)
* if the number is start with '+', then set to international TOA
* @param onComplete
* onComplete.obj will be an AsyncResult
* ((AsyncResult)onComplete.obj).exception == null on success
* ((AsyncResult)onComplete.obj).exception != null on fail
*/
public void setVoiceMailNumber(String alphaTag, String voiceNumber, Message onComplete) {
if (isVoiceMailFixed) {
AsyncResult.forMessage((onComplete)).exception = new IccVmFixedException("Voicemail number is fixed by operator");
onComplete.sendToTarget();
return;
}
newVoiceMailNum = voiceNumber;
newVoiceMailTag = alphaTag;
AdnRecord adn = new AdnRecord(newVoiceMailTag, newVoiceMailNum);
if (mailboxIndex != 0 && mailboxIndex != 0xff) {
new AdnRecordLoader(phone).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, EF_EXT1, 1, null, obtainMessage(EVENT_SET_CPHS_MAILBOX_DONE, onComplete));
} else {
AsyncResult.forMessage((onComplete)).exception = new IccVmNotSupportedException("Update SIM voice mailbox error");
onComplete.sendToTarget();
}
}
Aggregations