use of com.android.internal.telephony.CommandException in project android_frameworks_opt_telephony by LineageOS.
the class SimulatedCommands method supplyIccPin2.
@Override
public void supplyIccPin2(String pin2, Message result) {
if (mSimFdnEnabledState != SimFdnState.REQUIRE_PIN2) {
Rlog.i(LOG_TAG, "[SimCmd] supplyIccPin2: wrong state, state=" + mSimFdnEnabledState);
CommandException ex = new CommandException(CommandException.Error.PASSWORD_INCORRECT);
resultFail(result, null, ex);
return;
}
if (pin2 != null && pin2.equals(mPin2Code)) {
Rlog.i(LOG_TAG, "[SimCmd] supplyIccPin2: success!");
mPin2UnlockAttempts = 0;
mSimFdnEnabledState = SimFdnState.NONE;
resultSuccess(result, null);
return;
}
if (result != null) {
mPin2UnlockAttempts++;
Rlog.i(LOG_TAG, "[SimCmd] supplyIccPin2: failed! attempt=" + mPin2UnlockAttempts);
if (mPin2UnlockAttempts >= DEFAULT_PIN2_ATTEMPT) {
Rlog.i(LOG_TAG, "[SimCmd] supplyIccPin2: set state to REQUIRE_PUK2");
mSimFdnEnabledState = SimFdnState.REQUIRE_PUK2;
}
CommandException ex = new CommandException(CommandException.Error.PASSWORD_INCORRECT);
resultFail(result, null, ex);
}
}
use of com.android.internal.telephony.CommandException in project android_frameworks_opt_telephony by LineageOS.
the class SimulatedCommands method supplyIccPuk.
@Override
public void supplyIccPuk(String puk, String newPin, Message result) {
if (mSimLockedState != SimLockState.REQUIRE_PUK) {
Rlog.i(LOG_TAG, "[SimCmd] supplyIccPuk: wrong state, state=" + mSimLockedState);
CommandException ex = new CommandException(CommandException.Error.PASSWORD_INCORRECT);
resultFail(result, null, ex);
return;
}
if (puk != null && puk.equals(SIM_PUK_CODE)) {
Rlog.i(LOG_TAG, "[SimCmd] supplyIccPuk: success!");
mSimLockedState = SimLockState.NONE;
mPukUnlockAttempts = 0;
mIccStatusChangedRegistrants.notifyRegistrants();
resultSuccess(result, null);
return;
}
if (result != null) {
mPukUnlockAttempts++;
Rlog.i(LOG_TAG, "[SimCmd] supplyIccPuk: failed! attempt=" + mPukUnlockAttempts);
if (mPukUnlockAttempts >= 10) {
Rlog.i(LOG_TAG, "[SimCmd] supplyIccPuk: set state to SIM_PERM_LOCKED");
mSimLockedState = SimLockState.SIM_PERM_LOCKED;
}
CommandException ex = new CommandException(CommandException.Error.PASSWORD_INCORRECT);
resultFail(result, null, ex);
}
}
use of com.android.internal.telephony.CommandException in project android_frameworks_opt_telephony by LineageOS.
the class SimulatedCommands method supplyIccPinForApp.
@Override
public void supplyIccPinForApp(String pin, String aid, Message response) {
SimulatedCommandsVerifier.getInstance().supplyIccPinForApp(pin, aid, response);
if (mPinCode != null && mPinCode.equals(pin)) {
resultSuccess(response, null);
return;
}
Rlog.i(LOG_TAG, "[SimCmd] supplyIccPinForApp: pin failed!");
CommandException ex = new CommandException(CommandException.Error.PASSWORD_INCORRECT);
resultFail(response, new int[] { (--mPin1attemptsRemaining < 0) ? 0 : mPin1attemptsRemaining }, ex);
}
use of com.android.internal.telephony.CommandException in project android_frameworks_opt_telephony by LineageOS.
the class GsmMmiCode method parseSsData.
void parseSsData(SsData ssData) {
CommandException ex;
ex = CommandException.fromRilErrno(ssData.result);
mSc = getScStringFromScType(ssData.serviceType);
mAction = getActionStringFromReqType(ssData.requestType);
Rlog.d(LOG_TAG, "parseSsData msc = " + mSc + ", action = " + mAction + ", ex = " + ex);
switch(ssData.requestType) {
case SS_ACTIVATION:
case SS_DEACTIVATION:
case SS_REGISTRATION:
case SS_ERASURE:
if ((ssData.result == RILConstants.SUCCESS) && ssData.serviceType.isTypeUnConditional()) {
/*
* When ServiceType is SS_CFU/SS_CF_ALL and RequestType is activate/register
* and ServiceClass is Voice/None, set IccRecords.setVoiceCallForwardingFlag.
* Only CF status can be set here since number is not available.
*/
boolean cffEnabled = ((ssData.requestType == SsData.RequestType.SS_ACTIVATION || ssData.requestType == SsData.RequestType.SS_REGISTRATION) && isServiceClassVoiceorNone(ssData.serviceClass));
Rlog.d(LOG_TAG, "setVoiceCallForwardingFlag cffEnabled: " + cffEnabled);
if (mIccRecords != null) {
mPhone.setVoiceCallForwardingFlag(1, cffEnabled, null);
Rlog.d(LOG_TAG, "setVoiceCallForwardingFlag done from SS Info.");
} else {
Rlog.e(LOG_TAG, "setVoiceCallForwardingFlag aborted. sim records is null.");
}
}
onSetComplete(null, new AsyncResult(null, ssData.cfInfo, ex));
break;
case SS_INTERROGATION:
if (ssData.serviceType.isTypeClir()) {
Rlog.d(LOG_TAG, "CLIR INTERROGATION");
onGetClirComplete(new AsyncResult(null, ssData.ssInfo, ex));
} else if (ssData.serviceType.isTypeCF()) {
Rlog.d(LOG_TAG, "CALL FORWARD INTERROGATION");
onQueryCfComplete(new AsyncResult(null, ssData.cfInfo, ex));
} else {
onQueryComplete(new AsyncResult(null, ssData.ssInfo, ex));
}
break;
default:
Rlog.e(LOG_TAG, "Invaid requestType in SSData : " + ssData.requestType);
break;
}
}
use of com.android.internal.telephony.CommandException in project android_frameworks_opt_telephony by LineageOS.
the class ImsPhone method sendErrorResponse.
private void sendErrorResponse(Message onComplete) {
Rlog.d(LOG_TAG, "sendErrorResponse");
if (onComplete != null) {
AsyncResult.forMessage(onComplete, null, new CommandException(CommandException.Error.GENERIC_FAILURE));
onComplete.sendToTarget();
}
}
Aggregations