FileDocCategorySizeDatePackage
SimulatedCommands.javaAPI DocAndroid 5.1 API53089Thu Mar 12 22:22:54 GMT 2015com.android.internal.telephony.test

SimulatedCommands

public final class SimulatedCommands extends com.android.internal.telephony.BaseCommands implements com.android.internal.telephony.CommandsInterface, SimulatedRadioControl

Fields Summary
private static final String
LOG_TAG
private static final SimLockState
INITIAL_LOCK_STATE
private static final String
DEFAULT_SIM_PIN_CODE
private static final String
SIM_PUK_CODE
private static final SimFdnState
INITIAL_FDN_STATE
private static final String
DEFAULT_SIM_PIN2_CODE
private static final String
SIM_PUK2_CODE
SimulatedGsmCallState
simulatedCallState
android.os.HandlerThread
mHandlerThread
SimLockState
mSimLockedState
boolean
mSimLockEnabled
int
mPinUnlockAttempts
int
mPukUnlockAttempts
String
mPinCode
SimFdnState
mSimFdnEnabledState
boolean
mSimFdnEnabled
int
mPin2UnlockAttempts
int
mPuk2UnlockAttempts
int
mNetworkType
String
mPin2Code
boolean
mSsnNotifyOn
int
mPausedResponseCount
ArrayList
mPausedResponses
int
mNextCallFailCause
Constructors Summary
public SimulatedCommands()


    //***** Constructor

    
     
        super(null);  // Don't log statistics
        mHandlerThread = new HandlerThread("SimulatedCommands");
        mHandlerThread.start();
        Looper looper = mHandlerThread.getLooper();

        simulatedCallState = new SimulatedGsmCallState(looper);

        setRadioState(RadioState.RADIO_OFF);
        mSimLockedState = INITIAL_LOCK_STATE;
        mSimLockEnabled = (mSimLockedState != SimLockState.NONE);
        mPinCode = DEFAULT_SIM_PIN_CODE;
        mSimFdnEnabledState = INITIAL_FDN_STATE;
        mSimFdnEnabled = (mSimFdnEnabledState != SimFdnState.NONE);
        mPin2Code = DEFAULT_SIM_PIN2_CODE;
    
Methods Summary
public voidacceptCall(android.os.Message result)
ar.exception carries exception on failure ar.userObject contains the original value of result.obj ar.result is null on success and failure

        boolean success;

        success = simulatedCallState.onAnswer();

        if (!success){
            resultFail(result, new RuntimeException("Hangup Error"));
        } else {
            resultSuccess(result, null);
        }
    
public voidacknowledgeIncomingGsmSmsWithPdu(boolean success, java.lang.String ackPdu, android.os.Message result)

        unimplemented(result);
    
public voidacknowledgeLastIncomingCdmaSms(boolean success, int cause, android.os.Message result)

        unimplemented(result);
    
public voidacknowledgeLastIncomingGsmSms(boolean success, int cause, android.os.Message result)

        unimplemented(result);
    
public voidcancelPendingUssd(android.os.Message response)

        resultSuccess(response, null);
    
public voidchangeBarringPassword(java.lang.String facility, java.lang.String oldPwd, java.lang.String newPwd, android.os.Message result)

        unimplemented(result);
    
public voidchangeIccPin(java.lang.String oldPin, java.lang.String newPin, android.os.Message result)

        if (oldPin != null && oldPin.equals(mPinCode)) {
            mPinCode = newPin;
            if (result != null) {
                AsyncResult.forMessage(result, null, null);
                result.sendToTarget();
            }

            return;
        }

        if (result != null) {
            Rlog.i(LOG_TAG, "[SimCmd] changeIccPin: pin failed!");

            CommandException ex = new CommandException(
                    CommandException.Error.PASSWORD_INCORRECT);
            AsyncResult.forMessage(result, null, ex);
            result.sendToTarget();
        }
    
public voidchangeIccPin2(java.lang.String oldPin2, java.lang.String newPin2, android.os.Message result)

        if (oldPin2 != null && oldPin2.equals(mPin2Code)) {
            mPin2Code = newPin2;
            if (result != null) {
                AsyncResult.forMessage(result, null, null);
                result.sendToTarget();
            }

            return;
        }

        if (result != null) {
            Rlog.i(LOG_TAG, "[SimCmd] changeIccPin2: pin2 failed!");

            CommandException ex = new CommandException(
                    CommandException.Error.PASSWORD_INCORRECT);
            AsyncResult.forMessage(result, null, ex);
            result.sendToTarget();
        }
    
public voidchangeIccPin2ForApp(java.lang.String oldPin2, java.lang.String newPin2, java.lang.String aidPtr, android.os.Message response)

        unimplemented(response);
    
public voidchangeIccPinForApp(java.lang.String oldPin, java.lang.String newPin, java.lang.String aidPtr, android.os.Message response)

        unimplemented(response);
    
