@@ -94,6 +94,8 @@ public class CatService extends Handler implements AppInterface {
9494 private static final int DEV_ID_TERMINAL = 0x82 ;
9595 private static final int DEV_ID_NETWORK = 0x83 ;
9696
97+ static final String STK_DEFAULT = "Defualt Message" ;
98+
9799 /* Intentionally private for singleton */
98100 private CatService (CommandsInterface ci , IccRecords ir , Context context ,
99101 IccFileHandler fh , IccCard ic ) {
@@ -157,7 +159,15 @@ private void handleRilMsg(RilMessage rilMsg) {
157159 }
158160 break ;
159161 case MSG_ID_PROACTIVE_COMMAND :
160- cmdParams = (CommandParams ) rilMsg .mData ;
162+ try {
163+ cmdParams = (CommandParams ) rilMsg .mData ;
164+ } catch (ClassCastException e ) {
165+ // for error handling : cast exception
166+ CatLog .d (this , "Fail to parse proactive command" );
167+ sendTerminalResponse (mCurrntCmd .mCmdDet , ResultCode .CMD_DATA_NOT_UNDERSTOOD ,
168+ false , 0x00 , null );
169+ break ;
170+ }
161171 if (cmdParams != null ) {
162172 if (rilMsg .mResCode == ResultCode .OK ) {
163173 handleProactiveCommand (cmdParams );
@@ -194,6 +204,7 @@ private void handleRilMsg(RilMessage rilMsg) {
194204 private void handleProactiveCommand (CommandParams cmdParams ) {
195205 CatLog .d (this , cmdParams .getCommandType ().name ());
196206
207+ CharSequence message ;
197208 CatCmdMessage cmdMsg = new CatCmdMessage (cmdParams );
198209 switch (cmdParams .getCommandType ()) {
199210 case SET_UP_MENU :
@@ -224,26 +235,44 @@ private void handleProactiveCommand(CommandParams cmdParams) {
224235 case CommandParamsFactory .DTTZ_SETTING :
225236 resp = new DTTZResponseData (null );
226237 sendTerminalResponse (cmdParams .cmdDet , ResultCode .OK , false , 0 , resp );
227- break ;
238+ return ;
228239 case CommandParamsFactory .LANGUAGE_SETTING :
229240 resp = new LanguageResponseData (Locale .getDefault ().getLanguage ());
230241 sendTerminalResponse (cmdParams .cmdDet , ResultCode .OK , false , 0 , resp );
231- break ;
242+ return ;
232243 default :
233244 sendTerminalResponse (cmdParams .cmdDet , ResultCode .OK , false , 0 , null );
234245 return ;
235246 }
236247 case LAUNCH_BROWSER :
248+ if ((((LaunchBrowserParams ) cmdParams ).confirmMsg .text != null )
249+ && (((LaunchBrowserParams ) cmdParams ).confirmMsg .text .equals (STK_DEFAULT ))) {
250+ message = mContext .getText (com .android .internal .R .string .launchBrowserDefault );
251+ ((LaunchBrowserParams ) cmdParams ).confirmMsg .text = message .toString ();
252+ }
253+ break ;
237254 case SELECT_ITEM :
238255 case GET_INPUT :
239256 case GET_INKEY :
257+ break ;
240258 case SEND_DTMF :
241259 case SEND_SMS :
242260 case SEND_SS :
243261 case SEND_USSD :
262+ if ((((DisplayTextParams )cmdParams ).textMsg .text != null )
263+ && (((DisplayTextParams )cmdParams ).textMsg .text .equals (STK_DEFAULT ))) {
264+ message = mContext .getText (com .android .internal .R .string .sending );
265+ ((DisplayTextParams )cmdParams ).textMsg .text = message .toString ();
266+ }
267+ break ;
244268 case PLAY_TONE :
269+ break ;
245270 case SET_UP_CALL :
246- // nothing to do on telephony!
271+ if ((((CallSetupParams ) cmdParams ).confirmMsg .text != null )
272+ && (((CallSetupParams ) cmdParams ).confirmMsg .text .equals (STK_DEFAULT ))) {
273+ message = mContext .getText (com .android .internal .R .string .SetupCallDefault );
274+ ((CallSetupParams ) cmdParams ).confirmMsg .text = message .toString ();
275+ }
247276 break ;
248277 default :
249278 CatLog .d (this , "Unsupported command" );
0 commit comments