RadioIndication.java revision 37a3e51d244774ba156a88cf101432b62c8a42a3
1/* 2 * Copyright (C) 2016 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17package com.android.internal.telephony; 18 19import static com.android.internal.telephony.RILConstants.RIL_UNSOL_CALL_RING; 20import static com.android.internal.telephony.RILConstants.RIL_UNSOL_CDMA_CALL_WAITING; 21import static com.android.internal.telephony.RILConstants.RIL_UNSOL_CDMA_INFO_REC; 22import static com.android.internal.telephony.RILConstants.RIL_UNSOL_CDMA_OTA_PROVISION_STATUS; 23import static com.android.internal.telephony.RILConstants.RIL_UNSOL_CDMA_RUIM_SMS_STORAGE_FULL; 24import static com.android.internal.telephony.RILConstants.RIL_UNSOL_CDMA_SUBSCRIPTION_SOURCE_CHANGED; 25import static com.android.internal.telephony.RILConstants.RIL_UNSOL_CELL_INFO_LIST; 26import static com.android.internal.telephony.RILConstants.RIL_UNSOL_DATA_CALL_LIST_CHANGED; 27import static com.android.internal.telephony.RILConstants.RIL_UNSOL_ENTER_EMERGENCY_CALLBACK_MODE; 28import static com.android.internal.telephony.RILConstants.RIL_UNSOL_EXIT_EMERGENCY_CALLBACK_MODE; 29import static com.android.internal.telephony.RILConstants.RIL_UNSOL_HARDWARE_CONFIG_CHANGED; 30import static com.android.internal.telephony.RILConstants.RIL_UNSOL_LCEDATA_RECV; 31import static com.android.internal.telephony.RILConstants.RIL_UNSOL_MODEM_RESTART; 32import static com.android.internal.telephony.RILConstants.RIL_UNSOL_NITZ_TIME_RECEIVED; 33import static com.android.internal.telephony.RILConstants.RIL_UNSOL_OEM_HOOK_RAW; 34import static com.android.internal.telephony.RILConstants.RIL_UNSOL_ON_USSD; 35import static com.android.internal.telephony.RILConstants.RIL_UNSOL_PCO_DATA; 36import static com.android.internal.telephony.RILConstants.RIL_UNSOL_RADIO_CAPABILITY; 37import static com.android.internal.telephony.RILConstants.RIL_UNSOL_RESEND_INCALL_MUTE; 38import static com.android.internal.telephony.RILConstants.RIL_UNSOL_RESPONSE_CALL_STATE_CHANGED; 39import static com.android.internal.telephony.RILConstants.RIL_UNSOL_RESPONSE_CDMA_NEW_SMS; 40import static com.android.internal.telephony.RILConstants.RIL_UNSOL_RESPONSE_IMS_NETWORK_STATE_CHANGED; 41import static com.android.internal.telephony.RILConstants.RIL_UNSOL_RESPONSE_NETWORK_STATE_CHANGED; 42import static com.android.internal.telephony.RILConstants.RIL_UNSOL_RESPONSE_NEW_BROADCAST_SMS; 43import static com.android.internal.telephony.RILConstants.RIL_UNSOL_RESPONSE_NEW_SMS; 44import static com.android.internal.telephony.RILConstants.RIL_UNSOL_RESPONSE_NEW_SMS_ON_SIM; 45import static com.android.internal.telephony.RILConstants.RIL_UNSOL_RESPONSE_NEW_SMS_STATUS_REPORT; 46import static com.android.internal.telephony.RILConstants.RIL_UNSOL_RESPONSE_RADIO_STATE_CHANGED; 47import static com.android.internal.telephony.RILConstants.RIL_UNSOL_RESPONSE_SIM_STATUS_CHANGED; 48import static com.android.internal.telephony.RILConstants.RIL_UNSOL_RESTRICTED_STATE_CHANGED; 49import static com.android.internal.telephony.RILConstants.RIL_UNSOL_RIL_CONNECTED; 50import static com.android.internal.telephony.RILConstants.RIL_UNSOL_RINGBACK_TONE; 51import static com.android.internal.telephony.RILConstants.RIL_UNSOL_SIGNAL_STRENGTH; 52import static com.android.internal.telephony.RILConstants.RIL_UNSOL_SIM_REFRESH; 53import static com.android.internal.telephony.RILConstants.RIL_UNSOL_SIM_SMS_STORAGE_FULL; 54import static com.android.internal.telephony.RILConstants.RIL_UNSOL_SRVCC_STATE_NOTIFY; 55import static com.android.internal.telephony.RILConstants.RIL_UNSOL_STK_CALL_SETUP; 56import static com.android.internal.telephony.RILConstants.RIL_UNSOL_STK_CC_ALPHA_NOTIFY; 57import static com.android.internal.telephony.RILConstants.RIL_UNSOL_STK_EVENT_NOTIFY; 58import static com.android.internal.telephony.RILConstants.RIL_UNSOL_STK_PROACTIVE_COMMAND; 59import static com.android.internal.telephony.RILConstants.RIL_UNSOL_STK_SESSION_END; 60import static com.android.internal.telephony.RILConstants.RIL_UNSOL_SUPP_SVC_NOTIFICATION; 61import static com.android.internal.telephony.RILConstants.RIL_UNSOL_UICC_SUBSCRIPTION_STATUS_CHANGED; 62import static com.android.internal.telephony.RILConstants.RIL_UNSOL_VOICE_RADIO_TECH_CHANGED; 63import static com.android.internal.telephony.RILConstants.RIL_UNSOl_CDMA_PRL_CHANGED; 64 65import android.hardware.radio.V1_0.CdmaCallWaiting; 66import android.hardware.radio.V1_0.CdmaInformationRecord; 67import android.hardware.radio.V1_0.CdmaLineControlInfoRecord; 68import android.hardware.radio.V1_0.CdmaNumberInfoRecord; 69import android.hardware.radio.V1_0.CdmaRedirectingNumberInfoRecord; 70import android.hardware.radio.V1_0.CdmaSignalInfoRecord; 71import android.hardware.radio.V1_0.CdmaSmsMessage; 72import android.hardware.radio.V1_0.CdmaT53AudioControlInfoRecord; 73import android.hardware.radio.V1_0.CfData; 74import android.hardware.radio.V1_0.IRadioIndication; 75import android.hardware.radio.V1_0.LceDataInfo; 76import android.hardware.radio.V1_0.PcoDataInfo; 77import android.hardware.radio.V1_0.SetupDataCallResult; 78import android.hardware.radio.V1_0.SimRefreshResult; 79import android.hardware.radio.V1_0.SsInfoData; 80import android.hardware.radio.V1_0.StkCcUnsolSsResult; 81import android.hardware.radio.V1_0.SuppSvcNotification; 82import android.os.AsyncResult; 83import android.os.SystemProperties; 84import android.telephony.CellInfo; 85import android.telephony.PcoData; 86import android.telephony.SignalStrength; 87import android.telephony.SmsMessage; 88 89import com.android.internal.telephony.cdma.CdmaCallWaitingNotification; 90import com.android.internal.telephony.cdma.CdmaInformationRecords; 91import com.android.internal.telephony.dataconnection.DataCallResponse; 92import com.android.internal.telephony.gsm.SsData; 93import com.android.internal.telephony.gsm.SuppServiceNotification; 94import com.android.internal.telephony.nano.TelephonyProto.SmsSession; 95import com.android.internal.telephony.uicc.IccRefreshResponse; 96import com.android.internal.telephony.uicc.IccUtils; 97 98import java.util.ArrayList; 99 100public class RadioIndication extends IRadioIndication.Stub { 101 RIL mRil; 102 103 RadioIndication(RIL ril) { 104 mRil = ril; 105 } 106 107 /** 108 * Indicates when radio state changes. 109 * @param indicationType RadioIndicationType 110 * @param radioState android.hardware.radio.V1_0.RadioState 111 */ 112 public void radioStateChanged(int indicationType, int radioState) { 113 mRil.processIndication(indicationType); 114 115 CommandsInterface.RadioState newState = getRadioStateFromInt(radioState); 116 if (RIL.RILJ_LOGD) { 117 mRil.unsljLogMore(RIL_UNSOL_RESPONSE_RADIO_STATE_CHANGED, "radioStateChanged: " + 118 newState); 119 } 120 121 mRil.setRadioState(newState); 122 } 123 124 public void callStateChanged(int indicationType) { 125 mRil.processIndication(indicationType); 126 127 if (RIL.RILJ_LOGD) mRil.unsljLog(RIL_UNSOL_RESPONSE_CALL_STATE_CHANGED); 128 129 mRil.mCallStateRegistrants.notifyRegistrants(); 130 } 131 132 /** 133 * Indicates when either voice or data network state changed 134 * @param indicationType RadioIndicationType 135 */ 136 public void networkStateChanged(int indicationType) { 137 mRil.processIndication(indicationType); 138 139 if (RIL.RILJ_LOGD) mRil.unsljLog(RIL_UNSOL_RESPONSE_NETWORK_STATE_CHANGED); 140 141 mRil.mNetworkStateRegistrants.notifyRegistrants(); 142 } 143 144 public void newSms(int indicationType, ArrayList<Byte> pdu) { 145 mRil.processIndication(indicationType); 146 147 byte[] pduArray = RIL.arrayListToPrimitiveArray(pdu); 148 if (RIL.RILJ_LOGD) mRil.unsljLog(RIL_UNSOL_RESPONSE_NEW_SMS); 149 150 mRil.writeMetricsNewSms(SmsSession.Event.Tech.SMS_GSM, 151 SmsSession.Event.Format.SMS_FORMAT_3GPP); 152 153 SmsMessage sms = SmsMessage.newFromCMT(pduArray); 154 if (mRil.mGsmSmsRegistrant != null) { 155 mRil.mGsmSmsRegistrant.notifyRegistrant(new AsyncResult(null, sms, null)); 156 } 157 } 158 159 public void newSmsStatusReport(int indicationType, ArrayList<Byte> pdu) { 160 mRil.processIndication(indicationType); 161 162 byte[] pduArray = RIL.arrayListToPrimitiveArray(pdu); 163 if (RIL.RILJ_LOGD) mRil.unsljLog(RIL_UNSOL_RESPONSE_NEW_SMS_STATUS_REPORT); 164 165 if (mRil.mSmsStatusRegistrant != null) { 166 mRil.mSmsStatusRegistrant.notifyRegistrant(new AsyncResult(null, pduArray, null)); 167 } 168 } 169 170 public void newSmsOnSim(int indicationType, int recordNumber) { 171 mRil.processIndication(indicationType); 172 173 if (RIL.RILJ_LOGD) mRil.unsljLog(RIL_UNSOL_RESPONSE_NEW_SMS_ON_SIM); 174 175 if (mRil.mSmsOnSimRegistrant != null) { 176 mRil.mSmsOnSimRegistrant.notifyRegistrant(new AsyncResult(null, recordNumber, null)); 177 } 178 } 179 180 public void onUssd(int indicationType, int ussdModeType, String msg) { 181 mRil.processIndication(indicationType); 182 183 if (RIL.RILJ_LOGD) mRil.unsljLogMore(RIL_UNSOL_ON_USSD, "" + ussdModeType); 184 185 // todo: Clean this up with a parcelable class for better self-documentation 186 String[] resp = new String[2]; 187 resp[0] = "" + ussdModeType; 188 resp[1] = msg; 189 if (mRil.mUSSDRegistrant != null) { 190 mRil.mUSSDRegistrant.notifyRegistrant(new AsyncResult (null, resp, null)); 191 } 192 } 193 194 public void nitzTimeReceived(int indicationType, String nitzTime, long receivedTime) { 195 mRil.processIndication(indicationType); 196 197 if (RIL.RILJ_LOGD) mRil.unsljLogRet(RIL_UNSOL_NITZ_TIME_RECEIVED, nitzTime); 198 199 // todo: Clean this up with a parcelable class for better self-documentation 200 Object[] result = new Object[2]; 201 result[0] = nitzTime; 202 result[1] = receivedTime; 203 204 boolean ignoreNitz = SystemProperties.getBoolean( 205 TelephonyProperties.PROPERTY_IGNORE_NITZ, false); 206 207 if (ignoreNitz) { 208 if (RIL.RILJ_LOGD) mRil.riljLog("ignoring UNSOL_NITZ_TIME_RECEIVED"); 209 } else { 210 if (mRil.mNITZTimeRegistrant != null) { 211 mRil.mNITZTimeRegistrant.notifyRegistrant(new AsyncResult (null, result, null)); 212 } 213 // in case NITZ time registrant isn't registered yet, or a new registrant 214 // registers later 215 mRil.mLastNITZTimeInfo = result; 216 } 217 } 218 219 public void currentSignalStrength(int indicationType, 220 android.hardware.radio.V1_0.SignalStrength signalStrength) { 221 mRil.processIndication(indicationType); 222 223 SignalStrength ss = new SignalStrength(signalStrength.gw.signalStrength, 224 signalStrength.gw.bitErrorRate, 225 signalStrength.cdma.dbm, 226 signalStrength.cdma.ecio, 227 signalStrength.evdo.dbm, 228 signalStrength.evdo.ecio, 229 signalStrength.evdo.signalNoiseRatio, 230 signalStrength.lte.signalStrength, 231 signalStrength.lte.rsrp, 232 signalStrength.lte.rsrq, 233 signalStrength.lte.rssnr, 234 signalStrength.lte.cqi, 235 signalStrength.tdScdma.rscp, 236 false /* gsmFlag - don't care; will be changed by SST */); 237 238 // Note this is set to "verbose" because it happens frequently 239 if (RIL.RILJ_LOGV) mRil.unsljLogvRet(RIL_UNSOL_SIGNAL_STRENGTH, ss); 240 241 if (mRil.mSignalStrengthRegistrant != null) { 242 mRil.mSignalStrengthRegistrant.notifyRegistrant(new AsyncResult (null, ss, null)); 243 } 244 } 245 246 public void dataCallListChanged(int indicationType, ArrayList<SetupDataCallResult> dcList) { 247 mRil.processIndication(indicationType); 248 249 ArrayList<DataCallResponse> response = RIL.convertHalDcList(dcList); 250 if (RIL.RILJ_LOGD) mRil.unsljLogRet(RIL_UNSOL_DATA_CALL_LIST_CHANGED, response); 251 252 mRil.mDataCallListChangedRegistrants.notifyRegistrants( 253 new AsyncResult(null, response, null)); 254 } 255 256 public void suppSvcNotify(int indicationType, SuppSvcNotification suppSvcNotification) { 257 mRil.processIndication(indicationType); 258 259 SuppServiceNotification notification = new SuppServiceNotification(); 260 notification.notificationType = suppSvcNotification.isMT ? 1 : 0; 261 notification.code = suppSvcNotification.code; 262 notification.index = suppSvcNotification.index; 263 notification.type = suppSvcNotification.type; 264 notification.number = suppSvcNotification.number; 265 266 if (RIL.RILJ_LOGD) mRil.unsljLogRet(RIL_UNSOL_SUPP_SVC_NOTIFICATION, notification); 267 268 if (mRil.mSsnRegistrant != null) { 269 mRil.mSsnRegistrant.notifyRegistrant(new AsyncResult (null, notification, null)); 270 } 271 } 272 273 public void stkSessionEnd(int indicationType) { 274 mRil.processIndication(indicationType); 275 276 if (RIL.RILJ_LOGD) mRil.unsljLog(RIL_UNSOL_STK_SESSION_END); 277 278 if (mRil.mCatSessionEndRegistrant != null) { 279 mRil.mCatSessionEndRegistrant.notifyRegistrant(new AsyncResult (null, null, null)); 280 } 281 } 282 283 public void stkProactiveCommand(int indicationType, String cmd) { 284 mRil.processIndication(indicationType); 285 286 if (RIL.RILJ_LOGD) mRil.unsljLog(RIL_UNSOL_STK_PROACTIVE_COMMAND); 287 288 if (mRil.mCatProCmdRegistrant != null) { 289 mRil.mCatProCmdRegistrant.notifyRegistrant(new AsyncResult (null, cmd, null)); 290 } 291 } 292 293 public void stkEventNotify(int indicationType, String cmd) { 294 mRil.processIndication(indicationType); 295 296 if (RIL.RILJ_LOGD) mRil.unsljLog(RIL_UNSOL_STK_EVENT_NOTIFY); 297 298 if (mRil.mCatEventRegistrant != null) { 299 mRil.mCatEventRegistrant.notifyRegistrant(new AsyncResult (null, cmd, null)); 300 } 301 } 302 303 public void stkCallSetup(int indicationType, long timeout) { 304 mRil.processIndication(indicationType); 305 306 if (RIL.RILJ_LOGD) mRil.unsljLogRet(RIL_UNSOL_STK_CALL_SETUP, timeout); 307 308 if (mRil.mCatCallSetUpRegistrant != null) { 309 mRil.mCatCallSetUpRegistrant.notifyRegistrant(new AsyncResult (null, timeout, null)); 310 } 311 } 312 313 public void simSmsStorageFull(int indicationType) { 314 mRil.processIndication(indicationType); 315 316 if (RIL.RILJ_LOGD) mRil.unsljLog(RIL_UNSOL_SIM_SMS_STORAGE_FULL); 317 318 if (mRil.mIccSmsFullRegistrant != null) { 319 mRil.mIccSmsFullRegistrant.notifyRegistrant(); 320 } 321 } 322 323 public void simRefresh(int indicationType, SimRefreshResult refreshResult) { 324 mRil.processIndication(indicationType); 325 326 IccRefreshResponse response = new IccRefreshResponse(); 327 response.refreshResult = refreshResult.type; 328 response.efId = refreshResult.efId; 329 response.aid = refreshResult.aid; 330 331 if (RIL.RILJ_LOGD) mRil.unsljLogRet(RIL_UNSOL_SIM_REFRESH, response); 332 333 mRil.mIccRefreshRegistrants.notifyRegistrants(new AsyncResult (null, response, null)); 334 } 335 336 public void callRing(int indicationType, boolean isGsm, CdmaSignalInfoRecord record) { 337 mRil.processIndication(indicationType); 338 339 char response[] = null; 340 341 // Ignore record for gsm 342 if (!isGsm) { 343 // todo: Clean this up with a parcelable class for better self-documentation 344 response = new char[4]; 345 response[0] = (char) (record.isPresent ? 1 : 0); 346 response[1] = (char) record.signalType; 347 response[2] = (char) record.alertPitch; 348 response[3] = (char) record.signal; 349 mRil.writeMetricsCallRing(response); 350 } 351 352 if (RIL.RILJ_LOGD) mRil.unsljLogRet(RIL_UNSOL_CALL_RING, response); 353 354 if (mRil.mRingRegistrant != null) { 355 mRil.mRingRegistrant.notifyRegistrant(new AsyncResult (null, response, null)); 356 } 357 } 358 359 public void simStatusChanged(int indicationType) { 360 mRil.processIndication(indicationType); 361 362 if (RIL.RILJ_LOGD) mRil.unsljLog(RIL_UNSOL_RESPONSE_SIM_STATUS_CHANGED); 363 364 mRil.mIccStatusChangedRegistrants.notifyRegistrants(); 365 } 366 367 public void cdmaNewSms(int indicationType, CdmaSmsMessage msg) { 368 mRil.processIndication(indicationType); 369 370 if (RIL.RILJ_LOGD) mRil.unsljLog(RIL_UNSOL_RESPONSE_CDMA_NEW_SMS); 371 372 mRil.writeMetricsNewSms(SmsSession.Event.Tech.SMS_CDMA, 373 SmsSession.Event.Format.SMS_FORMAT_3GPP2); 374 375 // todo: conversion from CdmaSmsMessage to SmsMessage should be contained in this class so 376 // that usage of auto-generated HAL classes is limited to this file 377 SmsMessage sms = SmsMessage.newCdmaSmsFromRil(msg); 378 if (mRil.mCdmaSmsRegistrant != null) { 379 mRil.mCdmaSmsRegistrant.notifyRegistrant(new AsyncResult(null, sms, null)); 380 } 381 } 382 383 public void newBroadcastSms(int indicationType, ArrayList<Byte> data) { 384 mRil.processIndication(indicationType); 385 386 byte response[] = RIL.arrayListToPrimitiveArray(data); 387 if (RIL.RILJ_LOGD) { 388 mRil.unsljLogvRet(RIL_UNSOL_RESPONSE_NEW_BROADCAST_SMS, 389 IccUtils.bytesToHexString(response)); 390 } 391 392 if (mRil.mGsmBroadcastSmsRegistrant != null) { 393 mRil.mGsmBroadcastSmsRegistrant.notifyRegistrant(new AsyncResult(null, response, null)); 394 } 395 } 396 397 public void cdmaRuimSmsStorageFull(int indicationType) { 398 mRil.processIndication(indicationType); 399 400 if (RIL.RILJ_LOGD) mRil.unsljLog(RIL_UNSOL_CDMA_RUIM_SMS_STORAGE_FULL); 401 402 if (mRil.mIccSmsFullRegistrant != null) { 403 mRil.mIccSmsFullRegistrant.notifyRegistrant(); 404 } 405 } 406 407 public void restrictedStateChanged(int indicationType, int state) { 408 mRil.processIndication(indicationType); 409 410 if (RIL.RILJ_LOGD) mRil.unsljLogvRet(RIL_UNSOL_RESTRICTED_STATE_CHANGED, state); 411 412 if (mRil.mRestrictedStateRegistrant != null) { 413 mRil.mRestrictedStateRegistrant.notifyRegistrant(new AsyncResult (null, state, null)); 414 } 415 } 416 417 public void enterEmergencyCallbackMode(int indicationType) { 418 mRil.processIndication(indicationType); 419 420 if (RIL.RILJ_LOGD) mRil.unsljLog(RIL_UNSOL_ENTER_EMERGENCY_CALLBACK_MODE); 421 422 if (mRil.mEmergencyCallbackModeRegistrant != null) { 423 mRil.mEmergencyCallbackModeRegistrant.notifyRegistrant(); 424 } 425 } 426 427 public void cdmaCallWaiting(int indicationType, CdmaCallWaiting callWaitingRecord) { 428 mRil.processIndication(indicationType); 429 430 // todo: create a CdmaCallWaitingNotification constructor that takes in these fields to make 431 // sure no fields are missing 432 CdmaCallWaitingNotification notification = new CdmaCallWaitingNotification(); 433 notification.number = callWaitingRecord.number; 434 notification.numberPresentation = CdmaCallWaitingNotification.presentationFromCLIP( 435 callWaitingRecord.numberPresentation); 436 notification.name = callWaitingRecord.name; 437 notification.namePresentation = notification.numberPresentation; 438 notification.isPresent = callWaitingRecord.signalInfoRecord.isPresent ? 1 : 0; 439 notification.signalType = callWaitingRecord.signalInfoRecord.signalType; 440 notification.alertPitch = callWaitingRecord.signalInfoRecord.alertPitch; 441 notification.signal = callWaitingRecord.signalInfoRecord.signal; 442 notification.numberType = callWaitingRecord.numberType; 443 notification.numberPlan = callWaitingRecord.numberPlan; 444 445 if (RIL.RILJ_LOGD) mRil.unsljLogRet(RIL_UNSOL_CDMA_CALL_WAITING, notification); 446 447 mRil.mCallWaitingInfoRegistrants.notifyRegistrants( 448 new AsyncResult (null, notification, null)); 449 } 450 451 public void cdmaOtaProvisionStatus(int indicationType, int status) { 452 mRil.processIndication(indicationType); 453 454 int response[] = new int[1]; 455 response[0] = status; 456 457 if (RIL.RILJ_LOGD) mRil.unsljLogRet(RIL_UNSOL_CDMA_OTA_PROVISION_STATUS, response); 458 459 mRil.mOtaProvisionRegistrants.notifyRegistrants(new AsyncResult (null, response, null)); 460 } 461 462 public void cdmaInfoRec(int indicationType, 463 android.hardware.radio.V1_0.CdmaInformationRecords records) { 464 mRil.processIndication(indicationType); 465 466 int numberOfInfoRecs = records.infoRec.size(); 467 for (int i = 0; i < numberOfInfoRecs; i++) { 468 CdmaInformationRecord record = records.infoRec.get(i); 469 int id = record.name; 470 CdmaInformationRecords cdmaInformationRecords; 471 switch (id) { 472 case CdmaInformationRecords.RIL_CDMA_DISPLAY_INFO_REC: 473 case CdmaInformationRecords.RIL_CDMA_EXTENDED_DISPLAY_INFO_REC: 474 CdmaInformationRecords.CdmaDisplayInfoRec cdmaDisplayInfoRec = 475 new CdmaInformationRecords.CdmaDisplayInfoRec(id, 476 record.display.get(0).alphaBuf); 477 cdmaInformationRecords = new CdmaInformationRecords(cdmaDisplayInfoRec); 478 break; 479 480 case CdmaInformationRecords.RIL_CDMA_CALLED_PARTY_NUMBER_INFO_REC: 481 case CdmaInformationRecords.RIL_CDMA_CALLING_PARTY_NUMBER_INFO_REC: 482 case CdmaInformationRecords.RIL_CDMA_CONNECTED_NUMBER_INFO_REC: 483 CdmaNumberInfoRecord numInfoRecord = record.number.get(0); 484 CdmaInformationRecords.CdmaNumberInfoRec cdmaNumberInfoRec = 485 new CdmaInformationRecords.CdmaNumberInfoRec(id, 486 numInfoRecord.number, 487 numInfoRecord.numberType, 488 numInfoRecord.numberPlan, 489 numInfoRecord.pi, 490 numInfoRecord.si); 491 cdmaInformationRecords = new CdmaInformationRecords(cdmaNumberInfoRec); 492 break; 493 494 case CdmaInformationRecords.RIL_CDMA_SIGNAL_INFO_REC: 495 CdmaSignalInfoRecord signalInfoRecord = record.signal.get(0); 496 CdmaInformationRecords.CdmaSignalInfoRec cdmaSignalInfoRec = 497 new CdmaInformationRecords.CdmaSignalInfoRec( 498 signalInfoRecord.isPresent ? 1 : 0, 499 signalInfoRecord.signalType, 500 signalInfoRecord.alertPitch, 501 signalInfoRecord.signal); 502 cdmaInformationRecords = new CdmaInformationRecords(cdmaSignalInfoRec); 503 break; 504 505 case CdmaInformationRecords.RIL_CDMA_REDIRECTING_NUMBER_INFO_REC: 506 CdmaRedirectingNumberInfoRecord redirectingNumberInfoRecord = 507 record.redir.get(0); 508 CdmaInformationRecords.CdmaRedirectingNumberInfoRec 509 cdmaRedirectingNumberInfoRec = 510 new CdmaInformationRecords.CdmaRedirectingNumberInfoRec( 511 redirectingNumberInfoRecord.redirectingNumber.number, 512 redirectingNumberInfoRecord.redirectingNumber.numberType, 513 redirectingNumberInfoRecord.redirectingNumber.numberPlan, 514 redirectingNumberInfoRecord.redirectingNumber.pi, 515 redirectingNumberInfoRecord.redirectingNumber.si, 516 redirectingNumberInfoRecord.redirectingReason); 517 cdmaInformationRecords = new CdmaInformationRecords( 518 cdmaRedirectingNumberInfoRec); 519 break; 520 521 case CdmaInformationRecords.RIL_CDMA_LINE_CONTROL_INFO_REC: 522 CdmaLineControlInfoRecord lineControlInfoRecord = record.lineCtrl.get(0); 523 CdmaInformationRecords.CdmaLineControlInfoRec cdmaLineControlInfoRec = 524 new CdmaInformationRecords.CdmaLineControlInfoRec( 525 lineControlInfoRecord.lineCtrlPolarityIncluded, 526 lineControlInfoRecord.lineCtrlToggle, 527 lineControlInfoRecord.lineCtrlReverse, 528 lineControlInfoRecord.lineCtrlPowerDenial); 529 cdmaInformationRecords = new CdmaInformationRecords(cdmaLineControlInfoRec); 530 break; 531 532 case CdmaInformationRecords.RIL_CDMA_T53_CLIR_INFO_REC: 533 CdmaInformationRecords.CdmaT53ClirInfoRec cdmaT53ClirInfoRec = 534 new CdmaInformationRecords.CdmaT53ClirInfoRec(record.clir.get(0).cause); 535 cdmaInformationRecords = new CdmaInformationRecords(cdmaT53ClirInfoRec); 536 break; 537 538 case CdmaInformationRecords.RIL_CDMA_T53_AUDIO_CONTROL_INFO_REC: 539 CdmaT53AudioControlInfoRecord audioControlInfoRecord = record.audioCtrl.get(0); 540 CdmaInformationRecords.CdmaT53AudioControlInfoRec cdmaT53AudioControlInfoRec = 541 new CdmaInformationRecords.CdmaT53AudioControlInfoRec( 542 audioControlInfoRecord.upLink, 543 audioControlInfoRecord.downLink); 544 cdmaInformationRecords = new CdmaInformationRecords(cdmaT53AudioControlInfoRec); 545 break; 546 547 default: 548 throw new RuntimeException("RIL_UNSOL_CDMA_INFO_REC: unsupported record. Got " 549 + CdmaInformationRecords.idToString(id) + " "); 550 } 551 552 if (RIL.RILJ_LOGD) mRil.unsljLogRet(RIL_UNSOL_CDMA_INFO_REC, cdmaInformationRecords); 553 mRil.notifyRegistrantsCdmaInfoRec(cdmaInformationRecords); 554 } 555 } 556 557 public void oemHookRaw(int indicationType, ArrayList<Byte> data) { 558 mRil.processIndication(indicationType); 559 560 byte response[] = RIL.arrayListToPrimitiveArray(data); 561 if (RIL.RILJ_LOGD) { 562 mRil.unsljLogvRet(RIL_UNSOL_OEM_HOOK_RAW, 563 IccUtils.bytesToHexString(response)); 564 } 565 566 if (mRil.mUnsolOemHookRawRegistrant != null) { 567 mRil.mUnsolOemHookRawRegistrant.notifyRegistrant(new AsyncResult(null, response, null)); 568 } 569 } 570 571 public void indicateRingbackTone(int indicationType, boolean start) { 572 mRil.processIndication(indicationType); 573 574 if (RIL.RILJ_LOGD) mRil.unsljLogvRet(RIL_UNSOL_RINGBACK_TONE, start); 575 576 mRil.mRingbackToneRegistrants.notifyRegistrants(new AsyncResult(null, start, null)); 577 } 578 579 public void resendIncallMute(int indicationType) { 580 mRil.processIndication(indicationType); 581 582 if (RIL.RILJ_LOGD) mRil.unsljLog(RIL_UNSOL_RESEND_INCALL_MUTE); 583 584 mRil.mResendIncallMuteRegistrants.notifyRegistrants(); 585 } 586 587 public void cdmaSubscriptionSourceChanged(int indicationType, int cdmaSource) { 588 mRil.processIndication(indicationType); 589 590 int response[] = new int[1]; 591 response[0] = cdmaSource; 592 593 if (RIL.RILJ_LOGD) mRil.unsljLogRet(RIL_UNSOL_CDMA_SUBSCRIPTION_SOURCE_CHANGED, response); 594 595 mRil.mCdmaSubscriptionChangedRegistrants.notifyRegistrants( 596 new AsyncResult (null, response, null)); 597 } 598 599 public void cdmaPrlChanged(int indicationType, int version) { 600 mRil.processIndication(indicationType); 601 602 int response[] = new int[1]; 603 response[0] = version; 604 605 if (RIL.RILJ_LOGD) mRil.unsljLogRet(RIL_UNSOl_CDMA_PRL_CHANGED, response); 606 607 mRil.mCdmaPrlChangedRegistrants.notifyRegistrants( 608 new AsyncResult (null, response, null)); 609 } 610 611 public void exitEmergencyCallbackMode(int indicationType) { 612 mRil.processIndication(indicationType); 613 614 if (RIL.RILJ_LOGD) mRil.unsljLog(RIL_UNSOL_EXIT_EMERGENCY_CALLBACK_MODE); 615 616 mRil.mExitEmergencyCallbackModeRegistrants.notifyRegistrants(); 617 } 618 619 public void rilConnected(int indicationType) { 620 mRil.processIndication(indicationType); 621 622 if (RIL.RILJ_LOGD) mRil.unsljLog(RIL_UNSOL_RIL_CONNECTED); 623 624 // Initial conditions 625 mRil.setRadioPower(false, null); 626 mRil.setCdmaSubscriptionSource(mRil.mCdmaSubscription, null); 627 mRil.setCellInfoListRate(); 628 // todo: this should not require a version number now. Setting it to latest RIL version for 629 // now. 630 mRil.notifyRegistrantsRilConnectionChanged(15); 631 // When modem crashes, if user turns the screen off before RIL reconnects, screen 632 // state cannot be sent to modem. Resend the display state here so that modem 633 // has the correct state (to stop signal strength reporting, etc). 634 mRil.updateScreenState(true); 635 } 636 637 public void voiceRadioTechChanged(int indicationType, int rat) { 638 mRil.processIndication(indicationType); 639 640 int response[] = new int[1]; 641 response[0] = rat; 642 643 if (RIL.RILJ_LOGD) mRil.unsljLogRet(RIL_UNSOL_VOICE_RADIO_TECH_CHANGED, response); 644 645 mRil.mVoiceRadioTechChangedRegistrants.notifyRegistrants( 646 new AsyncResult (null, response, null)); 647 } 648 649 public void cellInfoList(int indicationType, 650 ArrayList<android.hardware.radio.V1_0.CellInfo> records) { 651 mRil.processIndication(indicationType); 652 653 ArrayList<CellInfo> response = RIL.responseCellInfoList(records); 654 655 if (RIL.RILJ_LOGD) mRil.unsljLogRet(RIL_UNSOL_CELL_INFO_LIST, response); 656 657 mRil.mRilCellInfoListRegistrants.notifyRegistrants(new AsyncResult (null, response, null)); 658 } 659 660 public void imsNetworkStateChanged(int indicationType) { 661 mRil.processIndication(indicationType); 662 663 if (RIL.RILJ_LOGD) mRil.unsljLog(RIL_UNSOL_RESPONSE_IMS_NETWORK_STATE_CHANGED); 664 665 mRil.mImsNetworkStateChangedRegistrants.notifyRegistrants(); 666 } 667 668 public void subscriptionStatusChanged(int indicationType, boolean activate) { 669 mRil.processIndication(indicationType); 670 671 int response[] = new int[1]; 672 response[0] = activate ? 1 : 0; 673 674 if (RIL.RILJ_LOGD) mRil.unsljLogRet(RIL_UNSOL_UICC_SUBSCRIPTION_STATUS_CHANGED, response); 675 676 mRil.mSubscriptionStatusRegistrants.notifyRegistrants( 677 new AsyncResult (null, response, null)); 678 } 679 680 public void srvccStateNotify(int indicationType, int state) { 681 mRil.processIndication(indicationType); 682 683 int response[] = new int[1]; 684 response[0] = state; 685 686 if (RIL.RILJ_LOGD) mRil.unsljLogRet(RIL_UNSOL_SRVCC_STATE_NOTIFY, response); 687 688 mRil.writeMetricsSrvcc(state); 689 690 mRil.mSrvccStateRegistrants.notifyRegistrants( 691 new AsyncResult (null, response, null)); 692 } 693 694 public void hardwareConfigChanged( 695 int indicationType, 696 ArrayList<android.hardware.radio.V1_0.HardwareConfig> configs) { 697 mRil.processIndication(indicationType); 698 699 ArrayList<HardwareConfig> response = RIL.convertHalHwConfigList(configs, mRil); 700 701 if (RIL.RILJ_LOGD) mRil.unsljLogRet(RIL_UNSOL_HARDWARE_CONFIG_CHANGED, response); 702 703 mRil.mHardwareConfigChangeRegistrants.notifyRegistrants( 704 new AsyncResult (null, response, null)); 705 } 706 707 public void radioCapabilityIndication(int indicationType, 708 android.hardware.radio.V1_0.RadioCapability rc) { 709 mRil.processIndication(indicationType); 710 711 RadioCapability response = RIL.convertHalRadioCapability(rc, mRil); 712 713 if (RIL.RILJ_LOGD) mRil.unsljLogRet(RIL_UNSOL_RADIO_CAPABILITY, response); 714 715 mRil.mPhoneRadioCapabilityChangedRegistrants.notifyRegistrants( 716 new AsyncResult (null, response, null)); 717 } 718 719 public void onSupplementaryServiceIndication(int indicationType, StkCcUnsolSsResult ss) { 720 mRil.processIndication(indicationType); 721 722 int num; 723 SsData ssData = new SsData(); 724 725 ssData.serviceType = ssData.ServiceTypeFromRILInt(ss.serviceType); 726 ssData.requestType = ssData.RequestTypeFromRILInt(ss.requestType); 727 ssData.teleserviceType = ssData.TeleserviceTypeFromRILInt(ss.teleserviceType); 728 ssData.serviceClass = ss.serviceClass; // This is service class sent in the SS request. 729 ssData.result = ss.result; // This is the result of the SS request. 730 731 if (ssData.serviceType.isTypeCF() && 732 ssData.requestType.isTypeInterrogation()) { 733 CfData cfData = ss.cfData.get(0); 734 num = cfData.cfInfo.size(); 735 ssData.cfInfo = new CallForwardInfo[num]; 736 737 for (int i = 0; i < num; i++) { 738 android.hardware.radio.V1_0.CallForwardInfo cfInfo = cfData.cfInfo.get(i); 739 ssData.cfInfo[i] = new CallForwardInfo(); 740 741 ssData.cfInfo[i].status = cfInfo.status; 742 ssData.cfInfo[i].reason = cfInfo.reason; 743 ssData.cfInfo[i].serviceClass = cfInfo.serviceClass; 744 ssData.cfInfo[i].toa = cfInfo.toa; 745 ssData.cfInfo[i].number = cfInfo.number; 746 ssData.cfInfo[i].timeSeconds = cfInfo.timeSeconds; 747 748 mRil.riljLog("[SS Data] CF Info " + i + " : " + ssData.cfInfo[i]); 749 } 750 } else { 751 SsInfoData ssInfo = ss.ssInfo.get(0); 752 num = ssInfo.ssInfo.size(); 753 ssData.ssInfo = new int[num]; 754 for (int i = 0; i < num; i++) { 755 ssData.ssInfo[i] = ssInfo.ssInfo.get(i); 756 mRil.riljLog("[SS Data] SS Info " + i + " : " + ssData.ssInfo[i]); 757 } 758 } 759 } 760 761 public void stkCallControlAlphaNotify(int indicationType, String alpha) { 762 mRil.processIndication(indicationType); 763 764 if (RIL.RILJ_LOGD) mRil.unsljLogRet(RIL_UNSOL_STK_CC_ALPHA_NOTIFY, alpha); 765 766 if (mRil.mCatCcAlphaRegistrant != null) { 767 mRil.mCatCcAlphaRegistrant.notifyRegistrant(new AsyncResult (null, alpha, null)); 768 } 769 } 770 771 public void lceData(int indicationType, LceDataInfo lce) { 772 mRil.processIndication(indicationType); 773 774 ArrayList<Integer> response = RIL.convertHalLceData(lce, mRil); 775 776 if (RIL.RILJ_LOGD) mRil.unsljLogRet(RIL_UNSOL_LCEDATA_RECV, response); 777 778 if (mRil.mLceInfoRegistrant != null) { 779 mRil.mLceInfoRegistrant.notifyRegistrant(new AsyncResult(null, response, null)); 780 } 781 } 782 783 public void pcoData(int indicationType, PcoDataInfo pco) { 784 mRil.processIndication(indicationType); 785 786 PcoData response = new PcoData(pco.cid, 787 pco.bearerProto, 788 pco.pcoId, 789 RIL.arrayListToPrimitiveArray(pco.contents)); 790 791 if (RIL.RILJ_LOGD) mRil.unsljLogRet(RIL_UNSOL_PCO_DATA, response); 792 793 mRil.mPcoDataRegistrants.notifyRegistrants(new AsyncResult(null, response, null)); 794 } 795 796 public void modemReset(int indicationType, String reason) { 797 mRil.processIndication(indicationType); 798 799 if (RIL.RILJ_LOGD) mRil.unsljLogRet(RIL_UNSOL_MODEM_RESTART, reason); 800 801 mRil.writeMetricsModemRestartEvent(reason); 802 } 803 804 private CommandsInterface.RadioState getRadioStateFromInt(int stateInt) { 805 CommandsInterface.RadioState state; 806 807 switch(stateInt) { 808 case android.hardware.radio.V1_0.RadioState.OFF: 809 state = CommandsInterface.RadioState.RADIO_OFF; 810 break; 811 case android.hardware.radio.V1_0.RadioState.UNAVAILABLE: 812 state = CommandsInterface.RadioState.RADIO_UNAVAILABLE; 813 break; 814 case android.hardware.radio.V1_0.RadioState.ON: 815 state = CommandsInterface.RadioState.RADIO_ON; 816 break; 817 default: 818 throw new RuntimeException("Unrecognized RadioState: " + stateInt); 819 } 820 return state; 821 } 822} 823