Merge "[maguro] Fix STK issues" into ics-mr1
This commit is contained in:
@ -1,4 +1,4 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<!--
|
<!--
|
||||||
/* //device/apps/common/assets/res/any/strings.xml
|
/* //device/apps/common/assets/res/any/strings.xml
|
||||||
**
|
**
|
||||||
@ -3365,4 +3365,13 @@
|
|||||||
<!-- Delimeter used between each item in a textual list; for example "Alpha, Beta". [CHAR LIMIT=3] -->
|
<!-- Delimeter used between each item in a textual list; for example "Alpha, Beta". [CHAR LIMIT=3] -->
|
||||||
<string name="list_delimeter">", "</string>
|
<string name="list_delimeter">", "</string>
|
||||||
|
|
||||||
|
<!-- STK sending DTMF, SMS, USSD, SS -->
|
||||||
|
<string name="sending">Sending...</string>
|
||||||
|
|
||||||
|
<!-- STK launch Browser -->
|
||||||
|
<string name="launchBrowserDefault">Launch Browser?</string>
|
||||||
|
|
||||||
|
<!-- STK setup Call -->
|
||||||
|
<string name="SetupCallDefault">Accept Call?</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
@ -94,6 +94,8 @@ public class CatService extends Handler implements AppInterface {
|
|||||||
private static final int DEV_ID_TERMINAL = 0x82;
|
private static final int DEV_ID_TERMINAL = 0x82;
|
||||||
private static final int DEV_ID_NETWORK = 0x83;
|
private static final int DEV_ID_NETWORK = 0x83;
|
||||||
|
|
||||||
|
static final String STK_DEFAULT = "Defualt Message";
|
||||||
|
|
||||||
/* Intentionally private for singleton */
|
/* Intentionally private for singleton */
|
||||||
private CatService(CommandsInterface ci, IccRecords ir, Context context,
|
private CatService(CommandsInterface ci, IccRecords ir, Context context,
|
||||||
IccFileHandler fh, IccCard ic) {
|
IccFileHandler fh, IccCard ic) {
|
||||||
@ -157,7 +159,15 @@ public class CatService extends Handler implements AppInterface {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case MSG_ID_PROACTIVE_COMMAND:
|
case MSG_ID_PROACTIVE_COMMAND:
|
||||||
cmdParams = (CommandParams) rilMsg.mData;
|
try {
|
||||||
|
cmdParams = (CommandParams) rilMsg.mData;
|
||||||
|
} catch (ClassCastException e) {
|
||||||
|
// for error handling : cast exception
|
||||||
|
CatLog.d(this, "Fail to parse proactive command");
|
||||||
|
sendTerminalResponse(mCurrntCmd.mCmdDet, ResultCode.CMD_DATA_NOT_UNDERSTOOD,
|
||||||
|
false, 0x00, null);
|
||||||
|
break;
|
||||||
|
}
|
||||||
if (cmdParams != null) {
|
if (cmdParams != null) {
|
||||||
if (rilMsg.mResCode == ResultCode.OK) {
|
if (rilMsg.mResCode == ResultCode.OK) {
|
||||||
handleProactiveCommand(cmdParams);
|
handleProactiveCommand(cmdParams);
|
||||||
@ -194,6 +204,7 @@ public class CatService extends Handler implements AppInterface {
|
|||||||
private void handleProactiveCommand(CommandParams cmdParams) {
|
private void handleProactiveCommand(CommandParams cmdParams) {
|
||||||
CatLog.d(this, cmdParams.getCommandType().name());
|
CatLog.d(this, cmdParams.getCommandType().name());
|
||||||
|
|
||||||
|
CharSequence message;
|
||||||
CatCmdMessage cmdMsg = new CatCmdMessage(cmdParams);
|
CatCmdMessage cmdMsg = new CatCmdMessage(cmdParams);
|
||||||
switch (cmdParams.getCommandType()) {
|
switch (cmdParams.getCommandType()) {
|
||||||
case SET_UP_MENU:
|
case SET_UP_MENU:
|
||||||
@ -224,26 +235,44 @@ public class CatService extends Handler implements AppInterface {
|
|||||||
case CommandParamsFactory.DTTZ_SETTING:
|
case CommandParamsFactory.DTTZ_SETTING:
|
||||||
resp = new DTTZResponseData(null);
|
resp = new DTTZResponseData(null);
|
||||||
sendTerminalResponse(cmdParams.cmdDet, ResultCode.OK, false, 0, resp);
|
sendTerminalResponse(cmdParams.cmdDet, ResultCode.OK, false, 0, resp);
|
||||||
break;
|
return;
|
||||||
case CommandParamsFactory.LANGUAGE_SETTING:
|
case CommandParamsFactory.LANGUAGE_SETTING:
|
||||||
resp = new LanguageResponseData(Locale.getDefault().getLanguage());
|
resp = new LanguageResponseData(Locale.getDefault().getLanguage());
|
||||||
sendTerminalResponse(cmdParams.cmdDet, ResultCode.OK, false, 0, resp);
|
sendTerminalResponse(cmdParams.cmdDet, ResultCode.OK, false, 0, resp);
|
||||||
break;
|
return;
|
||||||
default:
|
default:
|
||||||
sendTerminalResponse(cmdParams.cmdDet, ResultCode.OK, false, 0, null);
|
sendTerminalResponse(cmdParams.cmdDet, ResultCode.OK, false, 0, null);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case LAUNCH_BROWSER:
|
case LAUNCH_BROWSER:
|
||||||
|
if ((((LaunchBrowserParams) cmdParams).confirmMsg.text != null)
|
||||||
|
&& (((LaunchBrowserParams) cmdParams).confirmMsg.text.equals(STK_DEFAULT))) {
|
||||||
|
message = mContext.getText(com.android.internal.R.string.launchBrowserDefault);
|
||||||
|
((LaunchBrowserParams) cmdParams).confirmMsg.text = message.toString();
|
||||||
|
}
|
||||||
|
break;
|
||||||
case SELECT_ITEM:
|
case SELECT_ITEM:
|
||||||
case GET_INPUT:
|
case GET_INPUT:
|
||||||
case GET_INKEY:
|
case GET_INKEY:
|
||||||
|
break;
|
||||||
case SEND_DTMF:
|
case SEND_DTMF:
|
||||||
case SEND_SMS:
|
case SEND_SMS:
|
||||||
case SEND_SS:
|
case SEND_SS:
|
||||||
case SEND_USSD:
|
case SEND_USSD:
|
||||||
|
if ((((DisplayTextParams)cmdParams).textMsg.text != null)
|
||||||
|
&& (((DisplayTextParams)cmdParams).textMsg.text.equals(STK_DEFAULT))) {
|
||||||
|
message = mContext.getText(com.android.internal.R.string.sending);
|
||||||
|
((DisplayTextParams)cmdParams).textMsg.text = message.toString();
|
||||||
|
}
|
||||||
|
break;
|
||||||
case PLAY_TONE:
|
case PLAY_TONE:
|
||||||
|
break;
|
||||||
case SET_UP_CALL:
|
case SET_UP_CALL:
|
||||||
// nothing to do on telephony!
|
if ((((CallSetupParams) cmdParams).confirmMsg.text != null)
|
||||||
|
&& (((CallSetupParams) cmdParams).confirmMsg.text.equals(STK_DEFAULT))) {
|
||||||
|
message = mContext.getText(com.android.internal.R.string.SetupCallDefault);
|
||||||
|
((CallSetupParams) cmdParams).confirmMsg.text = message.toString();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
CatLog.d(this, "Unsupported command");
|
CatLog.d(this, "Unsupported command");
|
||||||
|
@ -403,6 +403,7 @@ class CommandParamsFactory extends Handler {
|
|||||||
input.ucs2 = (cmdDet.commandQualifier & 0x02) != 0;
|
input.ucs2 = (cmdDet.commandQualifier & 0x02) != 0;
|
||||||
input.yesNo = (cmdDet.commandQualifier & 0x04) != 0;
|
input.yesNo = (cmdDet.commandQualifier & 0x04) != 0;
|
||||||
input.helpAvailable = (cmdDet.commandQualifier & 0x80) != 0;
|
input.helpAvailable = (cmdDet.commandQualifier & 0x80) != 0;
|
||||||
|
input.echo = true;
|
||||||
|
|
||||||
mCmdParams = new GetInputParams(cmdDet, input);
|
mCmdParams = new GetInputParams(cmdDet, input);
|
||||||
|
|
||||||
@ -625,11 +626,7 @@ class CommandParamsFactory extends Handler {
|
|||||||
|
|
||||||
ComprehensionTlv ctlv = searchForTag(ComprehensionTlvTag.ALPHA_ID,
|
ComprehensionTlv ctlv = searchForTag(ComprehensionTlvTag.ALPHA_ID,
|
||||||
ctlvs);
|
ctlvs);
|
||||||
if (ctlv != null) {
|
textMsg.text = ValueParser.retrieveAlphaId(ctlv);
|
||||||
textMsg.text = ValueParser.retrieveAlphaId(ctlv);
|
|
||||||
} else {
|
|
||||||
throw new ResultException(ResultCode.REQUIRED_VALUES_MISSING);
|
|
||||||
}
|
|
||||||
|
|
||||||
ctlv = searchForTag(ComprehensionTlvTag.ICON_ID, ctlvs);
|
ctlv = searchForTag(ComprehensionTlvTag.ICON_ID, ctlvs);
|
||||||
if (ctlv != null) {
|
if (ctlv != null) {
|
||||||
@ -714,9 +711,8 @@ class CommandParamsFactory extends Handler {
|
|||||||
|
|
||||||
// parse alpha identifier.
|
// parse alpha identifier.
|
||||||
ctlv = searchForTag(ComprehensionTlvTag.ALPHA_ID, ctlvs);
|
ctlv = searchForTag(ComprehensionTlvTag.ALPHA_ID, ctlvs);
|
||||||
if (ctlv != null) {
|
confirmMsg.text = ValueParser.retrieveAlphaId(ctlv);
|
||||||
confirmMsg.text = ValueParser.retrieveAlphaId(ctlv);
|
|
||||||
}
|
|
||||||
// parse icon identifier
|
// parse icon identifier
|
||||||
ctlv = searchForTag(ComprehensionTlvTag.ICON_ID, ctlvs);
|
ctlv = searchForTag(ComprehensionTlvTag.ICON_ID, ctlvs);
|
||||||
if (ctlv != null) {
|
if (ctlv != null) {
|
||||||
@ -841,9 +837,7 @@ class CommandParamsFactory extends Handler {
|
|||||||
|
|
||||||
// get confirmation message string.
|
// get confirmation message string.
|
||||||
ctlv = searchForNextTag(ComprehensionTlvTag.ALPHA_ID, iter);
|
ctlv = searchForNextTag(ComprehensionTlvTag.ALPHA_ID, iter);
|
||||||
if (ctlv != null) {
|
confirmMsg.text = ValueParser.retrieveAlphaId(ctlv);
|
||||||
confirmMsg.text = ValueParser.retrieveAlphaId(ctlv);
|
|
||||||
}
|
|
||||||
|
|
||||||
ctlv = searchForTag(ComprehensionTlvTag.ICON_ID, ctlvs);
|
ctlv = searchForTag(ComprehensionTlvTag.ICON_ID, ctlvs);
|
||||||
if (ctlv != null) {
|
if (ctlv != null) {
|
||||||
|
@ -94,6 +94,7 @@ class ComprehensionTlv {
|
|||||||
startIndex = ctlv.mValueIndex + ctlv.mLength;
|
startIndex = ctlv.mValueIndex + ctlv.mLength;
|
||||||
} else {
|
} else {
|
||||||
CatLog.d(LOG_TAG, "decodeMany: ctlv is null, stop decoding");
|
CatLog.d(LOG_TAG, "decodeMany: ctlv is null, stop decoding");
|
||||||
|
items.clear();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -123,7 +124,10 @@ class ComprehensionTlv {
|
|||||||
case 0:
|
case 0:
|
||||||
case 0xff:
|
case 0xff:
|
||||||
case 0x80:
|
case 0x80:
|
||||||
throw new ResultException(ResultCode.CMD_DATA_NOT_UNDERSTOOD);
|
// for error handling
|
||||||
|
// these one make exception while decoding the abnormal command.
|
||||||
|
// (in case of Ghana MTN simcard , JDI simcard)
|
||||||
|
return null;
|
||||||
|
|
||||||
case 0x7f: // tag is in three-byte format
|
case 0x7f: // tag is in three-byte format
|
||||||
tag = ((data[curIndex] & 0xff) << 8)
|
tag = ((data[curIndex] & 0xff) << 8)
|
||||||
|
@ -273,18 +273,23 @@ abstract class ValueParser {
|
|||||||
*/
|
*/
|
||||||
static String retrieveAlphaId(ComprehensionTlv ctlv) throws ResultException {
|
static String retrieveAlphaId(ComprehensionTlv ctlv) throws ResultException {
|
||||||
|
|
||||||
byte[] rawValue = ctlv.getRawValue();
|
if (ctlv != null) {
|
||||||
int valueIndex = ctlv.getValueIndex();
|
byte[] rawValue = ctlv.getRawValue();
|
||||||
int length = ctlv.getLength();
|
int valueIndex = ctlv.getValueIndex();
|
||||||
if (length != 0) {
|
int length = ctlv.getLength();
|
||||||
try {
|
if (length != 0) {
|
||||||
return IccUtils.adnStringFieldToString(rawValue, valueIndex,
|
try {
|
||||||
length);
|
return IccUtils.adnStringFieldToString(rawValue, valueIndex,
|
||||||
} catch (IndexOutOfBoundsException e) {
|
length);
|
||||||
throw new ResultException(ResultCode.CMD_DATA_NOT_UNDERSTOOD);
|
} catch (IndexOutOfBoundsException e) {
|
||||||
|
throw new ResultException(ResultCode.CMD_DATA_NOT_UNDERSTOOD);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return CatService.STK_DEFAULT;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
return CatService.STK_DEFAULT;
|
||||||
}
|
}
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user