RadioIndication.java revision a46dc426a10a9d3c95cca80a80d9c0759459cb4f
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 = RIL.convertHalSignalStrength(signalStrength); 224 // Note this is set to "verbose" because it happens frequently 225 if (RIL.RILJ_LOGV) mRil.unsljLogvRet(RIL_UNSOL_SIGNAL_STRENGTH, ss); 226 227 if (mRil.mSignalStrengthRegistrant != null) { 228 mRil.mSignalStrengthRegistrant.notifyRegistrant(new AsyncResult (null, ss, null)); 229 } 230 } 231 232 public void dataCallListChanged(int indicationType, ArrayList<SetupDataCallResult> dcList) { 233 mRil.processIndication(indicationType); 234 235 ArrayList<DataCallResponse> response = RIL.convertHalDcList(dcList); 236 if (RIL.RILJ_LOGD) mRil.unsljLogRet(RIL_UNSOL_DATA_CALL_LIST_CHANGED, response); 237 238 mRil.mDataCallListChangedRegistrants.notifyRegistrants( 239 new AsyncResult(null, response, null)); 240 } 241 242 public void suppSvcNotify(int indicationType, SuppSvcNotification suppSvcNotification) { 243 mRil.processIndication(indicationType); 244 245 SuppServiceNotification notification = new SuppServiceNotification(); 246 notification.notificationType = suppSvcNotification.isMT ? 1 : 0; 247 notification.code = suppSvcNotification.code; 248 notification.index = suppSvcNotification.index; 249 notification.type = suppSvcNotification.type; 250 notification.number = suppSvcNotification.number; 251 252 if (RIL.RILJ_LOGD) mRil.unsljLogRet(RIL_UNSOL_SUPP_SVC_NOTIFICATION, notification); 253 254 if (mRil.mSsnRegistrant != null) { 255 mRil.mSsnRegistrant.notifyRegistrant(new AsyncResult (null, notification, null)); 256 } 257 } 258 259 public void stkSessionEnd(int indicationType) { 260 mRil.processIndication(indicationType); 261 262 if (RIL.RILJ_LOGD) mRil.unsljLog(RIL_UNSOL_STK_SESSION_END); 263 264 if (mRil.mCatSessionEndRegistrant != null) { 265 mRil.mCatSessionEndRegistrant.notifyRegistrant(new AsyncResult (null, null, null)); 266 } 267 } 268 269 public void stkProactiveCommand(int indicationType, String cmd) { 270 mRil.processIndication(indicationType); 271 272 if (RIL.RILJ_LOGD) mRil.unsljLog(RIL_UNSOL_STK_PROACTIVE_COMMAND); 273 274 if (mRil.mCatProCmdRegistrant != null) { 275 mRil.mCatProCmdRegistrant.notifyRegistrant(new AsyncResult (null, cmd, null)); 276 } 277 } 278 279 public void stkEventNotify(int indicationType, String cmd) { 280 mRil.processIndication(indicationType); 281 282 if (RIL.RILJ_LOGD) mRil.unsljLog(RIL_UNSOL_STK_EVENT_NOTIFY); 283 284 if (mRil.mCatEventRegistrant != null) { 285 mRil.mCatEventRegistrant.notifyRegistrant(new AsyncResult (null, cmd, null)); 286 } 287 } 288 289 public void stkCallSetup(int indicationType, long timeout) { 290 mRil.processIndication(indicationType); 291 292 if (RIL.RILJ_LOGD) mRil.unsljLogRet(RIL_UNSOL_STK_CALL_SETUP, timeout); 293 294 if (mRil.mCatCallSetUpRegistrant != null) { 295 mRil.mCatCallSetUpRegistrant.notifyRegistrant(new AsyncResult (null, timeout, null)); 296 } 297 } 298 299 public void simSmsStorageFull(int indicationType) { 300 mRil.processIndication(indicationType); 301 302 if (RIL.RILJ_LOGD) mRil.unsljLog(RIL_UNSOL_SIM_SMS_STORAGE_FULL); 303 304 if (mRil.mIccSmsFullRegistrant != null) { 305 mRil.mIccSmsFullRegistrant.notifyRegistrant(); 306 } 307 } 308 309 public void simRefresh(int indicationType, SimRefreshResult refreshResult) { 310 mRil.processIndication(indicationType); 311 312 IccRefreshResponse response = new IccRefreshResponse(); 313 response.refreshResult = refreshResult.type; 314 response.efId = refreshResult.efId; 315 response.aid = refreshResult.aid; 316 317 if (RIL.RILJ_LOGD) mRil.unsljLogRet(RIL_UNSOL_SIM_REFRESH, response); 318 319 mRil.mIccRefreshRegistrants.notifyRegistrants(new AsyncResult (null, response, null)); 320 } 321 322 public void callRing(int indicationType, boolean isGsm, CdmaSignalInfoRecord record) { 323 mRil.processIndication(indicationType); 324 325 char response[] = null; 326 327 // Ignore record for gsm 328 if (!isGsm) { 329 // todo: Clean this up with a parcelable class for better self-documentation 330 response = new char[4]; 331 response[0] = (char) (record.isPresent ? 1 : 0); 332 response[1] = (char) record.signalType; 333 response[2] = (char) record.alertPitch; 334 response[3] = (char) record.signal; 335 mRil.writeMetricsCallRing(response); 336 } 337 338 if (RIL.RILJ_LOGD) mRil.unsljLogRet(RIL_UNSOL_CALL_RING, response); 339 340 if (mRil.mRingRegistrant != null) { 341 mRil.mRingRegistrant.notifyRegistrant(new AsyncResult (null, response, null)); 342 } 343 } 344 345 public void simStatusChanged(int indicationType) { 346 mRil.processIndication(indicationType); 347 348 if (RIL.RILJ_LOGD) mRil.unsljLog(RIL_UNSOL_RESPONSE_SIM_STATUS_CHANGED); 349 350 mRil.mIccStatusChangedRegistrants.notifyRegistrants(); 351 } 352 353 public void cdmaNewSms(int indicationType, CdmaSmsMessage msg) { 354 mRil.processIndication(indicationType); 355 356 if (RIL.RILJ_LOGD) mRil.unsljLog(RIL_UNSOL_RESPONSE_CDMA_NEW_SMS); 357 358 mRil.writeMetricsNewSms(SmsSession.Event.Tech.SMS_CDMA, 359 SmsSession.Event.Format.SMS_FORMAT_3GPP2); 360 361 // todo: conversion from CdmaSmsMessage to SmsMessage should be contained in this class so 362 // that usage of auto-generated HAL classes is limited to this file 363 SmsMessage sms = SmsMessage.newCdmaSmsFromRil(msg); 364 if (mRil.mCdmaSmsRegistrant != null) { 365 mRil.mCdmaSmsRegistrant.notifyRegistrant(new AsyncResult(null, sms, null)); 366 } 367 } 368 369 public void newBroadcastSms(int indicationType, ArrayList<Byte> data) { 370 mRil.processIndication(indicationType); 371 372 byte response[] = RIL.arrayListToPrimitiveArray(data); 373 if (RIL.RILJ_LOGD) { 374 mRil.unsljLogvRet(RIL_UNSOL_RESPONSE_NEW_BROADCAST_SMS, 375 IccUtils.bytesToHexString(response)); 376 } 377 378 if (mRil.mGsmBroadcastSmsRegistrant != null) { 379 mRil.mGsmBroadcastSmsRegistrant.notifyRegistrant(new AsyncResult(null, response, null)); 380 } 381 } 382 383 public void cdmaRuimSmsStorageFull(int indicationType) { 384 mRil.processIndication(indicationType); 385 386 if (RIL.RILJ_LOGD) mRil.unsljLog(RIL_UNSOL_CDMA_RUIM_SMS_STORAGE_FULL); 387 388 if (mRil.mIccSmsFullRegistrant != null) { 389 mRil.mIccSmsFullRegistrant.notifyRegistrant(); 390 } 391 } 392 393 public void restrictedStateChanged(int indicationType, int state) { 394 mRil.processIndication(indicationType); 395 396 if (RIL.RILJ_LOGD) mRil.unsljLogvRet(RIL_UNSOL_RESTRICTED_STATE_CHANGED, state); 397 398 if (mRil.mRestrictedStateRegistrant != null) { 399 mRil.mRestrictedStateRegistrant.notifyRegistrant(new AsyncResult (null, state, null)); 400 } 401 } 402 403 public void enterEmergencyCallbackMode(int indicationType) { 404 mRil.processIndication(indicationType); 405 406 if (RIL.RILJ_LOGD) mRil.unsljLog(RIL_UNSOL_ENTER_EMERGENCY_CALLBACK_MODE); 407 408 if (mRil.mEmergencyCallbackModeRegistrant != null) { 409 mRil.mEmergencyCallbackModeRegistrant.notifyRegistrant(); 410 } 411 } 412 413 public void cdmaCallWaiting(int indicationType, CdmaCallWaiting callWaitingRecord) { 414 mRil.processIndication(indicationType); 415 416 // todo: create a CdmaCallWaitingNotification constructor that takes in these fields to make 417 // sure no fields are missing 418 CdmaCallWaitingNotification notification = new CdmaCallWaitingNotification(); 419 notification.number = callWaitingRecord.number; 420 notification.numberPresentation = CdmaCallWaitingNotification.presentationFromCLIP( 421 callWaitingRecord.numberPresentation); 422 notification.name = callWaitingRecord.name; 423 notification.namePresentation = notification.numberPresentation; 424 notification.isPresent = callWaitingRecord.signalInfoRecord.isPresent ? 1 : 0; 425 notification.signalType = callWaitingRecord.signalInfoRecord.signalType; 426 notification.alertPitch = callWaitingRecord.signalInfoRecord.alertPitch; 427 notification.signal = callWaitingRecord.signalInfoRecord.signal; 428 notification.numberType = callWaitingRecord.numberType; 429 notification.numberPlan = callWaitingRecord.numberPlan; 430 431 if (RIL.RILJ_LOGD) mRil.unsljLogRet(RIL_UNSOL_CDMA_CALL_WAITING, notification); 432 433 mRil.mCallWaitingInfoRegistrants.notifyRegistrants( 434 new AsyncResult (null, notification, null)); 435 } 436 437 public void cdmaOtaProvisionStatus(int indicationType, int status) { 438 mRil.processIndication(indicationType); 439 440 int response[] = new int[1]; 441 response[0] = status; 442 443 if (RIL.RILJ_LOGD) mRil.unsljLogRet(RIL_UNSOL_CDMA_OTA_PROVISION_STATUS, response); 444 445 mRil.mOtaProvisionRegistrants.notifyRegistrants(new AsyncResult (null, response, null)); 446 } 447 448 public void cdmaInfoRec(int indicationType, 449 android.hardware.radio.V1_0.CdmaInformationRecords records) { 450 mRil.processIndication(indicationType); 451 452 int numberOfInfoRecs = records.infoRec.size(); 453 for (int i = 0; i < numberOfInfoRecs; i++) { 454 CdmaInformationRecord record = records.infoRec.get(i); 455 int id = record.name; 456 CdmaInformationRecords cdmaInformationRecords; 457 switch (id) { 458 case CdmaInformationRecords.RIL_CDMA_DISPLAY_INFO_REC: 459 case CdmaInformationRecords.RIL_CDMA_EXTENDED_DISPLAY_INFO_REC: 460 CdmaInformationRecords.CdmaDisplayInfoRec cdmaDisplayInfoRec = 461 new CdmaInformationRecords.CdmaDisplayInfoRec(id, 462 record.display.get(0).alphaBuf); 463 cdmaInformationRecords = new CdmaInformationRecords(cdmaDisplayInfoRec); 464 break; 465 466 case CdmaInformationRecords.RIL_CDMA_CALLED_PARTY_NUMBER_INFO_REC: 467 case CdmaInformationRecords.RIL_CDMA_CALLING_PARTY_NUMBER_INFO_REC: 468 case CdmaInformationRecords.RIL_CDMA_CONNECTED_NUMBER_INFO_REC: 469 CdmaNumberInfoRecord numInfoRecord = record.number.get(0); 470 CdmaInformationRecords.CdmaNumberInfoRec cdmaNumberInfoRec = 471 new CdmaInformationRecords.CdmaNumberInfoRec(id, 472 numInfoRecord.number, 473 numInfoRecord.numberType, 474 numInfoRecord.numberPlan, 475 numInfoRecord.pi, 476 numInfoRecord.si); 477 cdmaInformationRecords = new CdmaInformationRecords(cdmaNumberInfoRec); 478 break; 479 480 case CdmaInformationRecords.RIL_CDMA_SIGNAL_INFO_REC: 481 CdmaSignalInfoRecord signalInfoRecord = record.signal.get(0); 482 CdmaInformationRecords.CdmaSignalInfoRec cdmaSignalInfoRec = 483 new CdmaInformationRecords.CdmaSignalInfoRec( 484 signalInfoRecord.isPresent ? 1 : 0, 485 signalInfoRecord.signalType, 486 signalInfoRecord.alertPitch, 487 signalInfoRecord.signal); 488 cdmaInformationRecords = new CdmaInformationRecords(cdmaSignalInfoRec); 489 break; 490 491 case CdmaInformationRecords.RIL_CDMA_REDIRECTING_NUMBER_INFO_REC: 492 CdmaRedirectingNumberInfoRecord redirectingNumberInfoRecord = 493 record.redir.get(0); 494 CdmaInformationRecords.CdmaRedirectingNumberInfoRec 495 cdmaRedirectingNumberInfoRec = 496 new CdmaInformationRecords.CdmaRedirectingNumberInfoRec( 497 redirectingNumberInfoRecord.redirectingNumber.number, 498 redirectingNumberInfoRecord.redirectingNumber.numberType, 499 redirectingNumberInfoRecord.redirectingNumber.numberPlan, 500 redirectingNumberInfoRecord.redirectingNumber.pi, 501 redirectingNumberInfoRecord.redirectingNumber.si, 502 redirectingNumberInfoRecord.redirectingReason); 503 cdmaInformationRecords = new CdmaInformationRecords( 504 cdmaRedirectingNumberInfoRec); 505 break; 506 507 case CdmaInformationRecords.RIL_CDMA_LINE_CONTROL_INFO_REC: 508 CdmaLineControlInfoRecord lineControlInfoRecord = record.lineCtrl.get(0); 509 CdmaInformationRecords.CdmaLineControlInfoRec cdmaLineControlInfoRec = 510 new CdmaInformationRecords.CdmaLineControlInfoRec( 511 lineControlInfoRecord.lineCtrlPolarityIncluded, 512 lineControlInfoRecord.lineCtrlToggle, 513 lineControlInfoRecord.lineCtrlReverse, 514 lineControlInfoRecord.lineCtrlPowerDenial); 515 cdmaInformationRecords = new CdmaInformationRecords(cdmaLineControlInfoRec); 516 break; 517 518 case CdmaInformationRecords.RIL_CDMA_T53_CLIR_INFO_REC: 519 CdmaInformationRecords.CdmaT53ClirInfoRec cdmaT53ClirInfoRec = 520 new CdmaInformationRecords.CdmaT53ClirInfoRec(record.clir.get(0).cause); 521 cdmaInformationRecords = new CdmaInformationRecords(cdmaT53ClirInfoRec); 522 break; 523 524 case CdmaInformationRecords.RIL_CDMA_T53_AUDIO_CONTROL_INFO_REC: 525 CdmaT53AudioControlInfoRecord audioControlInfoRecord = record.audioCtrl.get(0); 526 CdmaInformationRecords.CdmaT53AudioControlInfoRec cdmaT53AudioControlInfoRec = 527 new CdmaInformationRecords.CdmaT53AudioControlInfoRec( 528 audioControlInfoRecord.upLink, 529 audioControlInfoRecord.downLink); 530 cdmaInformationRecords = new CdmaInformationRecords(cdmaT53AudioControlInfoRec); 531 break; 532 533 default: 534 throw new RuntimeException("RIL_UNSOL_CDMA_INFO_REC: unsupported record. Got " 535 + CdmaInformationRecords.idToString(id) + " "); 536 } 537 538 if (RIL.RILJ_LOGD) mRil.unsljLogRet(RIL_UNSOL_CDMA_INFO_REC, cdmaInformationRecords); 539 mRil.notifyRegistrantsCdmaInfoRec(cdmaInformationRecords); 540 } 541 } 542 543 public void oemHookRaw(int indicationType, ArrayList<Byte> data) { 544 mRil.processIndication(indicationType); 545 546 byte response[] = RIL.arrayListToPrimitiveArray(data); 547 if (RIL.RILJ_LOGD) { 548 mRil.unsljLogvRet(RIL_UNSOL_OEM_HOOK_RAW, 549 IccUtils.bytesToHexString(response)); 550 } 551 552 if (mRil.mUnsolOemHookRawRegistrant != null) { 553 mRil.mUnsolOemHookRawRegistrant.notifyRegistrant(new AsyncResult(null, response, null)); 554 } 555 } 556 557 public void indicateRingbackTone(int indicationType, boolean start) { 558 mRil.processIndication(indicationType); 559 560 if (RIL.RILJ_LOGD) mRil.unsljLogvRet(RIL_UNSOL_RINGBACK_TONE, start); 561 562 mRil.mRingbackToneRegistrants.notifyRegistrants(new AsyncResult(null, start, null)); 563 } 564 565 public void resendIncallMute(int indicationType) { 566 mRil.processIndication(indicationType); 567 568 if (RIL.RILJ_LOGD) mRil.unsljLog(RIL_UNSOL_RESEND_INCALL_MUTE); 569 570 mRil.mResendIncallMuteRegistrants.notifyRegistrants(); 571 } 572 573 public void cdmaSubscriptionSourceChanged(int indicationType, int cdmaSource) { 574 mRil.processIndication(indicationType); 575 576 int response[] = new int[1]; 577 response[0] = cdmaSource; 578 579 if (RIL.RILJ_LOGD) mRil.unsljLogRet(RIL_UNSOL_CDMA_SUBSCRIPTION_SOURCE_CHANGED, response); 580 581 mRil.mCdmaSubscriptionChangedRegistrants.notifyRegistrants( 582 new AsyncResult (null, response, null)); 583 } 584 585 public void cdmaPrlChanged(int indicationType, int version) { 586 mRil.processIndication(indicationType); 587 588 int response[] = new int[1]; 589 response[0] = version; 590 591 if (RIL.RILJ_LOGD) mRil.unsljLogRet(RIL_UNSOl_CDMA_PRL_CHANGED, response); 592 593 mRil.mCdmaPrlChangedRegistrants.notifyRegistrants( 594 new AsyncResult (null, response, null)); 595 } 596 597 public void exitEmergencyCallbackMode(int indicationType) { 598 mRil.processIndication(indicationType); 599 600 if (RIL.RILJ_LOGD) mRil.unsljLog(RIL_UNSOL_EXIT_EMERGENCY_CALLBACK_MODE); 601 602 mRil.mExitEmergencyCallbackModeRegistrants.notifyRegistrants(); 603 } 604 605 public void rilConnected(int indicationType) { 606 mRil.processIndication(indicationType); 607 608 if (RIL.RILJ_LOGD) mRil.unsljLog(RIL_UNSOL_RIL_CONNECTED); 609 610 // Initial conditions 611 mRil.setRadioPower(false, null); 612 mRil.setCdmaSubscriptionSource(mRil.mCdmaSubscription, null); 613 mRil.setCellInfoListRate(); 614 // todo: this should not require a version number now. Setting it to latest RIL version for 615 // now. 616 mRil.notifyRegistrantsRilConnectionChanged(15); 617 // When modem crashes, if user turns the screen off before RIL reconnects, screen 618 // state cannot be sent to modem. Resend the display state here so that modem 619 // has the correct state (to stop signal strength reporting, etc). 620 mRil.updateScreenState(true); 621 } 622 623 public void voiceRadioTechChanged(int indicationType, int rat) { 624 mRil.processIndication(indicationType); 625 626 int response[] = new int[1]; 627 response[0] = rat; 628 629 if (RIL.RILJ_LOGD) mRil.unsljLogRet(RIL_UNSOL_VOICE_RADIO_TECH_CHANGED, response); 630 631 mRil.mVoiceRadioTechChangedRegistrants.notifyRegistrants( 632 new AsyncResult (null, response, null)); 633 } 634 635 public void cellInfoList(int indicationType, 636 ArrayList<android.hardware.radio.V1_0.CellInfo> records) { 637 mRil.processIndication(indicationType); 638 639 ArrayList<CellInfo> response = RIL.convertHalCellInfoList(records); 640 641 if (RIL.RILJ_LOGD) mRil.unsljLogRet(RIL_UNSOL_CELL_INFO_LIST, response); 642 643 mRil.mRilCellInfoListRegistrants.notifyRegistrants(new AsyncResult (null, response, null)); 644 } 645 646 public void imsNetworkStateChanged(int indicationType) { 647 mRil.processIndication(indicationType); 648 649 if (RIL.RILJ_LOGD) mRil.unsljLog(RIL_UNSOL_RESPONSE_IMS_NETWORK_STATE_CHANGED); 650 651 mRil.mImsNetworkStateChangedRegistrants.notifyRegistrants(); 652 } 653 654 public void subscriptionStatusChanged(int indicationType, boolean activate) { 655 mRil.processIndication(indicationType); 656 657 int response[] = new int[1]; 658 response[0] = activate ? 1 : 0; 659 660 if (RIL.RILJ_LOGD) mRil.unsljLogRet(RIL_UNSOL_UICC_SUBSCRIPTION_STATUS_CHANGED, response); 661 662 mRil.mSubscriptionStatusRegistrants.notifyRegistrants( 663 new AsyncResult (null, response, null)); 664 } 665 666 public void srvccStateNotify(int indicationType, int state) { 667 mRil.processIndication(indicationType); 668 669 int response[] = new int[1]; 670 response[0] = state; 671 672 if (RIL.RILJ_LOGD) mRil.unsljLogRet(RIL_UNSOL_SRVCC_STATE_NOTIFY, response); 673 674 mRil.writeMetricsSrvcc(state); 675 676 mRil.mSrvccStateRegistrants.notifyRegistrants( 677 new AsyncResult (null, response, null)); 678 } 679 680 public void hardwareConfigChanged( 681 int indicationType, 682 ArrayList<android.hardware.radio.V1_0.HardwareConfig> configs) { 683 mRil.processIndication(indicationType); 684 685 ArrayList<HardwareConfig> response = RIL.convertHalHwConfigList(configs, mRil); 686 687 if (RIL.RILJ_LOGD) mRil.unsljLogRet(RIL_UNSOL_HARDWARE_CONFIG_CHANGED, response); 688 689 mRil.mHardwareConfigChangeRegistrants.notifyRegistrants( 690 new AsyncResult (null, response, null)); 691 } 692 693 public void radioCapabilityIndication(int indicationType, 694 android.hardware.radio.V1_0.RadioCapability rc) { 695 mRil.processIndication(indicationType); 696 697 RadioCapability response = RIL.convertHalRadioCapability(rc, mRil); 698 699 if (RIL.RILJ_LOGD) mRil.unsljLogRet(RIL_UNSOL_RADIO_CAPABILITY, response); 700 701 mRil.mPhoneRadioCapabilityChangedRegistrants.notifyRegistrants( 702 new AsyncResult (null, response, null)); 703 } 704 705 public void onSupplementaryServiceIndication(int indicationType, StkCcUnsolSsResult ss) { 706 mRil.processIndication(indicationType); 707 708 int num; 709 SsData ssData = new SsData(); 710 711 ssData.serviceType = ssData.ServiceTypeFromRILInt(ss.serviceType); 712 ssData.requestType = ssData.RequestTypeFromRILInt(ss.requestType); 713 ssData.teleserviceType = ssData.TeleserviceTypeFromRILInt(ss.teleserviceType); 714 ssData.serviceClass = ss.serviceClass; // This is service class sent in the SS request. 715 ssData.result = ss.result; // This is the result of the SS request. 716 717 if (ssData.serviceType.isTypeCF() && 718 ssData.requestType.isTypeInterrogation()) { 719 CfData cfData = ss.cfData.get(0); 720 num = cfData.cfInfo.size(); 721 ssData.cfInfo = new CallForwardInfo[num]; 722 723 for (int i = 0; i < num; i++) { 724 android.hardware.radio.V1_0.CallForwardInfo cfInfo = cfData.cfInfo.get(i); 725 ssData.cfInfo[i] = new CallForwardInfo(); 726 727 ssData.cfInfo[i].status = cfInfo.status; 728 ssData.cfInfo[i].reason = cfInfo.reason; 729 ssData.cfInfo[i].serviceClass = cfInfo.serviceClass; 730 ssData.cfInfo[i].toa = cfInfo.toa; 731 ssData.cfInfo[i].number = cfInfo.number; 732 ssData.cfInfo[i].timeSeconds = cfInfo.timeSeconds; 733 734 mRil.riljLog("[SS Data] CF Info " + i + " : " + ssData.cfInfo[i]); 735 } 736 } else { 737 SsInfoData ssInfo = ss.ssInfo.get(0); 738 num = ssInfo.ssInfo.size(); 739 ssData.ssInfo = new int[num]; 740 for (int i = 0; i < num; i++) { 741 ssData.ssInfo[i] = ssInfo.ssInfo.get(i); 742 mRil.riljLog("[SS Data] SS Info " + i + " : " + ssData.ssInfo[i]); 743 } 744 } 745 } 746 747 public void stkCallControlAlphaNotify(int indicationType, String alpha) { 748 mRil.processIndication(indicationType); 749 750 if (RIL.RILJ_LOGD) mRil.unsljLogRet(RIL_UNSOL_STK_CC_ALPHA_NOTIFY, alpha); 751 752 if (mRil.mCatCcAlphaRegistrant != null) { 753 mRil.mCatCcAlphaRegistrant.notifyRegistrant(new AsyncResult (null, alpha, null)); 754 } 755 } 756 757 public void lceData(int indicationType, LceDataInfo lce) { 758 mRil.processIndication(indicationType); 759 760 ArrayList<Integer> response = RIL.convertHalLceData(lce, mRil); 761 762 if (RIL.RILJ_LOGD) mRil.unsljLogRet(RIL_UNSOL_LCEDATA_RECV, response); 763 764 if (mRil.mLceInfoRegistrant != null) { 765 mRil.mLceInfoRegistrant.notifyRegistrant(new AsyncResult(null, response, null)); 766 } 767 } 768 769 public void pcoData(int indicationType, PcoDataInfo pco) { 770 mRil.processIndication(indicationType); 771 772 PcoData response = new PcoData(pco.cid, 773 pco.bearerProto, 774 pco.pcoId, 775 RIL.arrayListToPrimitiveArray(pco.contents)); 776 777 if (RIL.RILJ_LOGD) mRil.unsljLogRet(RIL_UNSOL_PCO_DATA, response); 778 779 mRil.mPcoDataRegistrants.notifyRegistrants(new AsyncResult(null, response, null)); 780 } 781 782 public void modemReset(int indicationType, String reason) { 783 mRil.processIndication(indicationType); 784 785 if (RIL.RILJ_LOGD) mRil.unsljLogRet(RIL_UNSOL_MODEM_RESTART, reason); 786 787 mRil.writeMetricsModemRestartEvent(reason); 788 } 789 790 private CommandsInterface.RadioState getRadioStateFromInt(int stateInt) { 791 CommandsInterface.RadioState state; 792 793 switch(stateInt) { 794 case android.hardware.radio.V1_0.RadioState.OFF: 795 state = CommandsInterface.RadioState.RADIO_OFF; 796 break; 797 case android.hardware.radio.V1_0.RadioState.UNAVAILABLE: 798 state = CommandsInterface.RadioState.RADIO_UNAVAILABLE; 799 break; 800 case android.hardware.radio.V1_0.RadioState.ON: 801 state = CommandsInterface.RadioState.RADIO_ON; 802 break; 803 default: 804 throw new RuntimeException("Unrecognized RadioState: " + stateInt); 805 } 806 return state; 807 } 808} 809