use of com.android.internal.telephony.CommandException in project android_frameworks_opt_telephony by LineageOS.
the class ImsPhone method sendResponse.
private void sendResponse(Message onComplete, Object result, Throwable e) {
if (onComplete != null) {
CommandException ex = null;
if (e != null) {
ex = getCommandException(e);
}
AsyncResult.forMessage(onComplete, result, ex);
onComplete.sendToTarget();
}
}
use of com.android.internal.telephony.CommandException in project android_frameworks_opt_telephony by LineageOS.
the class ImsPhone method getCommandException.
private CommandException getCommandException(Throwable e) {
CommandException ex = null;
if (e instanceof ImsException) {
ex = getCommandException(((ImsException) e).getCode(), e.getMessage());
} else {
Rlog.d(LOG_TAG, "getCommandException generic failure");
ex = new CommandException(CommandException.Error.GENERIC_FAILURE);
}
return ex;
}
use of com.android.internal.telephony.CommandException in project android_frameworks_opt_telephony by LineageOS.
the class SimulatedCommands method supplyIccPin.
@Override
public void supplyIccPin(String pin, Message result) {
if (mSimLockedState != SimLockState.REQUIRE_PIN) {
Rlog.i(LOG_TAG, "[SimCmd] supplyIccPin: wrong state, state=" + mSimLockedState);
CommandException ex = new CommandException(CommandException.Error.PASSWORD_INCORRECT);
resultFail(result, null, ex);
return;
}
if (pin != null && pin.equals(mPinCode)) {
Rlog.i(LOG_TAG, "[SimCmd] supplyIccPin: success!");
mPinUnlockAttempts = 0;
mSimLockedState = SimLockState.NONE;
mIccStatusChangedRegistrants.notifyRegistrants();
resultSuccess(result, null);
return;
}
if (result != null) {
mPinUnlockAttempts++;
Rlog.i(LOG_TAG, "[SimCmd] supplyIccPin: failed! attempt=" + mPinUnlockAttempts);
if (mPinUnlockAttempts >= DEFAULT_PIN1_ATTEMPT) {
Rlog.i(LOG_TAG, "[SimCmd] supplyIccPin: set state to REQUIRE_PUK");
mSimLockedState = SimLockState.REQUIRE_PUK;
}
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 changeIccPin2.
@Override
public void changeIccPin2(String oldPin2, String newPin2, Message result) {
if (oldPin2 != null && oldPin2.equals(mPin2Code)) {
mPin2Code = newPin2;
resultSuccess(result, null);
return;
}
Rlog.i(LOG_TAG, "[SimCmd] changeIccPin2: pin2 failed!");
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 supplyIccPuk2.
@Override
public void supplyIccPuk2(String puk2, String newPin2, Message result) {
if (mSimFdnEnabledState != SimFdnState.REQUIRE_PUK2) {
Rlog.i(LOG_TAG, "[SimCmd] supplyIccPuk2: wrong state, state=" + mSimLockedState);
CommandException ex = new CommandException(CommandException.Error.PASSWORD_INCORRECT);
resultFail(result, null, ex);
return;
}
if (puk2 != null && puk2.equals(SIM_PUK2_CODE)) {
Rlog.i(LOG_TAG, "[SimCmd] supplyIccPuk2: success!");
mSimFdnEnabledState = SimFdnState.NONE;
mPuk2UnlockAttempts = 0;
resultSuccess(result, null);
return;
}
if (result != null) {
mPuk2UnlockAttempts++;
Rlog.i(LOG_TAG, "[SimCmd] supplyIccPuk2: failed! attempt=" + mPuk2UnlockAttempts);
if (mPuk2UnlockAttempts >= 10) {
Rlog.i(LOG_TAG, "[SimCmd] supplyIccPuk2: set state to SIM_PERM_LOCKED");
mSimFdnEnabledState = SimFdnState.SIM_PERM_LOCKED;
}
CommandException ex = new CommandException(CommandException.Error.PASSWORD_INCORRECT);
resultFail(result, null, ex);
}
}
Aggregations