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