use of com.android.internal.telephony.IccVmFixedException 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