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