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