public voidconference(android.os.Message result)
3GPP 22.030 6.5.5 "Adds a held call to the conversation" ar.exception carries exception on failure ar.userObject contains the original value of result.obj ar.result is null on success and failure

        boolean success;

        success = simulatedCallState.onChld('3", '\0");

        if (!success){
            resultFail(result, new RuntimeException("Hangup Error"));
        } else {
            resultSuccess(result, null);
        }
    
public voiddeactivateDataCall(int cid, int reason, android.os.Message result)

unimplemented(result);
public voiddeleteSmsOnRuim(int index, android.os.Message response)

        Rlog.d(LOG_TAG, "Delete RUIM message at index " + index);
        unimplemented(response);
    
public voiddeleteSmsOnSim(int index, android.os.Message response)

        Rlog.d(LOG_TAG, "Delete message at index " + index);
        unimplemented(response);
    
public voiddial(java.lang.String address, int clirMode, android.os.Message result)
returned message retMsg.obj = AsyncResult ar ar.exception carries exception on failure ar.userObject contains the original value of result.obj ar.result is null on success and failure CLIR_DEFAULT == on "use subscription default value" CLIR_SUPPRESSION == on "CLIR suppression" (allow CLI presentation) CLIR_INVOCATION == on "CLIR invocation" (restrict CLI presentation)

        simulatedCallState.onDial(address);

        resultSuccess(result, null);
    
public voiddial(java.lang.String address, int clirMode, com.android.internal.telephony.UUSInfo uusInfo, android.os.Message result)
returned message retMsg.obj = AsyncResult ar ar.exception carries exception on failure ar.userObject contains the original value of result.obj ar.result is null on success and failure CLIR_DEFAULT == on "use subscription default value" CLIR_SUPPRESSION == on "CLIR suppression" (allow CLI presentation) CLIR_INVOCATION == on "CLIR invocation" (restrict CLI presentation)

        simulatedCallState.onDial(address);

        resultSuccess(result, null);
    
public voidexitEmergencyCallbackMode(android.os.Message result)

unimplemented(result);
public voidexplicitCallTransfer(android.os.Message result)
3GPP 22.030 6.5.5 "Connects the two calls and disconnects the subscriber from both calls" ar.exception carries exception on failure ar.userObject contains the original value of result.obj ar.result is null on success and failure

        boolean success;

        success = simulatedCallState.onChld('4", '\0");

        if (!success){
            resultFail(result, new RuntimeException("Hangup Error"));
        } else {
            resultSuccess(result, null);
        }
    
public voidforceDataDormancy(android.os.Message response)

        unimplemented(response);
    
public voidgetAvailableNetworks(android.os.Message result)
Queries the currently available networks ((AsyncResult)response.obj).result is a List of NetworkInfo objects

unimplemented(result);
public voidgetBasebandVersion(android.os.Message result)

        resultSuccess(result, "SimulatedCommands");
    
public voidgetCDMASubscription(android.os.Message response)

        Rlog.w(LOG_TAG, "CDMA not implemented in SimulatedCommands");
        unimplemented(response);
    
public voidgetCLIR(android.os.Message result)
response.obj will be a an int[2] response.obj[0] will be TS 27.007 +CLIR parameter 'n' 0 presentation indicator is used according to the subscription of the CLIR service 1 CLIR invocation 2 CLIR suppression response.obj[1] will be TS 27.007 +CLIR parameter 'm' 0 CLIR not provisioned 1 CLIR provisioned in permanent mode 2 unknown (e.g. no network, etc.) 3 CLIR temporary mode presentation restricted 4 CLIR temporary mode presentation allowed

unimplemented(result);
public voidgetCdmaBroadcastConfig(android.os.Message response)

        unimplemented(response);

    
public voidgetCdmaSubscriptionSource(android.os.Message result)

        unimplemented(result);
    
public voidgetCellInfoList(android.os.Message response)

        unimplemented(response);
    
public voidgetCurrentCalls(android.os.Message result)
returned message retMsg.obj = AsyncResult ar ar.exception carries exception on failure ar.userObject contains the original value of result.obj ar.result contains a List of DriverCall The ar.result List is sorted by DriverCall.index

        if ((mState == RadioState.RADIO_ON) && !isSimLocked()) {
            //Rlog.i("GSM", "[SimCmds] getCurrentCalls");
            resultSuccess(result, simulatedCallState.getDriverCalls());
        } else {
            //Rlog.i("GSM", "[SimCmds] getCurrentCalls: RADIO_OFF or SIM not ready!");
            resultFail(result,
                new CommandException(
                    CommandException.Error.RADIO_NOT_AVAILABLE));
        }
    
public voidgetDataCallList(android.os.Message result)
returned message retMsg.obj = AsyncResult ar ar.exception carries exception on failure ar.userObject contains the original value of result.obj ar.result contains a List of DataCallResponse

        resultSuccess(result, new ArrayList<DataCallResponse>(0));
    
public voidgetDataRegistrationState(android.os.Message result)
response.obj.result is an String[4] response.obj.result[0] is registration state 0-5 from TS 27.007 7.2 response.obj.result[1] is LAC if registered or NULL if not response.obj.result[2] is CID if registered or NULL if not response.obj.result[3] indicates the available radio technology, where: 0 == unknown 1 == GPRS only 2 == EDGE 3 == UMTS valid LAC are 0x0000 - 0xffff valid CID are 0x00000000 - 0xffffffff Please note that registration state 4 ("unknown") is treated as "out of service" in the Android telephony system

        String ret[] = new String[4];

        ret[0] = "5"; // registered roam
        ret[1] = null;
        ret[2] = null;
        ret[3] = "2";

        resultSuccess(result, ret);
    
public voidgetDeviceIdentity(android.os.Message response)

        Rlog.w(LOG_TAG, "CDMA not implemented in SimulatedCommands");
        unimplemented(response);
    
public voidgetGsmBroadcastConfig(android.os.Message response)

        unimplemented(response);
    
public voidgetHardwareConfig(android.os.Message result)

        unimplemented(result);
    
public voidgetIMEI(android.os.Message result)
returned message retMsg.obj = AsyncResult ar ar.exception carries exception on failure ar.userObject contains the original value of result.obj ar.result is String containing IMEI on success

        resultSuccess(result, "012345678901234");
    
public voidgetIMEISV(android.os.Message result)
returned message retMsg.obj = AsyncResult ar ar.exception carries exception on failure ar.userObject contains the original value of result.obj ar.result is String containing IMEISV on success

        resultSuccess(result, "99");
    
public voidgetIMSI(android.os.Message result)

        getIMSIForApp(null, result);
    
public voidgetIMSIForApp(java.lang.String aid, android.os.Message result)
returned message retMsg.obj = AsyncResult ar ar.exception carries exception on failure ar.userObject contains the original value of result.obj ar.result is String containing IMSI on success

        resultSuccess(result, "012345678901234");
    
public voidgetIccCardStatus(android.os.Message result)

        unimplemented(result);
    
public voidgetImsRegistrationState(android.os.Message response)

        unimplemented(response);
    
public voidgetLastCallFailCause(android.os.Message result)
cause code returned as Integer in Message.obj.response Returns integer cause code defined in TS 24.008 Annex H or closest approximation. Most significant codes: - Any defined in 22.001 F.4 (for generating busy/congestion) - Cause 68: ACM >= ACMMax

        int[] ret = new int[1];

        ret[0] = mNextCallFailCause;
        resultSuccess(result, ret);
    
public voidgetLastDataCallFailCause(android.os.Message result)

        //
        unimplemented(result);
    
public voidgetLastPdpFailCause(android.os.Message result)

deprecated

        unimplemented(result);
    
public voidgetMute(android.os.Message result)

unimplemented(result);
public voidgetNeighboringCids(android.os.Message result)

        int ret[] = new int[7];

        ret[0] = 6;
        for (int i = 1; i<7; i++) {
            ret[i] = i;
        }
        resultSuccess(result, ret);
    
public voidgetNetworkSelectionMode(android.os.Message result)
Queries whether the current network selection mode is automatic or manual ((AsyncResult)response.obj).result is an int[] with element [0] being a 0 for automatic selection and a 1 for manual selection

        int ret[] = new int[1];

        ret[0] = 0;
        resultSuccess(result, ret);
    
public voidgetOperator(android.os.Message result)
response.obj.result is a String[3] response.obj.result[0] is long alpha or null if unregistered response.obj.result[1] is short alpha or null if unregistered response.obj.result[2] is numeric or null if unregistered

        String[] ret = new String[3];

        ret[0] = "El Telco Loco";
        ret[1] = "Telco Loco";
        ret[2] = "001001";

        resultSuccess(result, ret);
    
public voidgetPDPContextList(android.os.Message result)

deprecated

        getDataCallList(result);
    
public voidgetPreferredNetworkType(android.os.Message result)

        int ret[] = new int[1];

        ret[0] = mNetworkType;
        resultSuccess(result, ret);
    
public voidgetPreferredVoicePrivacy(android.os.Message result)

        Rlog.w(LOG_TAG, "CDMA not implemented in SimulatedCommands");
        unimplemented(result);
    
public voidgetSignalStrength(android.os.Message result)
response.obj is an AsyncResult response.obj.result is an int[2] response.obj.result[0] is received signal strength (0-31, 99) response.obj.result[1] is bit error rate (0-7, 99) as defined in TS 27.007 8.5

        int ret[] = new int[2];

        ret[0] = 23;
        ret[1] = 0;

        resultSuccess(result, ret);
    
public voidgetSmscAddress(android.os.Message result)

        unimplemented(result);
    
public voidgetVoiceRadioTechnology(android.os.Message response)

        unimplemented(response);
    
public voidgetVoiceRegistrationState(android.os.Message result)
response.obj.result is an String[14] See ril.h for details Please note that registration state 4 ("unknown") is treated as "out of service" above

        String ret[] = new String[14];

        ret[0] = "5"; // registered roam
        ret[1] = null;
        ret[2] = null;
        ret[3] = null;
        ret[4] = null;
        ret[5] = null;
        ret[6] = null;
        ret[7] = null;
        ret[8] = null;
        ret[9] = null;
        ret[10] = null;
        ret[11] = null;
        ret[12] = null;
        ret[13] = null;

        resultSuccess(result, ret);
    
public voidhandleCallSetupRequestFromSim(boolean accept, android.os.Message response)
{@inheritDoc}

        resultSuccess(response, null);
    
public voidhangupConnection(int gsmIndex, android.os.Message result)
Hang up one individual connection. returned message retMsg.obj = AsyncResult ar ar.exception carries exception on failure ar.userObject contains the original value of result.obj ar.result is null on success and failure 3GPP 22.030 6.5.5 "Releases a specific active call X"

        boolean success;

        success = simulatedCallState.onChld('1", (char)('0"+gsmIndex));

        if (!success){
            Rlog.i("GSM", "[SimCmd] hangupConnection: resultFail");
            resultFail(result, new RuntimeException("Hangup Error"));
        } else {
            Rlog.i("GSM", "[SimCmd] hangupConnection: resultSuccess");
            resultSuccess(result, null);
        }
    
public voidhangupForegroundResumeBackground(android.os.Message result)
3GPP 22.030 6.5.5 "Releases all active calls (if any exist) and accepts the other (held or waiting) call." ar.exception carries exception on failure ar.userObject contains the original value of result.obj ar.result is null on success and failure

        boolean success;

        success = simulatedCallState.onChld('1", '\0");

        if (!success){
            resultFail(result, new RuntimeException("Hangup Error"));
        } else {
            resultSuccess(result, null);
        }
    
public voidhangupWaitingOrBackground(android.os.Message result)
3GPP 22.030 6.5.5 "Releases all held calls or sets User Determined User Busy (UDUB) for a waiting call." ar.exception carries exception on failure ar.userObject contains the original value of result.obj ar.result is null on success and failure

        boolean success;

        success = simulatedCallState.onChld('0", '\0");

        if (!success){
            resultFail(result, new RuntimeException("Hangup Error"));
        } else {
            resultSuccess(result, null);
        }
    
public voidiccCloseLogicalChannel(int channel, android.os.Message response)

        unimplemented(response);
    
public voidiccIO(int command, int fileid, java.lang.String path, int p1, int p2, int p3, java.lang.String data, java.lang.String pin2, android.os.Message response)

        iccIOForApp(command, fileid, path, p1, p2, p3, data,pin2, null, response);
    
public voidiccIOForApp(int command, int fileid, java.lang.String path, int p1, int p2, int p3, java.lang.String data, java.lang.String pin2, java.lang.String aid, android.os.Message result)
parameters equivalent to 27.007 AT+CRSM command response.obj will be an AsyncResult response.obj.userObj will be a SimIoResult on success

        unimplemented(result);
    
public voidiccOpenLogicalChannel(java.lang.String AID, android.os.Message response)

        unimplemented(response);
    
public voidiccTransmitApduBasicChannel(int cla, int instruction, int p1, int p2, int p3, java.lang.String data, android.os.Message response)

        unimplemented(response);
    
public voidiccTransmitApduLogicalChannel(int channel, int cla, int instruction, int p1, int p2, int p3, java.lang.String data, android.os.Message response)

        unimplemented(response);
    
public voidinvokeOemRilRequestRaw(byte[] data, android.os.Message response)

        // Just echo back data
        if (response != null) {
            AsyncResult.forMessage(response).result = data;
            response.sendToTarget();
        }
    
public voidinvokeOemRilRequestStrings(java.lang.String[] strings, android.os.Message response)

        // Just echo back data
        if (response != null) {
            AsyncResult.forMessage(response).result = strings;
            response.sendToTarget();
        }
    
private booleanisSimLocked()

        if (mSimLockedState != SimLockState.NONE) {
            return true;
        }
        return false;
    
public voidnvReadItem(int itemID, android.os.Message response)

        unimplemented(response);
    
public voidnvResetConfig(int resetType, android.os.Message response)

        unimplemented(response);
    
public voidnvWriteCdmaPrl(byte[] preferredRoamingList, android.os.Message response)

        unimplemented(response);
    
public voidnvWriteItem(int itemID, java.lang.String itemValue, android.os.Message response)

        unimplemented(response);
    
public voidpauseResponses()

        mPausedResponseCount++;
    
public voidprogressConnectingCallState()

        simulatedCallState.progressConnectingCallState();
        mCallStateRegistrants.notifyRegistrants();
    
public voidprogressConnectingToActive()
If a call is DIALING or ALERTING, progress it all the way to ACTIVE

        simulatedCallState.progressConnectingToActive();
        mCallStateRegistrants.notifyRegistrants();
    
public voidqueryAvailableBandMode(android.os.Message result)
Query the list of band mode supported by RF.

param
result is callback message ((AsyncResult)response.obj).result is an int[] where int[0] is the size of the array and the rest of each element representing one available BM_*_BAND

        int ret[] = new int [4];

        ret[0] = 4;
        ret[1] = Phone.BM_US_BAND;
        ret[2] = Phone.BM_JPN_BAND;
        ret[3] = Phone.BM_AUS_BAND;

        resultSuccess(result, ret);
    
public voidqueryCLIP(android.os.Message response)
(AsyncResult)response.obj).result is an int[] with element [0] set to 1 for "CLIP is provisioned", and 0 for "CLIP is not provisioned".

param
response is callback message

 unimplemented(response); 
public voidqueryCallForwardStatus(int cfReason, int serviceClass, java.lang.String number, android.os.Message result)
cfReason is one of CF_REASON_* ((AsyncResult)response.obj).result will be an array of CallForwardInfo's An array of length 0 means "disabled for all codes"

unimplemented(result);
public voidqueryCallWaiting(int serviceClass, android.os.Message response)
(AsyncResult)response.obj).result is an int[] with element [0] set to 0 for disabled, 1 for enabled.

param
serviceClass is a sum of SERVICE_CLASS_*
param
response is callback message

        unimplemented(response);
    
public voidqueryCdmaRoamingPreference(android.os.Message response)

        Rlog.w(LOG_TAG, "CDMA not implemented in SimulatedCommands");
        unimplemented(response);
    
public voidqueryFacilityLock(java.lang.String facility, java.lang.String pin, int serviceClass, android.os.Message result)

        queryFacilityLockForApp(facility, pin, serviceClass, null, result);
    
public voidqueryFacilityLockForApp(java.lang.String facility, java.lang.String pin, int serviceClass, java.lang.String appId, android.os.Message result)

        if (facility != null && facility.equals(CommandsInterface.CB_FACILITY_BA_SIM)) {
            if (result != null) {
                int[] r = new int[1];
                r[0] = (mSimLockEnabled ? 1 : 0);
                Rlog.i(LOG_TAG, "[SimCmd] queryFacilityLock: SIM is "
                        + (r[0] == 0 ? "unlocked" : "locked"));
                AsyncResult.forMessage(result, r, null);
                result.sendToTarget();
            }
            return;
        } else if (facility != null && facility.equals(CommandsInterface.CB_FACILITY_BA_FD)) {
            if (result != null) {
                int[] r = new int[1];
                r[0] = (mSimFdnEnabled ? 1 : 0);
                Rlog.i(LOG_TAG, "[SimCmd] queryFacilityLock: FDN is "
                        + (r[0] == 0 ? "disabled" : "enabled"));
                AsyncResult.forMessage(result, r, null);
                result.sendToTarget();
            }
            return;
        }

        unimplemented(result);
    
public voidqueryTTYMode(android.os.Message response)
Query the TTY mode (AsyncResult)response.obj).result is an int[] with element [0] set to tty mode: - {@link com.android.internal.telephony.Phone#TTY_MODE_OFF} - {@link com.android.internal.telephony.Phone#TTY_MODE_FULL} - {@link com.android.internal.telephony.Phone#TTY_MODE_HCO} - {@link com.android.internal.telephony.Phone#TTY_MODE_VCO}

param
response is callback message

        Rlog.w(LOG_TAG, "CDMA not implemented in SimulatedCommands");
        unimplemented(response);
    
public voidrejectCall(android.os.Message result)
also known as UDUB ar.exception carries exception on failure ar.userObject contains the original value of result.obj ar.result is null on success and failure

        boolean success;

        success = simulatedCallState.onChld('0", '\0");

        if (!success){
            resultFail(result, new RuntimeException("Hangup Error"));
        } else {
            resultSuccess(result, null);
        }
    
public voidreportSmsMemoryStatus(boolean available, android.os.Message result)

        unimplemented(result);
    
public voidreportStkServiceIsRunning(android.os.Message result)

        resultSuccess(result, null);
    
public voidrequestIccSimAuthentication(int authContext, java.lang.String data, java.lang.String aid, android.os.Message response)

        unimplemented(response);
    
public voidrequestIsimAuthentication(java.lang.String nonce, android.os.Message response)

        unimplemented(response);
    
public voidrequestShutdown(android.os.Message result)

        setRadioState(RadioState.RADIO_UNAVAILABLE);
    
public voidresetRadio(android.os.Message result)

        unimplemented(result);
    
private voidresultFail(android.os.Message result, java.lang.Throwable tr)

        if (result != null) {
            AsyncResult.forMessage(result).exception = tr;
            if (mPausedResponseCount > 0) {
                mPausedResponses.add(result);
            } else {
                result.sendToTarget();
            }
        }
    
private voidresultSuccess(android.os.Message result, java.lang.Object ret)

        if (result != null) {
            AsyncResult.forMessage(result).result = ret;
            if (mPausedResponseCount > 0) {
                mPausedResponses.add(result);
            } else {
                result.sendToTarget();
            }
        }
    
public voidresumeResponses()

        mPausedResponseCount--;

        if (mPausedResponseCount == 0) {
            for (int i = 0, s = mPausedResponses.size(); i < s ; i++) {
                mPausedResponses.get(i).sendToTarget();
            }
            mPausedResponses.clear();
        } else {
            Rlog.e("GSM", "SimulatedCommands.resumeResponses < 0");
        }
    
public voidsendBurstDtmf(java.lang.String dtmfString, int on, int off, android.os.Message result)
ar.exception carries exception on failure ar.userObject contains the original value of result.obj ar.result is null on success and failure

        resultSuccess(result, null);
    
public voidsendCDMAFeatureCode(java.lang.String FeatureCode, android.os.Message response)
{@inheritDoc}

        Rlog.w(LOG_TAG, "CDMA not implemented in SimulatedCommands");
        unimplemented(response);
    
public voidsendCdmaSms(byte[] pdu, android.os.Message response)
{@inheritDoc}

       Rlog.w(LOG_TAG, "CDMA not implemented in SimulatedCommands");
    
public voidsendDtmf(char c, android.os.Message result)
ar.exception carries exception on failure ar.userObject contains the original value of result.obj ar.result is null on success and failure

        resultSuccess(result, null);
    
public voidsendEnvelope(java.lang.String contents, android.os.Message response)
{@inheritDoc}

        resultSuccess(response, null);
    
public voidsendEnvelopeWithStatus(java.lang.String contents, android.os.Message response)
{@inheritDoc}

        resultSuccess(response, null);
    
public voidsendImsCdmaSms(byte[] pdu, int retry, int messageRef, android.os.Message response)

        unimplemented(response);
    
public voidsendImsGsmSms(java.lang.String smscPDU, java.lang.String pdu, int retry, int messageRef, android.os.Message response)

        unimplemented(response);
    
public voidsendSMS(java.lang.String smscPDU, java.lang.String pdu, android.os.Message result)
smscPDU is smsc address in PDU form GSM BCD format prefixed by a length byte (as expected by TS 27.005) or NULL for default SMSC pdu is SMS in PDU format as an ASCII hex string less the SMSC address

unimplemented(result);
public voidsendSMSExpectMore(java.lang.String smscPDU, java.lang.String pdu, android.os.Message result)
Send an SMS message, Identical to sendSMS, except that more messages are expected to be sent soon smscPDU is smsc address in PDU form GSM BCD format prefixed by a length byte (as expected by TS 27.005) or NULL for default SMSC pdu is SMS in PDU format as an ASCII hex string less the SMSC address

        unimplemented(result);
    
public voidsendStkCcAplha(java.lang.String alphaString)

        triggerIncomingStkCcAlpha(alphaString);
    
public voidsendTerminalResponse(java.lang.String contents, android.os.Message response)
{@inheritDoc}

        resultSuccess(response, null);
    
public voidsendUSSD(java.lang.String ussdString, android.os.Message result)


        // We simulate this particular sequence
        if (ussdString.equals("#646#")) {
            resultSuccess(result, null);

            // 0 == USSD-Notify
            triggerIncomingUssd("0", "You have NNN minutes remaining.");
        } else {
            resultSuccess(result, null);

            triggerIncomingUssd("0", "All Done");
        }
    
public voidseparateConnection(int gsmIndex, android.os.Message result)
3GPP 22.030 6.5.5 "Places all active calls on hold except call X with which communication shall be supported."

        boolean success;

        char ch = (char)(gsmIndex + '0");
        success = simulatedCallState.onChld('2", ch);

        if (!success){
            resultFail(result, new RuntimeException("Hangup Error"));
        } else {
            resultSuccess(result, null);
        }
    
public voidsetAutoProgressConnectingCall(boolean b)
automatically progress mobile originated calls to ACTIVE. default to true

        simulatedCallState.setAutoProgressConnectingCall(b);
    
public voidsetBandMode(int bandMode, android.os.Message result)
Assign a specified band for RF configuration.

param
bandMode one of BM_*_BAND
param
result is callback message

        resultSuccess(result, null);
    
public voidsetCLIR(int clirMode, android.os.Message result)
clirMode is one of the CLIR_* constants above response.obj is null

unimplemented(result);
public voidsetCallForward(int action, int cfReason, int serviceClass, java.lang.String number, int timeSeconds, android.os.Message result)

param
action is one of CF_ACTION_*
param
cfReason is one of CF_REASON_*
param
serviceClass is a sum of SERVICE_CLASSS_*

unimplemented(result);
public voidsetCallWaiting(boolean enable, int serviceClass, android.os.Message response)

param
enable is true to enable, false to disable
param
serviceClass is a sum of SERVICE_CLASS_*
param
response is callback message

        unimplemented(response);
    
public voidsetCdmaBroadcastActivation(boolean activate, android.os.Message response)

        unimplemented(response);

    
public voidsetCdmaBroadcastConfig(com.android.internal.telephony.cdma.CdmaSmsBroadcastConfigInfo[] configs, android.os.Message response)

        unimplemented(response);
    
public voidsetCdmaRoamingPreference(int cdmaRoamingType, android.os.Message response)

        Rlog.w(LOG_TAG, "CDMA not implemented in SimulatedCommands");
        unimplemented(response);
    
public voidsetCdmaSubscriptionSource(int cdmaSubscriptionType, android.os.Message response)

        Rlog.w(LOG_TAG, "CDMA not implemented in SimulatedCommands");
        unimplemented(response);
    
public voidsetCellInfoListRate(int rateInMillis, android.os.Message response)

        unimplemented(response);
    
public voidsetDataProfile(com.android.internal.telephony.dataconnection.DataProfile[] dps, android.os.Message result)

    
public voidsetFacilityLock(java.lang.String facility, boolean lockEnabled, java.lang.String pin, int serviceClass, android.os.Message result)

        setFacilityLockForApp(facility, lockEnabled, pin, serviceClass, null, result);
    
public voidsetFacilityLockForApp(java.lang.String facility, boolean lockEnabled, java.lang.String pin, int serviceClass, java.lang.String appId, android.os.Message result)

        if (facility != null &&
                facility.equals(CommandsInterface.CB_FACILITY_BA_SIM)) {
            if (pin != null && pin.equals(mPinCode)) {
                Rlog.i(LOG_TAG, "[SimCmd] setFacilityLock: pin is valid");
                mSimLockEnabled = lockEnabled;

                if (result != null) {
                    AsyncResult.forMessage(result, null, null);
                    result.sendToTarget();
                }

                return;
            }

            if (result != null) {
                Rlog.i(LOG_TAG, "[SimCmd] setFacilityLock: pin failed!");

                CommandException ex = new CommandException(
                        CommandException.Error.GENERIC_FAILURE);
                AsyncResult.forMessage(result, null, ex);
                result.sendToTarget();
            }

            return;
        }  else if (facility != null &&
                facility.equals(CommandsInterface.CB_FACILITY_BA_FD)) {
            if (pin != null && pin.equals(mPin2Code)) {
                Rlog.i(LOG_TAG, "[SimCmd] setFacilityLock: pin2 is valid");
                mSimFdnEnabled = lockEnabled;

                if (result != null) {
                    AsyncResult.forMessage(result, null, null);
                    result.sendToTarget();
                }

                return;
            }

            if (result != null) {
                Rlog.i(LOG_TAG, "[SimCmd] setFacilityLock: pin2 failed!");

                CommandException ex = new CommandException(
                        CommandException.Error.GENERIC_FAILURE);
                AsyncResult.forMessage(result, null, ex);
                result.sendToTarget();
            }

            return;
        }

        unimplemented(result);
    
public voidsetGsmBroadcastActivation(boolean activate, android.os.Message response)

        unimplemented(response);
    
public voidsetGsmBroadcastConfig(com.android.internal.telephony.gsm.SmsBroadcastConfigInfo[] config, android.os.Message response)

        unimplemented(response);
    
public voidsetInitialAttachApn(java.lang.String apn, java.lang.String protocol, int authType, java.lang.String username, java.lang.String password, android.os.Message result)

    
public voidsetLocationUpdates(boolean enable, android.os.Message response)

        unimplemented(response);
    
public voidsetMute(boolean enableMute, android.os.Message result)

unimplemented(result);
public voidsetNetworkSelectionModeAutomatic(android.os.Message result)

unimplemented(result);
public voidsetNetworkSelectionModeManual(java.lang.String operatorNumeric, android.os.Message result)

unimplemented(result);
public voidsetNextCallFailCause(int gsmCause)

        mNextCallFailCause = gsmCause;
    
public voidsetNextDialFailImmediately(boolean b)

        simulatedCallState.setNextDialFailImmediately(b);
    
public voidsetPhoneType(int phoneType)

        Rlog.w(LOG_TAG, "CDMA not implemented in SimulatedCommands");
    
public voidsetPreferredNetworkType(int networkType, android.os.Message result)

        mNetworkType = networkType;
        resultSuccess(result, null);
    
public voidsetPreferredVoicePrivacy(boolean enable, android.os.Message result)

        Rlog.w(LOG_TAG, "CDMA not implemented in SimulatedCommands");
        unimplemented(result);
    
public voidsetRadioPower(boolean on, android.os.Message result)

        if(on) {
            setRadioState(RadioState.RADIO_ON);
        } else {
            setRadioState(RadioState.RADIO_OFF);
        }
    
public voidsetSmscAddress(java.lang.String address, android.os.Message result)

        unimplemented(result);
    
public voidsetSuppServiceNotifications(boolean enable, android.os.Message result)

        resultSuccess(result, null);

        if (enable && mSsnNotifyOn) {
            Rlog.w(LOG_TAG, "Supp Service Notifications already enabled!");
        }

        mSsnNotifyOn = enable;
    
public voidsetTTYMode(int ttyMode, android.os.Message response)
Set the TTY mode

param
ttyMode is one of the following: - {@link com.android.internal.telephony.Phone#TTY_MODE_OFF} - {@link com.android.internal.telephony.Phone#TTY_MODE_FULL} - {@link com.android.internal.telephony.Phone#TTY_MODE_HCO} - {@link com.android.internal.telephony.Phone#TTY_MODE_VCO}
param
response is callback message

        Rlog.w(LOG_TAG, "Not implemented in SimulatedCommands");
        unimplemented(response);
    
public voidsetupDataCall(java.lang.String radioTechnology, java.lang.String profile, java.lang.String apn, java.lang.String user, java.lang.String password, java.lang.String authType, java.lang.String protocol, android.os.Message result)

        unimplemented(result);
    
public voidshutdown()

        setRadioState(RadioState.RADIO_UNAVAILABLE);
        Looper looper = mHandlerThread.getLooper();
        if (looper != null) {
            looper.quit();
        }
    
public voidstartDtmf(char c, android.os.Message result)
ar.exception carries exception on failure ar.userObject contains the original value of result.obj ar.result is null on success and failure

        resultSuccess(result, null);
    
public voidstopDtmf(android.os.Message result)
ar.exception carries exception on failure ar.userObject contains the original value of result.obj ar.result is null on success and failure

        resultSuccess(result, null);
    
public voidsupplyIccPin(java.lang.String pin, android.os.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);
            AsyncResult.forMessage(result, null, ex);
            result.sendToTarget();
            return;
        }

        if (pin != null && pin.equals(mPinCode)) {
            Rlog.i(LOG_TAG, "[SimCmd] supplyIccPin: success!");
            mPinUnlockAttempts = 0;
            mSimLockedState = SimLockState.NONE;
            mIccStatusChangedRegistrants.notifyRegistrants();

            if (result != null) {
                AsyncResult.forMessage(result, null, null);
                result.sendToTarget();
            }

            return;
        }

        if (result != null) {
            mPinUnlockAttempts ++;

            Rlog.i(LOG_TAG, "[SimCmd] supplyIccPin: failed! attempt=" +
                    mPinUnlockAttempts);
            if (mPinUnlockAttempts >= 3) {
                Rlog.i(LOG_TAG, "[SimCmd] supplyIccPin: set state to REQUIRE_PUK");
                mSimLockedState = SimLockState.REQUIRE_PUK;
            }

            CommandException ex = new CommandException(
                    CommandException.Error.PASSWORD_INCORRECT);
            AsyncResult.forMessage(result, null, ex);
            result.sendToTarget();
        }
    
public voidsupplyIccPin2(java.lang.String pin2, android.os.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);
            AsyncResult.forMessage(result, null, ex);
            result.sendToTarget();
            return;
        }

        if (pin2 != null && pin2.equals(mPin2Code)) {
            Rlog.i(LOG_TAG, "[SimCmd] supplyIccPin2: success!");
            mPin2UnlockAttempts = 0;
            mSimFdnEnabledState = SimFdnState.NONE;

            if (result != null) {
                AsyncResult.forMessage(result, null, null);
                result.sendToTarget();
            }

            return;
        }

        if (result != null) {
            mPin2UnlockAttempts ++;

            Rlog.i(LOG_TAG, "[SimCmd] supplyIccPin2: failed! attempt=" +
                    mPin2UnlockAttempts);
            if (mPin2UnlockAttempts >= 3) {
                Rlog.i(LOG_TAG, "[SimCmd] supplyIccPin2: set state to REQUIRE_PUK2");
                mSimFdnEnabledState = SimFdnState.REQUIRE_PUK2;
            }

            CommandException ex = new CommandException(
                    CommandException.Error.PASSWORD_INCORRECT);
            AsyncResult.forMessage(result, null, ex);
            result.sendToTarget();
        }
    
public voidsupplyIccPin2ForApp(java.lang.String pin2, java.lang.String aid, android.os.Message response)

        unimplemented(response);
    
public voidsupplyIccPinForApp(java.lang.String pin, java.lang.String aid, android.os.Message response)

        unimplemented(response);
    
public voidsupplyIccPuk(java.lang.String puk, java.lang.String newPin, android.os.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);
            AsyncResult.forMessage(result, null, ex);
            result.sendToTarget();
            return;
        }

        if (puk != null && puk.equals(SIM_PUK_CODE)) {
            Rlog.i(LOG_TAG, "[SimCmd] supplyIccPuk: success!");
            mSimLockedState = SimLockState.NONE;
            mPukUnlockAttempts = 0;
            mIccStatusChangedRegistrants.notifyRegistrants();

            if (result != null) {
                AsyncResult.forMessage(result, null, null);
                result.sendToTarget();
            }

            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);
            AsyncResult.forMessage(result, null, ex);
            result.sendToTarget();
        }
    
public voidsupplyIccPuk2(java.lang.String puk2, java.lang.String newPin2, android.os.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);
            AsyncResult.forMessage(result, null, ex);
            result.sendToTarget();
            return;
        }

        if (puk2 != null && puk2.equals(SIM_PUK2_CODE)) {
            Rlog.i(LOG_TAG, "[SimCmd] supplyIccPuk2: success!");
            mSimFdnEnabledState = SimFdnState.NONE;
            mPuk2UnlockAttempts = 0;

            if (result != null) {
                AsyncResult.forMessage(result, null, null);
                result.sendToTarget();
            }

            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);
            AsyncResult.forMessage(result, null, ex);
            result.sendToTarget();
        }
    
public voidsupplyIccPuk2ForApp(java.lang.String puk2, java.lang.String newPin2, java.lang.String aid, android.os.Message response)

        unimplemented(response);
    
public voidsupplyIccPukForApp(java.lang.String puk, java.lang.String newPin, java.lang.String aid, android.os.Message response)

        unimplemented(response);
    
public voidsupplyNetworkDepersonalization(java.lang.String netpin, android.os.Message result)

        unimplemented(result);
    
public voidswitchWaitingOrHoldingAndActive(android.os.Message result)
3GPP 22.030 6.5.5 "Places all active calls (if any exist) on hold and accepts the other (held or waiting) call." ar.exception carries exception on failure ar.userObject contains the original value of result.obj ar.result is null on success and failure

        boolean success;

        success = simulatedCallState.onChld('2", '\0");

        if (!success){
            resultFail(result, new RuntimeException("Hangup Error"));
        } else {
            resultSuccess(result, null);
        }
    
public voidtriggerHangupAll()
hangup all

        simulatedCallState.triggerHangupAll();
        mCallStateRegistrants.notifyRegistrants();
    
public voidtriggerHangupBackground()
hangup holding calls

        simulatedCallState.triggerHangupBackground();
        mCallStateRegistrants.notifyRegistrants();
    
public voidtriggerHangupForeground()

        simulatedCallState.triggerHangupForeground();
        mCallStateRegistrants.notifyRegistrants();
    
public voidtriggerIncomingSMS(java.lang.String message)

        //TODO
    
public voidtriggerIncomingStkCcAlpha(java.lang.String alphaString)
Simulates an Stk Call Control Alpha message

param
alphaString Alpha string to send.

        if (mCatCcAlphaRegistrant != null) {
            mCatCcAlphaRegistrant.notifyResult(alphaString);
        }
    
public voidtriggerIncomingUssd(java.lang.String statusCode, java.lang.String message)
Simulates an incoming USSD message

param
statusCode Status code string. See setOnUSSD in CommandsInterface.java
param
message Message text to send or null if none

        if (mUSSDRegistrant != null) {
            String[] result = {statusCode, message};
            mUSSDRegistrant.notifyResult(result);
        }
    
public voidtriggerRing(java.lang.String number)
Start the simulated phone ringing

        simulatedCallState.triggerRing(number);
        mCallStateRegistrants.notifyRegistrants();
    
public voidtriggerSsn(int type, int code)

        SuppServiceNotification not = new SuppServiceNotification();
        not.notificationType = type;
        not.code = code;
        mSsnRegistrant.notifyRegistrant(new AsyncResult(null, not, null));
    
private voidunimplemented(android.os.Message result)

        if (result != null) {
            AsyncResult.forMessage(result).exception
                = new RuntimeException("Unimplemented");

            if (mPausedResponseCount > 0) {
                mPausedResponses.add(result);
            } else {
                result.sendToTarget();
            }
        }
    
public voidwriteSmsToRuim(int status, java.lang.String pdu, android.os.Message response)

        Rlog.d(LOG_TAG, "Write SMS to RUIM with status " + status);
        unimplemented(response);
    
public voidwriteSmsToSim(int status, java.lang.String smsc, java.lang.String pdu, android.os.Message response)

        Rlog.d(LOG_TAG, "Write SMS to SIM with status " + status);
        unimplemented(response);