@@ -65,52 +65,49 @@ public class JSRQualcommRIL extends RIL implements CommandsInterface {
65
65
static final int RIL_REQUEST_GET_DATA_SUBSCRIPTION = 10121 ; // deprecated
66
66
static final int RIL_REQUEST_SET_SUBSCRIPTION_MODE = 10122 ;
67
67
68
- protected HandlerThread mIccThread ;
69
- protected IccHandler mIccHandler ;
70
68
protected String mAid ;
71
69
protected boolean mUSIM = false ;
72
70
protected String [] mLastDataIface = new String [20 ];
73
71
boolean skipCdmaSubcription = needsOldRilFeature ("skipCdmaSubcription" );
74
-
75
- private final int RIL_INT_RADIO_OFF = 0 ;
76
- private final int RIL_INT_RADIO_UNAVAILABLE = 1 ;
77
- private final int RIL_INT_RADIO_ON = 2 ;
78
- private final int RIL_INT_RADIO_ON_NG = 10 ;
79
- private final int RIL_INT_RADIO_ON_HTC = 13 ;
80
72
81
73
public JSRQualcommRIL (Context context , int networkMode , int cdmaSubscription ) {
82
74
super (context , networkMode , cdmaSubscription );
83
- mSetPreferredNetworkType = -1 ;
84
75
mQANElements = 5 ;
85
76
Rlog .w (RILJ_LOG_TAG , "[JSR] Create JSRQualcommRIL" );
86
77
}
87
78
88
79
public JSRQualcommRIL (Context context , int networkMode , int cdmaSubscription , Integer instanceId ) {
89
80
super (context , networkMode , cdmaSubscription , instanceId );
90
- mSetPreferredNetworkType = -1 ;
91
81
mQANElements = 5 ;
92
82
Rlog .w (RILJ_LOG_TAG , "[JSR] Create JSRQualcommRIL [" + instanceId + "]" );
93
83
}
94
84
95
85
// ------------------------------------------------------------------------------------
96
86
87
+ public void reqNotSupported (Message result ) {
88
+ if (result != null ) {
89
+ CommandException ex = new CommandException (CommandException .Error .REQUEST_NOT_SUPPORTED );
90
+ AsyncResult .forMessage (result , null , ex );
91
+ result .sendToTarget ();
92
+ }
93
+ }
94
+
97
95
@ Override
98
96
public void getCellInfoList (Message result ) {
99
- if (RILJ_LOGD ) riljLog ("[JSR] > getCellInfoList [NOT SUPPORTED]" );
100
- //RILRequest rr = RILRequest.obtain(RIL_REQUEST_GET_CELL_INFO_LIST, result);
97
+ if (RILJ_LOGD ) riljLog ("[JSR] > getCellInfoList [NOT SUPPORTED] RIL_REQUEST_GET_CELL_INFO_LIST " );
98
+ reqNotSupported ( result );
101
99
}
102
100
103
101
@ Override
104
102
public void setCellInfoListRate (int rateInMillis , Message response ) {
105
- if (RILJ_LOGD ) riljLog ("[JSR] > setCellInfoListRate [NOT SUPPORTED]" );
106
- //RILRequest rr = RILRequest.obtain(RIL_REQUEST_SET_UNSOL_CELL_INFO_LIST_RATE, result );
103
+ if (RILJ_LOGD ) riljLog ("[JSR] > setCellInfoListRate [NOT SUPPORTED] RIL_REQUEST_SET_UNSOL_CELL_INFO_LIST_RATE " );
104
+ reqNotSupported ( response );
107
105
}
108
106
109
107
@ Override
110
- public void setInitialAttachApn (String apn , String protocol , int authType , String username ,
111
- String password , Message result ) {
112
- if (RILJ_LOGD ) riljLog ("[JSR] > setInitialAttachApn [NOT SUPPORTED]" );
113
- //RILRequest rr = RILRequest.obtain(RIL_REQUEST_SET_INITIAL_ATTACH_APN, null);
108
+ public void setInitialAttachApn (String apn , String protocol , int authType , String username , String password , Message result ) {
109
+ if (RILJ_LOGD ) riljLog ("[JSR] > setInitialAttachApn [NOT SUPPORTED] RIL_REQUEST_SET_INITIAL_ATTACH_APN" );
110
+ reqNotSupported (result );
114
111
}
115
112
116
113
// ------------------------------------------------------------------------------------
@@ -268,7 +265,6 @@ public void setInitialAttachApn(String apn, String protocol, int authType, Strin
268
265
IccCardApplicationStatus application = cardStatus .mApplications [appIndex ];
269
266
mAid = application .aid ;
270
267
mUSIM = (application .app_type == IccCardApplicationStatus .AppType .APPTYPE_USIM );
271
- mSetPreferredNetworkType = mPreferredNetworkType ;
272
268
273
269
if (TextUtils .isEmpty (mAid ))
274
270
mAid = "" ;
@@ -278,222 +274,5 @@ public void setInitialAttachApn(String apn, String protocol, int authType, Strin
278
274
return cardStatus ;
279
275
}
280
276
281
- // ------------------------------------------------------------------------------------
282
-
283
- @ Override
284
- protected void
285
- processUnsolicited (Parcel p ) {
286
- Object ret ;
287
- int dataPosition = p .dataPosition (); // save off position within the Parcel
288
- int response = p .readInt ();
289
-
290
- // Assume devices needing the "datacall" GB-compatibility flag are
291
- // running GB RILs, so skip 1031-1034 for those
292
- if (needsOldRilFeature ("datacall" )) {
293
- switch (response ) {
294
- case RIL_UNSOL_CDMA_SUBSCRIPTION_SOURCE_CHANGED :
295
- case RIL_UNSOl_CDMA_PRL_CHANGED :
296
- case RIL_UNSOL_EXIT_EMERGENCY_CALLBACK_MODE :
297
- case RIL_UNSOL_RIL_CONNECTED :
298
- if (RILJ_LOGD ) riljLog ("[JSR] processUnsolicited: SKIP req = " + responseToString (response ) + " (" + response + ")" );
299
- ret = responseVoid (p );
300
- return ;
301
- }
302
- }
303
-
304
- switch (response ) {
305
- case RIL_UNSOL_RESPONSE_RADIO_STATE_CHANGED : ret = responseVoid (p ); break ;
306
- case RIL_UNSOL_RIL_CONNECTED : ret = responseInts (p ); break ;
307
- case RIL_UNSOL_EXIT_EMERGENCY_CALLBACK_MODE : ret = responseVoid (p ); break ;
308
-
309
- default :
310
- // Rewind the Parcel
311
- p .setDataPosition (dataPosition );
312
-
313
- // Forward responses that we are not overriding to the super class
314
- super .processUnsolicited (p );
315
- return ;
316
- }
317
-
318
- if (RILJ_LOGD ) riljLog ("[JSR] processUnsolicited: req = " + responseToString (response ) + " (" + response + ")" );
319
-
320
- switch (response ) {
321
- case RIL_UNSOL_RESPONSE_RADIO_STATE_CHANGED :
322
- int state = p .readInt ();
323
- setRadioStateFromRILInt (state );
324
- break ;
325
-
326
- case RIL_UNSOL_RIL_CONNECTED :
327
- if (RILJ_LOGD ) unsljLogRet (response , ret );
328
- // Initial conditions
329
- setRadioPower (false , null );
330
- setPreferredNetworkType (mPreferredNetworkType , null );
331
- setCdmaSubscriptionSource (mCdmaSubscription , null );
332
- notifyRegistrantsRilConnectionChanged (((int [])ret )[0 ]);
333
- break ;
334
-
335
- case RIL_UNSOL_EXIT_EMERGENCY_CALLBACK_MODE :
336
- if (RILJ_LOGD ) unsljLogRet (response , ret );
337
- if (mExitEmergencyCallbackModeRegistrants != null )
338
- mExitEmergencyCallbackModeRegistrants .notifyRegistrants (new AsyncResult (null , null , null ));
339
- break ;
340
- }
341
- }
342
-
343
- protected void
344
- setRadioStateFromRILInt (int stateCode ) {
345
- CommandsInterface .RadioState radioState ;
346
- HandlerThread handlerThread ;
347
- Looper looper ;
348
- IccHandler iccHandler ;
349
-
350
- switch (stateCode ) {
351
- case RIL_INT_RADIO_OFF :
352
- radioState = CommandsInterface .RadioState .RADIO_OFF ;
353
- Rlog .w (RILJ_LOG_TAG , "[JSR] set RIL_INT_RADIO_OFF" );
354
- if (mIccHandler != null ) {
355
- mIccThread = null ;
356
- mIccHandler = null ;
357
- }
358
- break ;
359
- case RIL_INT_RADIO_UNAVAILABLE :
360
- Rlog .w (RILJ_LOG_TAG , "[JSR] set RIL_INT_RADIO_UNAVAILABLE" );
361
- radioState = CommandsInterface .RadioState .RADIO_UNAVAILABLE ;
362
- break ;
363
- case RIL_INT_RADIO_ON :
364
- case RIL_INT_RADIO_ON_NG :
365
- case RIL_INT_RADIO_ON_HTC :
366
- Rlog .w (RILJ_LOG_TAG , "[JSR] set RIL_INT_RADIO_ON" );
367
- if (mIccHandler == null ) {
368
- handlerThread = new HandlerThread ("IccHandler" );
369
- mIccThread = handlerThread ;
370
-
371
- mIccThread .start ();
372
-
373
- looper = mIccThread .getLooper ();
374
- mIccHandler = new IccHandler (this ,looper );
375
- mIccHandler .run ();
376
- }
377
- radioState = CommandsInterface .RadioState .RADIO_ON ;
378
- break ;
379
- default :
380
- throw new RuntimeException ("Unrecognized RIL_RadioState: " + stateCode );
381
- }
382
-
383
- setRadioState (radioState );
384
- }
385
-
386
- // ------------------------------------------------------------------------------------
387
-
388
- class IccHandler extends Handler implements Runnable {
389
- private static final int EVENT_RADIO_ON = 1 ;
390
- private static final int EVENT_ICC_STATUS_CHANGED = 2 ;
391
- private static final int EVENT_GET_ICC_STATUS_DONE = 3 ;
392
- private static final int EVENT_RADIO_OFF_OR_UNAVAILABLE = 4 ;
393
-
394
- private RIL mRil ;
395
- private boolean mRadioOn = false ;
396
-
397
- public IccHandler (RIL ril , Looper looper ) {
398
- super (looper );
399
- mRil = ril ;
400
- }
401
-
402
- public void handleMessage (Message paramMessage ) {
403
- switch (paramMessage .what ) {
404
- case EVENT_RADIO_ON :
405
- mRadioOn = true ;
406
- Log .d (LOG_TAG , "[JSR] Radio on -> Forcing sim status update" );
407
- sendMessage (obtainMessage (EVENT_ICC_STATUS_CHANGED ));
408
- break ;
409
-
410
- case EVENT_ICC_STATUS_CHANGED :
411
- if (mRadioOn ) {
412
- Log .d (LOG_TAG , "[JSR] Received EVENT_ICC_STATUS_CHANGED, calling getIccCardStatus" );
413
- mRil .getIccCardStatus (obtainMessage (EVENT_GET_ICC_STATUS_DONE , paramMessage .obj ));
414
- } else {
415
- Log .d (LOG_TAG , "[JSR] Received EVENT_ICC_STATUS_CHANGED while radio is not ON. Ignoring" );
416
- }
417
- break ;
418
-
419
- case EVENT_GET_ICC_STATUS_DONE :
420
- Rlog .w (RILJ_LOG_TAG , "[JSR] EVENT_GET_ICC_STATUS_DONE" );
421
- AsyncResult asyncResult = (AsyncResult ) paramMessage .obj ;
422
- if (asyncResult .exception != null ) {
423
- Log .e (LOG_TAG , "[JSR] IccCardStatusDone shouldn't return exceptions!" , asyncResult .exception );
424
- break ;
425
- }
426
- IccCardStatus status = (IccCardStatus ) asyncResult .result ;
427
- if (status .mApplications == null || status .mApplications .length == 0 ) {
428
- if (!mRil .getRadioState ().isOn ()) {
429
- break ;
430
- }
431
- mRil .setRadioState (CommandsInterface .RadioState .RADIO_ON );
432
- } else {
433
- int appIndex = -1 ;
434
- if (mPhoneType == RILConstants .CDMA_PHONE && status .mCdmaSubscriptionAppIndex >= 0 ) {
435
- appIndex = status .mCdmaSubscriptionAppIndex ;
436
- Log .d (LOG_TAG , "[JSR] This is a CDMA PHONE: " + appIndex );
437
- } else {
438
- appIndex = status .mGsmUmtsSubscriptionAppIndex ;
439
- Log .d (LOG_TAG , "[JSR] This is a GSM PHONE: " + appIndex );
440
- if (appIndex < 0 ) appIndex = 0 ; // fixme
441
- }
442
-
443
- IccCardApplicationStatus application = status .mApplications [appIndex ];
444
- IccCardApplicationStatus .AppState app_state = application .app_state ;
445
- IccCardApplicationStatus .AppType app_type = application .app_type ;
446
-
447
- switch (app_state ) {
448
- case APPSTATE_PIN :
449
- case APPSTATE_PUK :
450
- switch (app_type ) {
451
- case APPTYPE_SIM :
452
- case APPTYPE_USIM :
453
- case APPTYPE_RUIM :
454
- mRil .setRadioState (CommandsInterface .RadioState .RADIO_ON );
455
- break ;
456
- default :
457
- Log .e (LOG_TAG , "[JSR] Currently we don't handle SIMs of type: " + app_type );
458
- return ;
459
- }
460
- break ;
461
- case APPSTATE_READY :
462
- switch (app_type ) {
463
- case APPTYPE_SIM :
464
- case APPTYPE_USIM :
465
- case APPTYPE_RUIM :
466
- mRil .setRadioState (CommandsInterface .RadioState .RADIO_ON );
467
- break ;
468
- default :
469
- Log .e (LOG_TAG , "[JSR] Currently we don't handle SIMs of type: " + app_type );
470
- return ;
471
- }
472
- break ;
473
- default :
474
- return ;
475
- }
476
- }
477
- break ;
478
-
479
- case EVENT_RADIO_OFF_OR_UNAVAILABLE :
480
- Rlog .w (RILJ_LOG_TAG , "[JSR] EVENT_RADIO_OFF_OR_UNAVAILABLE" );
481
- mRadioOn = false ;
482
- // disposeCards(); // to be verified;
483
- break ;
484
-
485
- default :
486
- Log .e (LOG_TAG , "[JSR] Unknown Event " + paramMessage .what );
487
- break ;
488
- }
489
- }
490
-
491
- public void run () {
492
- mRil .registerForIccStatusChanged (this , EVENT_ICC_STATUS_CHANGED , null );
493
- Message msg = obtainMessage (EVENT_RADIO_ON );
494
- mRil .getIccCardStatus (msg );
495
- }
496
- }
497
-
498
277
}
499
278
0 commit comments