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 17 package com.android.internal.telephony; 18 19 import static com.android.internal.telephony.RILConstants.RIL_UNSOL_CALL_RING; 20 import static com.android.internal.telephony.RILConstants.RIL_UNSOL_CARRIER_INFO_IMSI_ENCRYPTION; 21 import static com.android.internal.telephony.RILConstants.RIL_UNSOL_CDMA_CALL_WAITING; 22 import static com.android.internal.telephony.RILConstants.RIL_UNSOL_CDMA_INFO_REC; 23 import static com.android.internal.telephony.RILConstants.RIL_UNSOL_CDMA_OTA_PROVISION_STATUS; 24 import static com.android.internal.telephony.RILConstants.RIL_UNSOL_CDMA_RUIM_SMS_STORAGE_FULL; 25 import static com.android.internal.telephony.RILConstants.RIL_UNSOL_CDMA_SUBSCRIPTION_SOURCE_CHANGED; 26 import static com.android.internal.telephony.RILConstants.RIL_UNSOL_CELL_INFO_LIST; 27 import static com.android.internal.telephony.RILConstants.RIL_UNSOL_DATA_CALL_LIST_CHANGED; 28 import static com.android.internal.telephony.RILConstants.RIL_UNSOL_EMERGENCY_NUMBER_LIST; 29 import static com.android.internal.telephony.RILConstants.RIL_UNSOL_ENTER_EMERGENCY_CALLBACK_MODE; 30 import static com.android.internal.telephony.RILConstants.RIL_UNSOL_EXIT_EMERGENCY_CALLBACK_MODE; 31 import static com.android.internal.telephony.RILConstants.RIL_UNSOL_HARDWARE_CONFIG_CHANGED; 32 import static com.android.internal.telephony.RILConstants.RIL_UNSOL_KEEPALIVE_STATUS; 33 import static com.android.internal.telephony.RILConstants.RIL_UNSOL_LCEDATA_RECV; 34 import static com.android.internal.telephony.RILConstants.RIL_UNSOL_MODEM_RESTART; 35 import static com.android.internal.telephony.RILConstants.RIL_UNSOL_NETWORK_SCAN_RESULT; 36 import static com.android.internal.telephony.RILConstants.RIL_UNSOL_NITZ_TIME_RECEIVED; 37 import static com.android.internal.telephony.RILConstants.RIL_UNSOL_ON_SS; 38 import static com.android.internal.telephony.RILConstants.RIL_UNSOL_ON_USSD; 39 import static com.android.internal.telephony.RILConstants.RIL_UNSOL_PCO_DATA; 40 import static com.android.internal.telephony.RILConstants.RIL_UNSOL_PHYSICAL_CHANNEL_CONFIG; 41 import static com.android.internal.telephony.RILConstants.RIL_UNSOL_RADIO_CAPABILITY; 42 import static com.android.internal.telephony.RILConstants.RIL_UNSOL_RESEND_INCALL_MUTE; 43 import static com.android.internal.telephony.RILConstants.RIL_UNSOL_RESPONSE_CALL_STATE_CHANGED; 44 import static com.android.internal.telephony.RILConstants.RIL_UNSOL_RESPONSE_CDMA_NEW_SMS; 45 import static com.android.internal.telephony.RILConstants.RIL_UNSOL_RESPONSE_IMS_NETWORK_STATE_CHANGED; 46 import static com.android.internal.telephony.RILConstants.RIL_UNSOL_RESPONSE_NETWORK_STATE_CHANGED; 47 import static com.android.internal.telephony.RILConstants.RIL_UNSOL_RESPONSE_NEW_BROADCAST_SMS; 48 import static com.android.internal.telephony.RILConstants.RIL_UNSOL_RESPONSE_NEW_SMS; 49 import static com.android.internal.telephony.RILConstants.RIL_UNSOL_RESPONSE_NEW_SMS_ON_SIM; 50 import static com.android.internal.telephony.RILConstants.RIL_UNSOL_RESPONSE_NEW_SMS_STATUS_REPORT; 51 import static com.android.internal.telephony.RILConstants.RIL_UNSOL_RESPONSE_RADIO_STATE_CHANGED; 52 import static com.android.internal.telephony.RILConstants.RIL_UNSOL_RESPONSE_SIM_STATUS_CHANGED; 53 import static com.android.internal.telephony.RILConstants.RIL_UNSOL_RESTRICTED_STATE_CHANGED; 54 import static com.android.internal.telephony.RILConstants.RIL_UNSOL_RIL_CONNECTED; 55 import static com.android.internal.telephony.RILConstants.RIL_UNSOL_RINGBACK_TONE; 56 import static com.android.internal.telephony.RILConstants.RIL_UNSOL_SIGNAL_STRENGTH; 57 import static com.android.internal.telephony.RILConstants.RIL_UNSOL_SIM_REFRESH; 58 import static com.android.internal.telephony.RILConstants.RIL_UNSOL_SIM_SMS_STORAGE_FULL; 59 import static com.android.internal.telephony.RILConstants.RIL_UNSOL_SRVCC_STATE_NOTIFY; 60 import static com.android.internal.telephony.RILConstants.RIL_UNSOL_STK_CALL_SETUP; 61 import static com.android.internal.telephony.RILConstants.RIL_UNSOL_STK_CC_ALPHA_NOTIFY; 62 import static com.android.internal.telephony.RILConstants.RIL_UNSOL_STK_EVENT_NOTIFY; 63 import static com.android.internal.telephony.RILConstants.RIL_UNSOL_STK_PROACTIVE_COMMAND; 64 import static com.android.internal.telephony.RILConstants.RIL_UNSOL_STK_SESSION_END; 65 import static com.android.internal.telephony.RILConstants.RIL_UNSOL_SUPP_SVC_NOTIFICATION; 66 import static com.android.internal.telephony.RILConstants.RIL_UNSOL_UICC_APPLICATIONS_ENABLEMENT_CHANGED; 67 import static com.android.internal.telephony.RILConstants.RIL_UNSOL_UICC_SUBSCRIPTION_STATUS_CHANGED; 68 import static com.android.internal.telephony.RILConstants.RIL_UNSOL_VOICE_RADIO_TECH_CHANGED; 69 import static com.android.internal.telephony.RILConstants.RIL_UNSOl_CDMA_PRL_CHANGED; 70 71 import android.hardware.radio.V1_0.CdmaCallWaiting; 72 import android.hardware.radio.V1_0.CdmaInformationRecord; 73 import android.hardware.radio.V1_0.CdmaLineControlInfoRecord; 74 import android.hardware.radio.V1_0.CdmaNumberInfoRecord; 75 import android.hardware.radio.V1_0.CdmaRedirectingNumberInfoRecord; 76 import android.hardware.radio.V1_0.CdmaSignalInfoRecord; 77 import android.hardware.radio.V1_0.CdmaSmsMessage; 78 import android.hardware.radio.V1_0.CdmaT53AudioControlInfoRecord; 79 import android.hardware.radio.V1_0.CfData; 80 import android.hardware.radio.V1_0.LceDataInfo; 81 import android.hardware.radio.V1_0.PcoDataInfo; 82 import android.hardware.radio.V1_0.SimRefreshResult; 83 import android.hardware.radio.V1_0.SsInfoData; 84 import android.hardware.radio.V1_0.StkCcUnsolSsResult; 85 import android.hardware.radio.V1_0.SuppSvcNotification; 86 import android.hardware.radio.V1_2.CellConnectionStatus; 87 import android.hardware.radio.V1_5.IRadioIndication; 88 import android.os.AsyncResult; 89 import android.sysprop.TelephonyProperties; 90 import android.telephony.Annotation.RadioPowerState; 91 import android.telephony.AnomalyReporter; 92 import android.telephony.BarringInfo; 93 import android.telephony.CellIdentity; 94 import android.telephony.CellInfo; 95 import android.telephony.NetworkRegistrationInfo; 96 import android.telephony.PcoData; 97 import android.telephony.PhysicalChannelConfig; 98 import android.telephony.ServiceState; 99 import android.telephony.SignalStrength; 100 import android.telephony.SmsMessage; 101 import android.telephony.TelephonyManager; 102 import android.telephony.data.DataCallResponse; 103 import android.telephony.emergency.EmergencyNumber; 104 import android.text.TextUtils; 105 106 import com.android.internal.telephony.cdma.CdmaCallWaitingNotification; 107 import com.android.internal.telephony.cdma.CdmaInformationRecords; 108 import com.android.internal.telephony.cdma.SmsMessageConverter; 109 import com.android.internal.telephony.dataconnection.KeepaliveStatus; 110 import com.android.internal.telephony.gsm.SsData; 111 import com.android.internal.telephony.gsm.SuppServiceNotification; 112 import com.android.internal.telephony.uicc.IccRefreshResponse; 113 import com.android.internal.telephony.uicc.IccUtils; 114 115 import java.util.ArrayList; 116 import java.util.List; 117 import java.util.UUID; 118 119 public class RadioIndication extends IRadioIndication.Stub { 120 RIL mRil; 121 RadioIndication(RIL ril)122 RadioIndication(RIL ril) { 123 mRil = ril; 124 } 125 126 /** 127 * Indicates when radio state changes. 128 * @param indicationType RadioIndicationType 129 * @param radioState android.hardware.radio.V1_0.RadioState 130 */ radioStateChanged(int indicationType, int radioState)131 public void radioStateChanged(int indicationType, int radioState) { 132 mRil.processIndication(indicationType); 133 134 int state = getRadioStateFromInt(radioState); 135 if (RIL.RILJ_LOGD) { 136 mRil.unsljLogMore(RIL_UNSOL_RESPONSE_RADIO_STATE_CHANGED, "radioStateChanged: " + 137 state); 138 } 139 140 mRil.setRadioState(state, false /* forceNotifyRegistrants */); 141 } 142 callStateChanged(int indicationType)143 public void callStateChanged(int indicationType) { 144 mRil.processIndication(indicationType); 145 146 if (RIL.RILJ_LOGD) mRil.unsljLog(RIL_UNSOL_RESPONSE_CALL_STATE_CHANGED); 147 148 mRil.mCallStateRegistrants.notifyRegistrants(); 149 } 150 151 /** 152 * Indicates when either voice or data network state changed 153 * @param indicationType RadioIndicationType 154 */ networkStateChanged(int indicationType)155 public void networkStateChanged(int indicationType) { 156 mRil.processIndication(indicationType); 157 158 if (RIL.RILJ_LOGD) mRil.unsljLog(RIL_UNSOL_RESPONSE_NETWORK_STATE_CHANGED); 159 160 mRil.mNetworkStateRegistrants.notifyRegistrants(); 161 } 162 newSms(int indicationType, ArrayList<Byte> pdu)163 public void newSms(int indicationType, ArrayList<Byte> pdu) { 164 mRil.processIndication(indicationType); 165 166 byte[] pduArray = RIL.arrayListToPrimitiveArray(pdu); 167 if (RIL.RILJ_LOGD) mRil.unsljLog(RIL_UNSOL_RESPONSE_NEW_SMS); 168 169 SmsMessageBase smsb = com.android.internal.telephony.gsm.SmsMessage.createFromPdu(pduArray); 170 if (mRil.mGsmSmsRegistrant != null) { 171 mRil.mGsmSmsRegistrant.notifyRegistrant( 172 new AsyncResult(null, smsb == null ? null : new SmsMessage(smsb), null)); 173 } 174 } 175 newSmsStatusReport(int indicationType, ArrayList<Byte> pdu)176 public void newSmsStatusReport(int indicationType, ArrayList<Byte> pdu) { 177 mRil.processIndication(indicationType); 178 179 byte[] pduArray = RIL.arrayListToPrimitiveArray(pdu); 180 if (RIL.RILJ_LOGD) mRil.unsljLog(RIL_UNSOL_RESPONSE_NEW_SMS_STATUS_REPORT); 181 182 if (mRil.mSmsStatusRegistrant != null) { 183 mRil.mSmsStatusRegistrant.notifyRegistrant(new AsyncResult(null, pduArray, null)); 184 } 185 } 186 newSmsOnSim(int indicationType, int recordNumber)187 public void newSmsOnSim(int indicationType, int recordNumber) { 188 mRil.processIndication(indicationType); 189 190 if (RIL.RILJ_LOGD) mRil.unsljLog(RIL_UNSOL_RESPONSE_NEW_SMS_ON_SIM); 191 192 if (mRil.mSmsOnSimRegistrant != null) { 193 mRil.mSmsOnSimRegistrant.notifyRegistrant(new AsyncResult(null, recordNumber, null)); 194 } 195 } 196 onUssd(int indicationType, int ussdModeType, String msg)197 public void onUssd(int indicationType, int ussdModeType, String msg) { 198 mRil.processIndication(indicationType); 199 200 if (RIL.RILJ_LOGD) mRil.unsljLogMore(RIL_UNSOL_ON_USSD, "" + ussdModeType); 201 202 // todo: Clean this up with a parcelable class for better self-documentation 203 String[] resp = new String[2]; 204 resp[0] = "" + ussdModeType; 205 resp[1] = msg; 206 if (mRil.mUSSDRegistrant != null) { 207 mRil.mUSSDRegistrant.notifyRegistrant(new AsyncResult (null, resp, null)); 208 } 209 } 210 nitzTimeReceived(int indicationType, String nitzTime, long receivedTime)211 public void nitzTimeReceived(int indicationType, String nitzTime, long receivedTime) { 212 mRil.processIndication(indicationType); 213 214 if (RIL.RILJ_LOGD) mRil.unsljLogRet(RIL_UNSOL_NITZ_TIME_RECEIVED, nitzTime); 215 216 // todo: Clean this up with a parcelable class for better self-documentation 217 Object[] result = new Object[2]; 218 result[0] = nitzTime; 219 result[1] = receivedTime; 220 221 boolean ignoreNitz = TelephonyProperties.ignore_nitz().orElse(false); 222 223 if (ignoreNitz) { 224 if (RIL.RILJ_LOGD) mRil.riljLog("ignoring UNSOL_NITZ_TIME_RECEIVED"); 225 } else { 226 if (mRil.mNITZTimeRegistrant != null) { 227 mRil.mNITZTimeRegistrant.notifyRegistrant(new AsyncResult (null, result, null)); 228 } 229 // in case NITZ time registrant isn't registered yet, or a new registrant 230 // registers later 231 mRil.mLastNITZTimeInfo = result; 232 } 233 } 234 currentSignalStrength(int indicationType, android.hardware.radio.V1_0.SignalStrength signalStrength)235 public void currentSignalStrength(int indicationType, 236 android.hardware.radio.V1_0.SignalStrength signalStrength) { 237 mRil.processIndication(indicationType); 238 239 SignalStrength ssInitial = new SignalStrength(signalStrength); 240 241 SignalStrength ss = mRil.fixupSignalStrength10(ssInitial); 242 // Note this is set to "verbose" because it happens frequently 243 if (RIL.RILJ_LOGV) mRil.unsljLogvRet(RIL_UNSOL_SIGNAL_STRENGTH, ss); 244 245 if (mRil.mSignalStrengthRegistrant != null) { 246 mRil.mSignalStrengthRegistrant.notifyRegistrant(new AsyncResult (null, ss, null)); 247 } 248 } 249 250 /** 251 * Indicates current link capacity estimate. 252 */ currentLinkCapacityEstimate(int indicationType, android.hardware.radio.V1_2.LinkCapacityEstimate lce)253 public void currentLinkCapacityEstimate(int indicationType, 254 android.hardware.radio.V1_2.LinkCapacityEstimate lce) { 255 mRil.processIndication(indicationType); 256 257 LinkCapacityEstimate response = RIL.convertHalLceData(lce, mRil); 258 259 if (RIL.RILJ_LOGD) mRil.unsljLogRet(RIL_UNSOL_LCEDATA_RECV, response); 260 261 if (mRil.mLceInfoRegistrants != null) { 262 mRil.mLceInfoRegistrants.notifyRegistrants(new AsyncResult(null, response, null)); 263 } 264 } 265 266 /** 267 * Indicates the current signal strength of the camped or primary serving cell. 268 */ currentSignalStrength_1_2(int indicationType, android.hardware.radio.V1_2.SignalStrength signalStrength)269 public void currentSignalStrength_1_2(int indicationType, 270 android.hardware.radio.V1_2.SignalStrength signalStrength) { 271 mRil.processIndication(indicationType); 272 273 SignalStrength ss = new SignalStrength(signalStrength); 274 // Note this is set to "verbose" because it happens frequently 275 if (RIL.RILJ_LOGV) mRil.unsljLogvRet(RIL_UNSOL_SIGNAL_STRENGTH, ss); 276 277 if (mRil.mSignalStrengthRegistrant != null) { 278 mRil.mSignalStrengthRegistrant.notifyRegistrant(new AsyncResult(null, ss, null)); 279 } 280 } 281 282 /** 283 * Indicates the current signal strength of the camped or primary serving cell. 284 */ currentSignalStrength_1_4(int indicationType, android.hardware.radio.V1_4.SignalStrength signalStrength)285 public void currentSignalStrength_1_4(int indicationType, 286 android.hardware.radio.V1_4.SignalStrength signalStrength) { 287 288 mRil.processIndication(indicationType); 289 290 SignalStrength ss = new SignalStrength(signalStrength); 291 292 if (RIL.RILJ_LOGV) mRil.unsljLogvRet(RIL_UNSOL_SIGNAL_STRENGTH, ss); 293 294 if (mRil.mSignalStrengthRegistrant != null) { 295 mRil.mSignalStrengthRegistrant.notifyRegistrant(new AsyncResult(null, ss, null)); 296 } 297 } 298 299 /** 300 * Indicates current physical channel configuration. 301 */ currentPhysicalChannelConfigs_1_4(int indicationType, ArrayList<android.hardware.radio.V1_4.PhysicalChannelConfig> configs)302 public void currentPhysicalChannelConfigs_1_4(int indicationType, 303 ArrayList<android.hardware.radio.V1_4.PhysicalChannelConfig> configs) { 304 mRil.processIndication(indicationType); 305 physicalChannelConfigsIndication(configs); 306 } 307 308 /** 309 * Indicates current physical channel configuration. 310 */ currentPhysicalChannelConfigs(int indicationType, ArrayList<android.hardware.radio.V1_2.PhysicalChannelConfig> configs)311 public void currentPhysicalChannelConfigs(int indicationType, 312 ArrayList<android.hardware.radio.V1_2.PhysicalChannelConfig> configs) { 313 mRil.processIndication(indicationType); 314 physicalChannelConfigsIndication(configs); 315 } 316 317 /** 318 * Indicates current emergency number list. 319 */ currentEmergencyNumberList(int indicationType, ArrayList<android.hardware.radio.V1_4.EmergencyNumber> emergencyNumberList)320 public void currentEmergencyNumberList(int indicationType, 321 ArrayList<android.hardware.radio.V1_4.EmergencyNumber> emergencyNumberList) { 322 List<EmergencyNumber> response = new ArrayList<>(emergencyNumberList.size()); 323 324 for (android.hardware.radio.V1_4.EmergencyNumber emergencyNumberHal 325 : emergencyNumberList) { 326 EmergencyNumber emergencyNumber = new EmergencyNumber(emergencyNumberHal.number, 327 MccTable.countryCodeForMcc(emergencyNumberHal.mcc), emergencyNumberHal.mnc, 328 emergencyNumberHal.categories, emergencyNumberHal.urns, 329 emergencyNumberHal.sources, EmergencyNumber.EMERGENCY_CALL_ROUTING_UNKNOWN); 330 response.add(emergencyNumber); 331 } 332 333 if (RIL.RILJ_LOGD) mRil.unsljLogRet(RIL_UNSOL_EMERGENCY_NUMBER_LIST, response); 334 335 // Cache emergency number list from last indication. 336 mRil.cacheEmergencyNumberListIndication(response); 337 338 // Notify emergency number list from radio to registrants 339 mRil.mEmergencyNumberListRegistrants.notifyRegistrants( 340 new AsyncResult(null, response, null)); 341 } 342 343 /** Indicates current data call list. */ dataCallListChanged(int indicationType, ArrayList<android.hardware.radio.V1_0.SetupDataCallResult> dcList)344 public void dataCallListChanged(int indicationType, 345 ArrayList<android.hardware.radio.V1_0.SetupDataCallResult> dcList) { 346 responseDataCallListChanged(indicationType, dcList); 347 } 348 349 /** Indicates current data call list with radio HAL 1.4. */ dataCallListChanged_1_4(int indicationType, ArrayList<android.hardware.radio.V1_4.SetupDataCallResult> dcList)350 public void dataCallListChanged_1_4(int indicationType, 351 ArrayList<android.hardware.radio.V1_4.SetupDataCallResult> dcList) { 352 responseDataCallListChanged(indicationType, dcList); 353 354 } 355 356 /** Indicates current data call list with radio HAL 1.5. */ dataCallListChanged_1_5(int indicationType, ArrayList<android.hardware.radio.V1_5.SetupDataCallResult> dcList)357 public void dataCallListChanged_1_5(int indicationType, 358 ArrayList<android.hardware.radio.V1_5.SetupDataCallResult> dcList) { 359 responseDataCallListChanged(indicationType, dcList); 360 } 361 suppSvcNotify(int indicationType, SuppSvcNotification suppSvcNotification)362 public void suppSvcNotify(int indicationType, SuppSvcNotification suppSvcNotification) { 363 mRil.processIndication(indicationType); 364 365 SuppServiceNotification notification = new SuppServiceNotification(); 366 notification.notificationType = suppSvcNotification.isMT ? 1 : 0; 367 notification.code = suppSvcNotification.code; 368 notification.index = suppSvcNotification.index; 369 notification.type = suppSvcNotification.type; 370 notification.number = suppSvcNotification.number; 371 372 if (RIL.RILJ_LOGD) mRil.unsljLogRet(RIL_UNSOL_SUPP_SVC_NOTIFICATION, notification); 373 374 if (mRil.mSsnRegistrant != null) { 375 mRil.mSsnRegistrant.notifyRegistrant(new AsyncResult (null, notification, null)); 376 } 377 } 378 stkSessionEnd(int indicationType)379 public void stkSessionEnd(int indicationType) { 380 mRil.processIndication(indicationType); 381 382 if (RIL.RILJ_LOGD) mRil.unsljLog(RIL_UNSOL_STK_SESSION_END); 383 384 if (mRil.mCatSessionEndRegistrant != null) { 385 mRil.mCatSessionEndRegistrant.notifyRegistrant(new AsyncResult (null, null, null)); 386 } 387 } 388 stkProactiveCommand(int indicationType, String cmd)389 public void stkProactiveCommand(int indicationType, String cmd) { 390 mRil.processIndication(indicationType); 391 392 if (RIL.RILJ_LOGD) mRil.unsljLog(RIL_UNSOL_STK_PROACTIVE_COMMAND); 393 394 if (mRil.mCatProCmdRegistrant != null) { 395 mRil.mCatProCmdRegistrant.notifyRegistrant(new AsyncResult (null, cmd, null)); 396 } 397 } 398 stkEventNotify(int indicationType, String cmd)399 public void stkEventNotify(int indicationType, String cmd) { 400 mRil.processIndication(indicationType); 401 402 if (RIL.RILJ_LOGD) mRil.unsljLog(RIL_UNSOL_STK_EVENT_NOTIFY); 403 404 if (mRil.mCatEventRegistrant != null) { 405 mRil.mCatEventRegistrant.notifyRegistrant(new AsyncResult (null, cmd, null)); 406 } 407 } 408 stkCallSetup(int indicationType, long timeout)409 public void stkCallSetup(int indicationType, long timeout) { 410 mRil.processIndication(indicationType); 411 412 if (RIL.RILJ_LOGD) mRil.unsljLogRet(RIL_UNSOL_STK_CALL_SETUP, timeout); 413 414 if (mRil.mCatCallSetUpRegistrant != null) { 415 mRil.mCatCallSetUpRegistrant.notifyRegistrant(new AsyncResult (null, timeout, null)); 416 } 417 } 418 simSmsStorageFull(int indicationType)419 public void simSmsStorageFull(int indicationType) { 420 mRil.processIndication(indicationType); 421 422 if (RIL.RILJ_LOGD) mRil.unsljLog(RIL_UNSOL_SIM_SMS_STORAGE_FULL); 423 424 if (mRil.mIccSmsFullRegistrant != null) { 425 mRil.mIccSmsFullRegistrant.notifyRegistrant(); 426 } 427 } 428 simRefresh(int indicationType, SimRefreshResult refreshResult)429 public void simRefresh(int indicationType, SimRefreshResult refreshResult) { 430 mRil.processIndication(indicationType); 431 432 IccRefreshResponse response = new IccRefreshResponse(); 433 response.refreshResult = refreshResult.type; 434 response.efId = refreshResult.efId; 435 response.aid = refreshResult.aid; 436 437 if (RIL.RILJ_LOGD) mRil.unsljLogRet(RIL_UNSOL_SIM_REFRESH, response); 438 439 mRil.mIccRefreshRegistrants.notifyRegistrants(new AsyncResult (null, response, null)); 440 } 441 callRing(int indicationType, boolean isGsm, CdmaSignalInfoRecord record)442 public void callRing(int indicationType, boolean isGsm, CdmaSignalInfoRecord record) { 443 mRil.processIndication(indicationType); 444 445 char response[] = null; 446 447 // Ignore record for gsm 448 if (!isGsm) { 449 // todo: Clean this up with a parcelable class for better self-documentation 450 response = new char[4]; 451 response[0] = (char) (record.isPresent ? 1 : 0); 452 response[1] = (char) record.signalType; 453 response[2] = (char) record.alertPitch; 454 response[3] = (char) record.signal; 455 mRil.writeMetricsCallRing(response); 456 } 457 458 if (RIL.RILJ_LOGD) mRil.unsljLogRet(RIL_UNSOL_CALL_RING, response); 459 460 if (mRil.mRingRegistrant != null) { 461 mRil.mRingRegistrant.notifyRegistrant(new AsyncResult (null, response, null)); 462 } 463 } 464 simStatusChanged(int indicationType)465 public void simStatusChanged(int indicationType) { 466 mRil.processIndication(indicationType); 467 468 if (RIL.RILJ_LOGD) mRil.unsljLog(RIL_UNSOL_RESPONSE_SIM_STATUS_CHANGED); 469 470 mRil.mIccStatusChangedRegistrants.notifyRegistrants(); 471 } 472 cdmaNewSms(int indicationType, CdmaSmsMessage msg)473 public void cdmaNewSms(int indicationType, CdmaSmsMessage msg) { 474 mRil.processIndication(indicationType); 475 476 if (RIL.RILJ_LOGD) mRil.unsljLog(RIL_UNSOL_RESPONSE_CDMA_NEW_SMS); 477 478 // todo: conversion from CdmaSmsMessage to SmsMessage should be contained in this class so 479 // that usage of auto-generated HAL classes is limited to this file 480 SmsMessage sms = SmsMessageConverter.newSmsMessageFromCdmaSmsMessage(msg); 481 if (mRil.mCdmaSmsRegistrant != null) { 482 mRil.mCdmaSmsRegistrant.notifyRegistrant(new AsyncResult(null, sms, null)); 483 } 484 } 485 newBroadcastSms(int indicationType, ArrayList<Byte> data)486 public void newBroadcastSms(int indicationType, ArrayList<Byte> data) { 487 mRil.processIndication(indicationType); 488 489 byte response[] = RIL.arrayListToPrimitiveArray(data); 490 if (RIL.RILJ_LOGD) { 491 mRil.unsljLogvRet(RIL_UNSOL_RESPONSE_NEW_BROADCAST_SMS, 492 IccUtils.bytesToHexString(response)); 493 } 494 495 if (mRil.mGsmBroadcastSmsRegistrant != null) { 496 mRil.mGsmBroadcastSmsRegistrant.notifyRegistrant(new AsyncResult(null, response, null)); 497 } 498 } 499 cdmaRuimSmsStorageFull(int indicationType)500 public void cdmaRuimSmsStorageFull(int indicationType) { 501 mRil.processIndication(indicationType); 502 503 if (RIL.RILJ_LOGD) mRil.unsljLog(RIL_UNSOL_CDMA_RUIM_SMS_STORAGE_FULL); 504 505 if (mRil.mIccSmsFullRegistrant != null) { 506 mRil.mIccSmsFullRegistrant.notifyRegistrant(); 507 } 508 } 509 restrictedStateChanged(int indicationType, int state)510 public void restrictedStateChanged(int indicationType, int state) { 511 mRil.processIndication(indicationType); 512 513 if (RIL.RILJ_LOGD) mRil.unsljLogvRet(RIL_UNSOL_RESTRICTED_STATE_CHANGED, state); 514 515 if (mRil.mRestrictedStateRegistrant != null) { 516 mRil.mRestrictedStateRegistrant.notifyRegistrant(new AsyncResult (null, state, null)); 517 } 518 } 519 enterEmergencyCallbackMode(int indicationType)520 public void enterEmergencyCallbackMode(int indicationType) { 521 mRil.processIndication(indicationType); 522 523 if (RIL.RILJ_LOGD) mRil.unsljLog(RIL_UNSOL_ENTER_EMERGENCY_CALLBACK_MODE); 524 525 if (mRil.mEmergencyCallbackModeRegistrant != null) { 526 mRil.mEmergencyCallbackModeRegistrant.notifyRegistrant(); 527 } 528 } 529 cdmaCallWaiting(int indicationType, CdmaCallWaiting callWaitingRecord)530 public void cdmaCallWaiting(int indicationType, CdmaCallWaiting callWaitingRecord) { 531 mRil.processIndication(indicationType); 532 533 // todo: create a CdmaCallWaitingNotification constructor that takes in these fields to make 534 // sure no fields are missing 535 CdmaCallWaitingNotification notification = new CdmaCallWaitingNotification(); 536 notification.number = callWaitingRecord.number; 537 notification.numberPresentation = CdmaCallWaitingNotification.presentationFromCLIP( 538 callWaitingRecord.numberPresentation); 539 notification.name = callWaitingRecord.name; 540 notification.namePresentation = notification.numberPresentation; 541 notification.isPresent = callWaitingRecord.signalInfoRecord.isPresent ? 1 : 0; 542 notification.signalType = callWaitingRecord.signalInfoRecord.signalType; 543 notification.alertPitch = callWaitingRecord.signalInfoRecord.alertPitch; 544 notification.signal = callWaitingRecord.signalInfoRecord.signal; 545 notification.numberType = callWaitingRecord.numberType; 546 notification.numberPlan = callWaitingRecord.numberPlan; 547 548 if (RIL.RILJ_LOGD) mRil.unsljLogRet(RIL_UNSOL_CDMA_CALL_WAITING, notification); 549 550 mRil.mCallWaitingInfoRegistrants.notifyRegistrants( 551 new AsyncResult (null, notification, null)); 552 } 553 cdmaOtaProvisionStatus(int indicationType, int status)554 public void cdmaOtaProvisionStatus(int indicationType, int status) { 555 mRil.processIndication(indicationType); 556 557 int response[] = new int[1]; 558 response[0] = status; 559 560 if (RIL.RILJ_LOGD) mRil.unsljLogRet(RIL_UNSOL_CDMA_OTA_PROVISION_STATUS, response); 561 562 mRil.mOtaProvisionRegistrants.notifyRegistrants(new AsyncResult (null, response, null)); 563 } 564 cdmaInfoRec(int indicationType, android.hardware.radio.V1_0.CdmaInformationRecords records)565 public void cdmaInfoRec(int indicationType, 566 android.hardware.radio.V1_0.CdmaInformationRecords records) { 567 mRil.processIndication(indicationType); 568 569 int numberOfInfoRecs = records.infoRec.size(); 570 for (int i = 0; i < numberOfInfoRecs; i++) { 571 CdmaInformationRecord record = records.infoRec.get(i); 572 int id = record.name; 573 CdmaInformationRecords cdmaInformationRecords; 574 switch (id) { 575 case CdmaInformationRecords.RIL_CDMA_DISPLAY_INFO_REC: 576 case CdmaInformationRecords.RIL_CDMA_EXTENDED_DISPLAY_INFO_REC: 577 CdmaInformationRecords.CdmaDisplayInfoRec cdmaDisplayInfoRec = 578 new CdmaInformationRecords.CdmaDisplayInfoRec(id, 579 record.display.get(0).alphaBuf); 580 cdmaInformationRecords = new CdmaInformationRecords(cdmaDisplayInfoRec); 581 break; 582 583 case CdmaInformationRecords.RIL_CDMA_CALLED_PARTY_NUMBER_INFO_REC: 584 case CdmaInformationRecords.RIL_CDMA_CALLING_PARTY_NUMBER_INFO_REC: 585 case CdmaInformationRecords.RIL_CDMA_CONNECTED_NUMBER_INFO_REC: 586 CdmaNumberInfoRecord numInfoRecord = record.number.get(0); 587 CdmaInformationRecords.CdmaNumberInfoRec cdmaNumberInfoRec = 588 new CdmaInformationRecords.CdmaNumberInfoRec(id, 589 numInfoRecord.number, 590 numInfoRecord.numberType, 591 numInfoRecord.numberPlan, 592 numInfoRecord.pi, 593 numInfoRecord.si); 594 cdmaInformationRecords = new CdmaInformationRecords(cdmaNumberInfoRec); 595 break; 596 597 case CdmaInformationRecords.RIL_CDMA_SIGNAL_INFO_REC: 598 CdmaSignalInfoRecord signalInfoRecord = record.signal.get(0); 599 CdmaInformationRecords.CdmaSignalInfoRec cdmaSignalInfoRec = 600 new CdmaInformationRecords.CdmaSignalInfoRec( 601 signalInfoRecord.isPresent ? 1 : 0, 602 signalInfoRecord.signalType, 603 signalInfoRecord.alertPitch, 604 signalInfoRecord.signal); 605 cdmaInformationRecords = new CdmaInformationRecords(cdmaSignalInfoRec); 606 break; 607 608 case CdmaInformationRecords.RIL_CDMA_REDIRECTING_NUMBER_INFO_REC: 609 CdmaRedirectingNumberInfoRecord redirectingNumberInfoRecord = 610 record.redir.get(0); 611 CdmaInformationRecords.CdmaRedirectingNumberInfoRec 612 cdmaRedirectingNumberInfoRec = 613 new CdmaInformationRecords.CdmaRedirectingNumberInfoRec( 614 redirectingNumberInfoRecord.redirectingNumber.number, 615 redirectingNumberInfoRecord.redirectingNumber.numberType, 616 redirectingNumberInfoRecord.redirectingNumber.numberPlan, 617 redirectingNumberInfoRecord.redirectingNumber.pi, 618 redirectingNumberInfoRecord.redirectingNumber.si, 619 redirectingNumberInfoRecord.redirectingReason); 620 cdmaInformationRecords = new CdmaInformationRecords( 621 cdmaRedirectingNumberInfoRec); 622 break; 623 624 case CdmaInformationRecords.RIL_CDMA_LINE_CONTROL_INFO_REC: 625 CdmaLineControlInfoRecord lineControlInfoRecord = record.lineCtrl.get(0); 626 CdmaInformationRecords.CdmaLineControlInfoRec cdmaLineControlInfoRec = 627 new CdmaInformationRecords.CdmaLineControlInfoRec( 628 lineControlInfoRecord.lineCtrlPolarityIncluded, 629 lineControlInfoRecord.lineCtrlToggle, 630 lineControlInfoRecord.lineCtrlReverse, 631 lineControlInfoRecord.lineCtrlPowerDenial); 632 cdmaInformationRecords = new CdmaInformationRecords(cdmaLineControlInfoRec); 633 break; 634 635 case CdmaInformationRecords.RIL_CDMA_T53_CLIR_INFO_REC: 636 CdmaInformationRecords.CdmaT53ClirInfoRec cdmaT53ClirInfoRec = 637 new CdmaInformationRecords.CdmaT53ClirInfoRec(record.clir.get(0).cause); 638 cdmaInformationRecords = new CdmaInformationRecords(cdmaT53ClirInfoRec); 639 break; 640 641 case CdmaInformationRecords.RIL_CDMA_T53_AUDIO_CONTROL_INFO_REC: 642 CdmaT53AudioControlInfoRecord audioControlInfoRecord = record.audioCtrl.get(0); 643 CdmaInformationRecords.CdmaT53AudioControlInfoRec cdmaT53AudioControlInfoRec = 644 new CdmaInformationRecords.CdmaT53AudioControlInfoRec( 645 audioControlInfoRecord.upLink, 646 audioControlInfoRecord.downLink); 647 cdmaInformationRecords = new CdmaInformationRecords(cdmaT53AudioControlInfoRec); 648 break; 649 650 default: 651 throw new RuntimeException("RIL_UNSOL_CDMA_INFO_REC: unsupported record. Got " 652 + CdmaInformationRecords.idToString(id) + " "); 653 } 654 655 if (RIL.RILJ_LOGD) mRil.unsljLogRet(RIL_UNSOL_CDMA_INFO_REC, cdmaInformationRecords); 656 mRil.notifyRegistrantsCdmaInfoRec(cdmaInformationRecords); 657 } 658 } 659 indicateRingbackTone(int indicationType, boolean start)660 public void indicateRingbackTone(int indicationType, boolean start) { 661 mRil.processIndication(indicationType); 662 663 if (RIL.RILJ_LOGD) mRil.unsljLogvRet(RIL_UNSOL_RINGBACK_TONE, start); 664 665 mRil.mRingbackToneRegistrants.notifyRegistrants(new AsyncResult(null, start, null)); 666 } 667 resendIncallMute(int indicationType)668 public void resendIncallMute(int indicationType) { 669 mRil.processIndication(indicationType); 670 671 if (RIL.RILJ_LOGD) mRil.unsljLog(RIL_UNSOL_RESEND_INCALL_MUTE); 672 673 mRil.mResendIncallMuteRegistrants.notifyRegistrants(); 674 } 675 cdmaSubscriptionSourceChanged(int indicationType, int cdmaSource)676 public void cdmaSubscriptionSourceChanged(int indicationType, int cdmaSource) { 677 mRil.processIndication(indicationType); 678 679 int response[] = new int[1]; 680 response[0] = cdmaSource; 681 682 if (RIL.RILJ_LOGD) mRil.unsljLogRet(RIL_UNSOL_CDMA_SUBSCRIPTION_SOURCE_CHANGED, response); 683 684 mRil.mCdmaSubscriptionChangedRegistrants.notifyRegistrants( 685 new AsyncResult (null, response, null)); 686 } 687 cdmaPrlChanged(int indicationType, int version)688 public void cdmaPrlChanged(int indicationType, int version) { 689 mRil.processIndication(indicationType); 690 691 int response[] = new int[1]; 692 response[0] = version; 693 694 if (RIL.RILJ_LOGD) mRil.unsljLogRet(RIL_UNSOl_CDMA_PRL_CHANGED, response); 695 696 mRil.mCdmaPrlChangedRegistrants.notifyRegistrants( 697 new AsyncResult (null, response, null)); 698 } 699 exitEmergencyCallbackMode(int indicationType)700 public void exitEmergencyCallbackMode(int indicationType) { 701 mRil.processIndication(indicationType); 702 703 if (RIL.RILJ_LOGD) mRil.unsljLog(RIL_UNSOL_EXIT_EMERGENCY_CALLBACK_MODE); 704 705 mRil.mExitEmergencyCallbackModeRegistrants.notifyRegistrants(); 706 } 707 rilConnected(int indicationType)708 public void rilConnected(int indicationType) { 709 mRil.processIndication(indicationType); 710 711 if (RIL.RILJ_LOGD) mRil.unsljLog(RIL_UNSOL_RIL_CONNECTED); 712 713 // Initial conditions 714 mRil.setRadioPower(false, null); 715 mRil.setCdmaSubscriptionSource(mRil.mCdmaSubscription, null); 716 // todo: this should not require a version number now. Setting it to latest RIL version for 717 // now. 718 mRil.notifyRegistrantsRilConnectionChanged(15); 719 } 720 voiceRadioTechChanged(int indicationType, int rat)721 public void voiceRadioTechChanged(int indicationType, int rat) { 722 mRil.processIndication(indicationType); 723 724 int response[] = new int[1]; 725 response[0] = rat; 726 727 if (RIL.RILJ_LOGD) mRil.unsljLogRet(RIL_UNSOL_VOICE_RADIO_TECH_CHANGED, response); 728 729 mRil.mVoiceRadioTechChangedRegistrants.notifyRegistrants( 730 new AsyncResult (null, response, null)); 731 } 732 733 /** Get unsolicited message for cellInfoList */ cellInfoList(int indicationType, ArrayList<android.hardware.radio.V1_0.CellInfo> records)734 public void cellInfoList(int indicationType, 735 ArrayList<android.hardware.radio.V1_0.CellInfo> records) { 736 mRil.processIndication(indicationType); 737 738 ArrayList<CellInfo> response = RIL.convertHalCellInfoList(records); 739 740 if (RIL.RILJ_LOGD) mRil.unsljLogRet(RIL_UNSOL_CELL_INFO_LIST, response); 741 742 mRil.mRilCellInfoListRegistrants.notifyRegistrants(new AsyncResult(null, response, null)); 743 } 744 745 /** Get unsolicited message for cellInfoList using HAL V1_2 */ cellInfoList_1_2(int indicationType, ArrayList<android.hardware.radio.V1_2.CellInfo> records)746 public void cellInfoList_1_2(int indicationType, 747 ArrayList<android.hardware.radio.V1_2.CellInfo> records) { 748 mRil.processIndication(indicationType); 749 750 ArrayList<CellInfo> response = RIL.convertHalCellInfoList_1_2(records); 751 752 if (RIL.RILJ_LOGD) mRil.unsljLogRet(RIL_UNSOL_CELL_INFO_LIST, response); 753 754 mRil.mRilCellInfoListRegistrants.notifyRegistrants(new AsyncResult(null, response, null)); 755 } 756 757 /** Get unsolicited message for cellInfoList using HAL V1_4 */ cellInfoList_1_4(int indicationType, ArrayList<android.hardware.radio.V1_4.CellInfo> records)758 public void cellInfoList_1_4(int indicationType, 759 ArrayList<android.hardware.radio.V1_4.CellInfo> records) { 760 mRil.processIndication(indicationType); 761 762 ArrayList<CellInfo> response = RIL.convertHalCellInfoList_1_4(records); 763 764 if (RIL.RILJ_LOGD) mRil.unsljLogRet(RIL_UNSOL_CELL_INFO_LIST, response); 765 766 mRil.mRilCellInfoListRegistrants.notifyRegistrants(new AsyncResult(null, response, null)); 767 } 768 769 /** Get unsolicited message for cellInfoList using HAL V1_5 */ cellInfoList_1_5(int indicationType, ArrayList<android.hardware.radio.V1_5.CellInfo> records)770 public void cellInfoList_1_5(int indicationType, 771 ArrayList<android.hardware.radio.V1_5.CellInfo> records) { 772 mRil.processIndication(indicationType); 773 774 ArrayList<CellInfo> response = RIL.convertHalCellInfoList_1_5(records); 775 776 if (RIL.RILJ_LOGD) mRil.unsljLogRet(RIL_UNSOL_CELL_INFO_LIST, response); 777 778 mRil.mRilCellInfoListRegistrants.notifyRegistrants(new AsyncResult(null, response, null)); 779 } 780 781 /** Get unsolicited message for uicc applications enablement changes. */ uiccApplicationsEnablementChanged(int indicationType, boolean enabled)782 public void uiccApplicationsEnablementChanged(int indicationType, boolean enabled) { 783 mRil.processIndication(indicationType); 784 785 if (RIL.RILJ_LOGD) { 786 mRil.unsljLogRet(RIL_UNSOL_UICC_APPLICATIONS_ENABLEMENT_CHANGED, enabled); 787 } 788 789 mRil.mUiccApplicationsEnablementRegistrants.notifyResult(enabled); 790 } 791 792 /** Incremental network scan results */ networkScanResult(int indicationType, android.hardware.radio.V1_1.NetworkScanResult result)793 public void networkScanResult(int indicationType, 794 android.hardware.radio.V1_1.NetworkScanResult result) { 795 responseNetworkScan(indicationType, result); 796 } 797 798 /** Incremental network scan results with HAL V1_2 */ networkScanResult_1_2(int indicationType, android.hardware.radio.V1_2.NetworkScanResult result)799 public void networkScanResult_1_2(int indicationType, 800 android.hardware.radio.V1_2.NetworkScanResult result) { 801 responseNetworkScan_1_2(indicationType, result); 802 } 803 804 /** Incremental network scan results with HAL V1_4 */ networkScanResult_1_4(int indicationType, android.hardware.radio.V1_4.NetworkScanResult result)805 public void networkScanResult_1_4(int indicationType, 806 android.hardware.radio.V1_4.NetworkScanResult result) { 807 responseNetworkScan_1_4(indicationType, result); 808 } 809 810 /** Incremental network scan results with HAL V1_5 */ networkScanResult_1_5(int indicationType, android.hardware.radio.V1_5.NetworkScanResult result)811 public void networkScanResult_1_5(int indicationType, 812 android.hardware.radio.V1_5.NetworkScanResult result) { 813 responseNetworkScan_1_5(indicationType, result); 814 } 815 imsNetworkStateChanged(int indicationType)816 public void imsNetworkStateChanged(int indicationType) { 817 mRil.processIndication(indicationType); 818 819 if (RIL.RILJ_LOGD) mRil.unsljLog(RIL_UNSOL_RESPONSE_IMS_NETWORK_STATE_CHANGED); 820 821 mRil.mImsNetworkStateChangedRegistrants.notifyRegistrants(); 822 } 823 subscriptionStatusChanged(int indicationType, boolean activate)824 public void subscriptionStatusChanged(int indicationType, boolean activate) { 825 mRil.processIndication(indicationType); 826 827 int response[] = new int[1]; 828 response[0] = activate ? 1 : 0; 829 830 if (RIL.RILJ_LOGD) mRil.unsljLogRet(RIL_UNSOL_UICC_SUBSCRIPTION_STATUS_CHANGED, response); 831 832 mRil.mSubscriptionStatusRegistrants.notifyRegistrants( 833 new AsyncResult (null, response, null)); 834 } 835 srvccStateNotify(int indicationType, int state)836 public void srvccStateNotify(int indicationType, int state) { 837 mRil.processIndication(indicationType); 838 839 int response[] = new int[1]; 840 response[0] = state; 841 842 if (RIL.RILJ_LOGD) mRil.unsljLogRet(RIL_UNSOL_SRVCC_STATE_NOTIFY, response); 843 844 mRil.writeMetricsSrvcc(state); 845 846 mRil.mSrvccStateRegistrants.notifyRegistrants( 847 new AsyncResult (null, response, null)); 848 } 849 hardwareConfigChanged( int indicationType, ArrayList<android.hardware.radio.V1_0.HardwareConfig> configs)850 public void hardwareConfigChanged( 851 int indicationType, 852 ArrayList<android.hardware.radio.V1_0.HardwareConfig> configs) { 853 mRil.processIndication(indicationType); 854 855 ArrayList<HardwareConfig> response = RIL.convertHalHwConfigList(configs, mRil); 856 857 if (RIL.RILJ_LOGD) mRil.unsljLogRet(RIL_UNSOL_HARDWARE_CONFIG_CHANGED, response); 858 859 mRil.mHardwareConfigChangeRegistrants.notifyRegistrants( 860 new AsyncResult (null, response, null)); 861 } 862 radioCapabilityIndication(int indicationType, android.hardware.radio.V1_0.RadioCapability rc)863 public void radioCapabilityIndication(int indicationType, 864 android.hardware.radio.V1_0.RadioCapability rc) { 865 mRil.processIndication(indicationType); 866 867 RadioCapability response = RIL.convertHalRadioCapability(rc, mRil); 868 869 if (RIL.RILJ_LOGD) mRil.unsljLogRet(RIL_UNSOL_RADIO_CAPABILITY, response); 870 871 mRil.mPhoneRadioCapabilityChangedRegistrants.notifyRegistrants( 872 new AsyncResult (null, response, null)); 873 } 874 onSupplementaryServiceIndication(int indicationType, StkCcUnsolSsResult ss)875 public void onSupplementaryServiceIndication(int indicationType, StkCcUnsolSsResult ss) { 876 mRil.processIndication(indicationType); 877 878 int num; 879 SsData ssData = new SsData(); 880 881 ssData.serviceType = ssData.ServiceTypeFromRILInt(ss.serviceType); 882 ssData.requestType = ssData.RequestTypeFromRILInt(ss.requestType); 883 ssData.teleserviceType = ssData.TeleserviceTypeFromRILInt(ss.teleserviceType); 884 ssData.serviceClass = ss.serviceClass; // This is service class sent in the SS request. 885 ssData.result = ss.result; // This is the result of the SS request. 886 887 if (ssData.serviceType.isTypeCF() && 888 ssData.requestType.isTypeInterrogation()) { 889 CfData cfData = ss.cfData.get(0); 890 num = cfData.cfInfo.size(); 891 ssData.cfInfo = new CallForwardInfo[num]; 892 893 for (int i = 0; i < num; i++) { 894 android.hardware.radio.V1_0.CallForwardInfo cfInfo = cfData.cfInfo.get(i); 895 ssData.cfInfo[i] = new CallForwardInfo(); 896 897 ssData.cfInfo[i].status = cfInfo.status; 898 ssData.cfInfo[i].reason = cfInfo.reason; 899 ssData.cfInfo[i].serviceClass = cfInfo.serviceClass; 900 ssData.cfInfo[i].toa = cfInfo.toa; 901 ssData.cfInfo[i].number = cfInfo.number; 902 ssData.cfInfo[i].timeSeconds = cfInfo.timeSeconds; 903 904 mRil.riljLog("[SS Data] CF Info " + i + " : " + ssData.cfInfo[i]); 905 } 906 } else { 907 SsInfoData ssInfo = ss.ssInfo.get(0); 908 num = ssInfo.ssInfo.size(); 909 ssData.ssInfo = new int[num]; 910 for (int i = 0; i < num; i++) { 911 ssData.ssInfo[i] = ssInfo.ssInfo.get(i); 912 mRil.riljLog("[SS Data] SS Info " + i + " : " + ssData.ssInfo[i]); 913 } 914 } 915 916 if (RIL.RILJ_LOGD) mRil.unsljLogRet(RIL_UNSOL_ON_SS, ssData); 917 918 if (mRil.mSsRegistrant != null) { 919 mRil.mSsRegistrant.notifyRegistrant(new AsyncResult(null, ssData, null)); 920 } 921 } 922 stkCallControlAlphaNotify(int indicationType, String alpha)923 public void stkCallControlAlphaNotify(int indicationType, String alpha) { 924 mRil.processIndication(indicationType); 925 926 if (RIL.RILJ_LOGD) mRil.unsljLogRet(RIL_UNSOL_STK_CC_ALPHA_NOTIFY, alpha); 927 928 if (mRil.mCatCcAlphaRegistrant != null) { 929 mRil.mCatCcAlphaRegistrant.notifyRegistrant(new AsyncResult (null, alpha, null)); 930 } 931 } 932 lceData(int indicationType, LceDataInfo lce)933 public void lceData(int indicationType, LceDataInfo lce) { 934 mRil.processIndication(indicationType); 935 936 LinkCapacityEstimate response = RIL.convertHalLceData(lce, mRil); 937 938 if (RIL.RILJ_LOGD) mRil.unsljLogRet(RIL_UNSOL_LCEDATA_RECV, response); 939 940 if (mRil.mLceInfoRegistrants != null) { 941 mRil.mLceInfoRegistrants.notifyRegistrants(new AsyncResult(null, response, null)); 942 } 943 } 944 pcoData(int indicationType, PcoDataInfo pco)945 public void pcoData(int indicationType, PcoDataInfo pco) { 946 mRil.processIndication(indicationType); 947 948 PcoData response = new PcoData(pco.cid, 949 pco.bearerProto, 950 pco.pcoId, 951 RIL.arrayListToPrimitiveArray(pco.contents)); 952 953 if (RIL.RILJ_LOGD) mRil.unsljLogRet(RIL_UNSOL_PCO_DATA, response); 954 955 mRil.mPcoDataRegistrants.notifyRegistrants(new AsyncResult(null, response, null)); 956 } 957 modemReset(int indicationType, String reason)958 public void modemReset(int indicationType, String reason) { 959 mRil.processIndication(indicationType); 960 961 if (RIL.RILJ_LOGD) mRil.unsljLogRet(RIL_UNSOL_MODEM_RESTART, reason); 962 963 mRil.writeMetricsModemRestartEvent(reason); 964 mRil.mModemResetRegistrants.notifyRegistrants(new AsyncResult(null, reason, null)); 965 } 966 967 /** 968 * Indicates when the carrier info to encrypt IMSI is being requested 969 * @param indicationType RadioIndicationType 970 */ carrierInfoForImsiEncryption(int indicationType)971 public void carrierInfoForImsiEncryption(int indicationType) { 972 mRil.processIndication(indicationType); 973 974 if (RIL.RILJ_LOGD) mRil.unsljLogRet(RIL_UNSOL_CARRIER_INFO_IMSI_ENCRYPTION, null); 975 976 mRil.mCarrierInfoForImsiEncryptionRegistrants.notifyRegistrants( 977 new AsyncResult(null, null, null)); 978 } 979 980 /** 981 * Indicates a change in the status of an ongoing Keepalive session 982 * @param indicationType RadioIndicationType 983 * @param halStatus Status of the ongoing Keepalive session 984 */ keepaliveStatus( int indicationType, android.hardware.radio.V1_1.KeepaliveStatus halStatus)985 public void keepaliveStatus( 986 int indicationType, android.hardware.radio.V1_1.KeepaliveStatus halStatus) { 987 mRil.processIndication(indicationType); 988 989 if (RIL.RILJ_LOGD) { 990 mRil.unsljLogRet(RIL_UNSOL_KEEPALIVE_STATUS, 991 "handle=" + halStatus.sessionHandle + " code=" + halStatus.code); 992 } 993 994 KeepaliveStatus ks = new KeepaliveStatus(halStatus.sessionHandle, halStatus.code); 995 mRil.mNattKeepaliveStatusRegistrants.notifyRegistrants(new AsyncResult(null, ks, null)); 996 } 997 998 /** 999 * Indicate that a registration failure has occurred. 1000 * 1001 * @param cellIdentity a CellIdentity the CellIdentity of the Cell 1002 * @param chosenPlmn a 5 or 6 digit alphanumeric string indicating the PLMN on which 1003 * registration failed 1004 * @param domain the domain of the failed procedure: CS, PS, or both 1005 * @param causeCode the primary failure cause code of the procedure 1006 * @param additionalCauseCode an additional cause code if applicable 1007 */ registrationFailed(int indicationType, android.hardware.radio.V1_5.CellIdentity cellIdentity, String chosenPlmn, @NetworkRegistrationInfo.Domain int domain, int causeCode, int additionalCauseCode)1008 public void registrationFailed(int indicationType, 1009 android.hardware.radio.V1_5.CellIdentity cellIdentity, String chosenPlmn, 1010 @NetworkRegistrationInfo.Domain int domain, 1011 int causeCode, int additionalCauseCode) { 1012 mRil.processIndication(indicationType); 1013 1014 if (cellIdentity == null 1015 || TextUtils.isEmpty(chosenPlmn) 1016 || (domain & NetworkRegistrationInfo.DOMAIN_CS_PS) == 0 1017 || (domain & ~NetworkRegistrationInfo.DOMAIN_CS_PS) != 0 1018 || causeCode < 0 || additionalCauseCode < 0 1019 || (causeCode == Integer.MAX_VALUE && additionalCauseCode == Integer.MAX_VALUE)) { 1020 AnomalyReporter.reportAnomaly( 1021 UUID.fromString("f16e5703-6105-4341-9eb3-e68189156eb4"), 1022 "Invalid registrationFailed indication"); 1023 1024 mRil.riljLoge("Invalid registrationFailed indication"); 1025 return; 1026 } 1027 1028 CellIdentity ci = CellIdentity.create(cellIdentity); 1029 1030 mRil.mRegistrationFailedRegistrant.notifyRegistrant( 1031 new AsyncResult( 1032 null, 1033 new RegistrationFailedEvent(ci, chosenPlmn, domain, 1034 causeCode, additionalCauseCode), 1035 null)); 1036 } 1037 1038 /** 1039 * Indicate that BarringInfo has changed for the current cell and user. 1040 * 1041 * @param cellIdentity a CellIdentity the CellIdentity of the Cell 1042 * @param barringInfos the updated barring information from the current cell, filtered for the 1043 * current PLMN and access class / access category. 1044 */ barringInfoChanged(int indicationType, android.hardware.radio.V1_5.CellIdentity cellIdentity, ArrayList<android.hardware.radio.V1_5.BarringInfo> barringInfos)1045 public void barringInfoChanged(int indicationType, 1046 android.hardware.radio.V1_5.CellIdentity cellIdentity, 1047 ArrayList<android.hardware.radio.V1_5.BarringInfo> barringInfos) { 1048 mRil.processIndication(indicationType); 1049 1050 if (cellIdentity == null || barringInfos == null) { 1051 AnomalyReporter.reportAnomaly( 1052 UUID.fromString("645b16bb-c930-4c1c-9c5d-568696542e05"), 1053 "Invalid barringInfoChanged indication"); 1054 1055 mRil.riljLoge("Invalid barringInfoChanged indication"); 1056 return; 1057 } 1058 1059 CellIdentity ci = CellIdentity.create(cellIdentity); 1060 BarringInfo cbi = BarringInfo.create(cellIdentity, barringInfos); 1061 1062 mRil.mBarringInfoChangedRegistrants.notifyRegistrants( 1063 new AsyncResult(null, cbi, null)); 1064 } 1065 1066 /** 1067 * @param stateInt 1068 * @return {@link RadioPowerState RadioPowerState} 1069 */ getRadioStateFromInt(int stateInt)1070 private @RadioPowerState int getRadioStateFromInt(int stateInt) { 1071 int state; 1072 1073 switch(stateInt) { 1074 case android.hardware.radio.V1_0.RadioState.OFF: 1075 state = TelephonyManager.RADIO_POWER_OFF; 1076 break; 1077 case android.hardware.radio.V1_0.RadioState.UNAVAILABLE: 1078 state = TelephonyManager.RADIO_POWER_UNAVAILABLE; 1079 break; 1080 case android.hardware.radio.V1_0.RadioState.ON: 1081 state = TelephonyManager.RADIO_POWER_ON; 1082 break; 1083 default: 1084 throw new RuntimeException("Unrecognized RadioState: " + stateInt); 1085 } 1086 return state; 1087 } 1088 1089 1090 /** 1091 * Set the frequency range or channel number from the physical channel config. Only one of them 1092 * is valid, we should set the other to the unknown value. 1093 * @param builder the builder of {@link PhysicalChannelConfig}. 1094 * @param config physical channel config from ril. 1095 */ setFrequencyRangeOrChannelNumber(PhysicalChannelConfig.Builder builder, android.hardware.radio.V1_4.PhysicalChannelConfig config)1096 private void setFrequencyRangeOrChannelNumber(PhysicalChannelConfig.Builder builder, 1097 android.hardware.radio.V1_4.PhysicalChannelConfig config) { 1098 1099 switch (config.rfInfo.getDiscriminator()) { 1100 case android.hardware.radio.V1_4.RadioFrequencyInfo.hidl_discriminator.range: 1101 builder.setFrequencyRange(config.rfInfo.range()); 1102 break; 1103 case android.hardware.radio.V1_4.RadioFrequencyInfo.hidl_discriminator.channelNumber: 1104 builder.setChannelNumber(config.rfInfo.channelNumber()); 1105 break; 1106 default: 1107 mRil.riljLoge("Unsupported frequency type " + config.rfInfo.getDiscriminator()); 1108 } 1109 } 1110 convertConnectionStatusFromCellConnectionStatus(int status)1111 private int convertConnectionStatusFromCellConnectionStatus(int status) { 1112 switch (status) { 1113 case CellConnectionStatus.PRIMARY_SERVING: 1114 return PhysicalChannelConfig.CONNECTION_PRIMARY_SERVING; 1115 case CellConnectionStatus.SECONDARY_SERVING: 1116 return PhysicalChannelConfig.CONNECTION_SECONDARY_SERVING; 1117 default: 1118 // only PRIMARY_SERVING and SECONDARY_SERVING are supported. 1119 mRil.riljLoge("Unsupported CellConnectionStatus in PhysicalChannelConfig: " 1120 + status); 1121 return PhysicalChannelConfig.CONNECTION_UNKNOWN; 1122 } 1123 } 1124 physicalChannelConfigsIndication(List<? extends Object> configs)1125 private void physicalChannelConfigsIndication(List<? extends Object> configs) { 1126 List<PhysicalChannelConfig> response = new ArrayList<>(configs.size()); 1127 for (Object obj : configs) { 1128 if (obj instanceof android.hardware.radio.V1_2.PhysicalChannelConfig) { 1129 android.hardware.radio.V1_2.PhysicalChannelConfig config = 1130 (android.hardware.radio.V1_2.PhysicalChannelConfig) obj; 1131 1132 response.add(new PhysicalChannelConfig.Builder() 1133 .setCellConnectionStatus( 1134 convertConnectionStatusFromCellConnectionStatus(config.status)) 1135 .setCellBandwidthDownlinkKhz(config.cellBandwidthDownlink) 1136 .build()); 1137 } else if (obj instanceof android.hardware.radio.V1_4.PhysicalChannelConfig) { 1138 android.hardware.radio.V1_4.PhysicalChannelConfig config = 1139 (android.hardware.radio.V1_4.PhysicalChannelConfig) obj; 1140 PhysicalChannelConfig.Builder builder = new PhysicalChannelConfig.Builder(); 1141 setFrequencyRangeOrChannelNumber(builder, config); 1142 response.add(builder.setCellConnectionStatus( 1143 convertConnectionStatusFromCellConnectionStatus(config.base.status)) 1144 .setCellBandwidthDownlinkKhz(config.base.cellBandwidthDownlink) 1145 .setRat(ServiceState.rilRadioTechnologyToNetworkType(config.rat)) 1146 .setPhysicalCellId(config.physicalCellId) 1147 .setContextIds(config.contextIds.stream().mapToInt(x -> x).toArray()) 1148 .build()); 1149 } else { 1150 mRil.riljLoge("Unsupported PhysicalChannelConfig " + obj); 1151 } 1152 } 1153 1154 if (RIL.RILJ_LOGD) mRil.unsljLogRet(RIL_UNSOL_PHYSICAL_CHANNEL_CONFIG, response); 1155 1156 mRil.mPhysicalChannelConfigurationRegistrants.notifyRegistrants( 1157 new AsyncResult(null, response, null)); 1158 } 1159 responseNetworkScan(int indicationType, android.hardware.radio.V1_1.NetworkScanResult result)1160 private void responseNetworkScan(int indicationType, 1161 android.hardware.radio.V1_1.NetworkScanResult result) { 1162 mRil.processIndication(indicationType); 1163 1164 NetworkScanResult nsr = null; 1165 ArrayList<CellInfo> infos = RIL.convertHalCellInfoList(result.networkInfos); 1166 nsr = new NetworkScanResult(result.status, result.error, infos); 1167 if (RIL.RILJ_LOGD) mRil.unsljLogRet(RIL_UNSOL_NETWORK_SCAN_RESULT, nsr); 1168 mRil.mRilNetworkScanResultRegistrants.notifyRegistrants(new AsyncResult(null, nsr, null)); 1169 } 1170 responseNetworkScan_1_2(int indicationType, android.hardware.radio.V1_2.NetworkScanResult result)1171 private void responseNetworkScan_1_2(int indicationType, 1172 android.hardware.radio.V1_2.NetworkScanResult result) { 1173 mRil.processIndication(indicationType); 1174 1175 NetworkScanResult nsr = null; 1176 ArrayList<CellInfo> infos = RIL.convertHalCellInfoList_1_2(result.networkInfos); 1177 nsr = new NetworkScanResult(result.status, result.error, infos); 1178 if (RIL.RILJ_LOGD) mRil.unsljLogRet(RIL_UNSOL_NETWORK_SCAN_RESULT, nsr); 1179 mRil.mRilNetworkScanResultRegistrants.notifyRegistrants(new AsyncResult(null, nsr, null)); 1180 } 1181 responseNetworkScan_1_4(int indicationType, android.hardware.radio.V1_4.NetworkScanResult result)1182 private void responseNetworkScan_1_4(int indicationType, 1183 android.hardware.radio.V1_4.NetworkScanResult result) { 1184 mRil.processIndication(indicationType); 1185 1186 ArrayList<CellInfo> cellInfos = RIL.convertHalCellInfoList_1_4(result.networkInfos); 1187 NetworkScanResult nsr = new NetworkScanResult(result.status, result.error, cellInfos); 1188 if (RIL.RILJ_LOGD) mRil.unsljLogRet(RIL_UNSOL_NETWORK_SCAN_RESULT, nsr); 1189 mRil.mRilNetworkScanResultRegistrants.notifyRegistrants(new AsyncResult(null, nsr, null)); 1190 } 1191 responseNetworkScan_1_5(int indicationType, android.hardware.radio.V1_5.NetworkScanResult result)1192 private void responseNetworkScan_1_5(int indicationType, 1193 android.hardware.radio.V1_5.NetworkScanResult result) { 1194 mRil.processIndication(indicationType); 1195 1196 ArrayList<CellInfo> cellInfos = RIL.convertHalCellInfoList_1_5(result.networkInfos); 1197 NetworkScanResult nsr = new NetworkScanResult(result.status, result.error, cellInfos); 1198 if (RIL.RILJ_LOGD) mRil.unsljLogRet(RIL_UNSOL_NETWORK_SCAN_RESULT, nsr); 1199 mRil.mRilNetworkScanResultRegistrants.notifyRegistrants(new AsyncResult(null, nsr, null)); 1200 } 1201 responseDataCallListChanged(int indicationType, List<?> dcList)1202 private void responseDataCallListChanged(int indicationType, List<?> dcList) { 1203 mRil.processIndication(indicationType); 1204 1205 if (RIL.RILJ_LOGD) mRil.unsljLogRet(RIL_UNSOL_DATA_CALL_LIST_CHANGED, dcList); 1206 1207 ArrayList<DataCallResponse> response = RIL.convertDataCallResultList(dcList); 1208 mRil.mDataCallListChangedRegistrants.notifyRegistrants( 1209 new AsyncResult(null, response, null)); 1210 } 1211 } 1212