Files
frameworks_base/telephony/java/com/android/internal/telephony/CommandException.java
Naveen Kalla 18573e9281 Support to display message when operation is blocked due to FDN being enabled
The terminal disallows USSD, SMS, Voice Call and Supplementary services
operations for numbers not in the Fixed Dialing Number (FDN) list when the
FDN service is enabled. FDN_CHECK_FAILURE error is sent from the RIL and the
message needs to be displayed to indicate the failure.

Change-Id: I49bd63f69a3f0201125b17cd16db2e8fcf93ddc3
2010-05-11 09:12:00 -07:00

96 lines
3.4 KiB
Java

/*
* Copyright (C) 2007 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.internal.telephony;
import com.android.internal.telephony.RILConstants;
import android.util.Log;
/**
* {@hide}
*/
public class CommandException extends RuntimeException {
private Error e;
public enum Error {
INVALID_RESPONSE,
RADIO_NOT_AVAILABLE,
GENERIC_FAILURE,
PASSWORD_INCORRECT,
SIM_PIN2,
SIM_PUK2,
REQUEST_NOT_SUPPORTED,
OP_NOT_ALLOWED_DURING_VOICE_CALL,
OP_NOT_ALLOWED_BEFORE_REG_NW,
SMS_FAIL_RETRY,
SIM_ABSENT,
SUBSCRIPTION_NOT_AVAILABLE,
MODE_NOT_SUPPORTED,
FDN_CHECK_FAILURE,
}
public CommandException(Error e) {
super(e.toString());
this.e = e;
}
public static CommandException
fromRilErrno(int ril_errno) {
switch(ril_errno) {
case RILConstants.SUCCESS: return null;
case RILConstants.RIL_ERRNO_INVALID_RESPONSE:
return new CommandException(Error.INVALID_RESPONSE);
case RILConstants.RADIO_NOT_AVAILABLE:
return new CommandException(Error.RADIO_NOT_AVAILABLE);
case RILConstants.GENERIC_FAILURE:
return new CommandException(Error.GENERIC_FAILURE);
case RILConstants.PASSWORD_INCORRECT:
return new CommandException(Error.PASSWORD_INCORRECT);
case RILConstants.SIM_PIN2:
return new CommandException(Error.SIM_PIN2);
case RILConstants.SIM_PUK2:
return new CommandException(Error.SIM_PUK2);
case RILConstants.REQUEST_NOT_SUPPORTED:
return new CommandException(Error.REQUEST_NOT_SUPPORTED);
case RILConstants.OP_NOT_ALLOWED_DURING_VOICE_CALL:
return new CommandException(Error.OP_NOT_ALLOWED_DURING_VOICE_CALL);
case RILConstants.OP_NOT_ALLOWED_BEFORE_REG_NW:
return new CommandException(Error.OP_NOT_ALLOWED_BEFORE_REG_NW);
case RILConstants.SMS_SEND_FAIL_RETRY:
return new CommandException(Error.SMS_FAIL_RETRY);
case RILConstants.SIM_ABSENT:
return new CommandException(Error.SIM_ABSENT);
case RILConstants.SUBSCRIPTION_NOT_AVAILABLE:
return new CommandException(Error.SUBSCRIPTION_NOT_AVAILABLE);
case RILConstants.MODE_NOT_SUPPORTED:
return new CommandException(Error.MODE_NOT_SUPPORTED);
case RILConstants.FDN_CHECK_FAILURE:
return new CommandException(Error.FDN_CHECK_FAILURE);
default:
Log.e("GSM", "Unrecognized RIL errno " + ril_errno);
return new CommandException(Error.INVALID_RESPONSE);
}
}
public Error getCommandError() {
return e;
}
}