1 2 /* 3 * Copyright (C) 2006 The Android Open Source Project 4 * 5 * Licensed under the Apache License, Version 2.0 (the "License"); 6 * you may not use this file except in compliance with the License. 7 * You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 */ 17 18 package com.android.internal.telephony; 19 20 import android.annotation.NonNull; 21 import android.compat.annotation.UnsupportedAppUsage; 22 import android.content.Context; 23 import android.os.AsyncResult; 24 import android.os.Build; 25 import android.os.Handler; 26 import android.os.Message; 27 import android.os.Registrant; 28 import android.os.RegistrantList; 29 import android.telephony.Annotation.RadioPowerState; 30 import android.telephony.BarringInfo; 31 import android.telephony.TelephonyManager; 32 import android.telephony.emergency.EmergencyNumber; 33 34 import com.android.internal.telephony.uicc.SimPhonebookRecord; 35 36 import java.util.ArrayList; 37 import java.util.List; 38 39 /** 40 * {@hide} 41 */ 42 public abstract class BaseCommands implements CommandsInterface { 43 //***** Instance Variables 44 @UnsupportedAppUsage 45 protected Context mContext; 46 protected int mState = TelephonyManager.RADIO_POWER_UNAVAILABLE; 47 @UnsupportedAppUsage 48 protected Object mStateMonitor = new Object(); 49 50 protected RegistrantList mRadioStateChangedRegistrants = new RegistrantList(); 51 protected RegistrantList mOnRegistrants = new RegistrantList(); 52 protected RegistrantList mAvailRegistrants = new RegistrantList(); 53 protected RegistrantList mOffOrNotAvailRegistrants = new RegistrantList(); 54 protected RegistrantList mNotAvailRegistrants = new RegistrantList(); 55 @UnsupportedAppUsage 56 protected RegistrantList mCallStateRegistrants = new RegistrantList(); 57 protected RegistrantList mNetworkStateRegistrants = new RegistrantList(); 58 protected RegistrantList mDataCallListChangedRegistrants = new RegistrantList(); 59 protected RegistrantList mApnUnthrottledRegistrants = new RegistrantList(); 60 protected RegistrantList mSlicingConfigChangedRegistrants = new RegistrantList(); 61 @UnsupportedAppUsage 62 protected RegistrantList mVoiceRadioTechChangedRegistrants = new RegistrantList(); 63 @UnsupportedAppUsage 64 protected RegistrantList mImsNetworkStateChangedRegistrants = new RegistrantList(); 65 @UnsupportedAppUsage 66 protected RegistrantList mIccStatusChangedRegistrants = new RegistrantList(); 67 protected RegistrantList mIccSlotStatusChangedRegistrants = new RegistrantList(); 68 protected RegistrantList mVoicePrivacyOnRegistrants = new RegistrantList(); 69 protected RegistrantList mVoicePrivacyOffRegistrants = new RegistrantList(); 70 @UnsupportedAppUsage 71 protected RegistrantList mOtaProvisionRegistrants = new RegistrantList(); 72 @UnsupportedAppUsage 73 protected RegistrantList mCallWaitingInfoRegistrants = new RegistrantList(); 74 protected RegistrantList mDisplayInfoRegistrants = new RegistrantList(); 75 protected RegistrantList mSignalInfoRegistrants = new RegistrantList(); 76 protected RegistrantList mNumberInfoRegistrants = new RegistrantList(); 77 protected RegistrantList mRedirNumInfoRegistrants = new RegistrantList(); 78 protected RegistrantList mLineControlInfoRegistrants = new RegistrantList(); 79 protected RegistrantList mT53ClirInfoRegistrants = new RegistrantList(); 80 protected RegistrantList mT53AudCntrlInfoRegistrants = new RegistrantList(); 81 @UnsupportedAppUsage 82 protected RegistrantList mRingbackToneRegistrants = new RegistrantList(); 83 @UnsupportedAppUsage 84 protected RegistrantList mResendIncallMuteRegistrants = new RegistrantList(); 85 @UnsupportedAppUsage 86 protected RegistrantList mCdmaSubscriptionChangedRegistrants = new RegistrantList(); 87 @UnsupportedAppUsage 88 protected RegistrantList mCdmaPrlChangedRegistrants = new RegistrantList(); 89 @UnsupportedAppUsage 90 protected RegistrantList mExitEmergencyCallbackModeRegistrants = new RegistrantList(); 91 protected RegistrantList mRilConnectedRegistrants = new RegistrantList(); 92 @UnsupportedAppUsage 93 protected RegistrantList mIccRefreshRegistrants = new RegistrantList(); 94 @UnsupportedAppUsage 95 protected RegistrantList mRilCellInfoListRegistrants = new RegistrantList(); 96 @UnsupportedAppUsage 97 protected RegistrantList mSubscriptionStatusRegistrants = new RegistrantList(); 98 @UnsupportedAppUsage 99 protected RegistrantList mSrvccStateRegistrants = new RegistrantList(); 100 @UnsupportedAppUsage 101 protected RegistrantList mHardwareConfigChangeRegistrants = new RegistrantList(); 102 @UnsupportedAppUsage 103 protected RegistrantList mPhoneRadioCapabilityChangedRegistrants = 104 new RegistrantList(); 105 protected RegistrantList mPcoDataRegistrants = new RegistrantList(); 106 protected RegistrantList mCarrierInfoForImsiEncryptionRegistrants = new RegistrantList(); 107 protected RegistrantList mRilNetworkScanResultRegistrants = new RegistrantList(); 108 protected RegistrantList mModemResetRegistrants = new RegistrantList(); 109 protected RegistrantList mNattKeepaliveStatusRegistrants = new RegistrantList(); 110 protected RegistrantList mPhysicalChannelConfigurationRegistrants = new RegistrantList(); 111 protected RegistrantList mLceInfoRegistrants = new RegistrantList(); 112 protected RegistrantList mEmergencyNumberListRegistrants = new RegistrantList(); 113 protected RegistrantList mUiccApplicationsEnablementRegistrants = new RegistrantList(); 114 protected RegistrantList mBarringInfoChangedRegistrants = new RegistrantList(); 115 protected RegistrantList mSimPhonebookChangedRegistrants = new RegistrantList(); 116 protected RegistrantList mSimPhonebookRecordsReceivedRegistrants = new RegistrantList(); 117 protected RegistrantList mEmergencyNetworkScanRegistrants = new RegistrantList(); 118 protected RegistrantList mConnectionSetupFailureRegistrants = new RegistrantList(); 119 protected RegistrantList mNotifyAnbrRegistrants = new RegistrantList(); 120 protected RegistrantList mTriggerImsDeregistrationRegistrants = new RegistrantList(); 121 protected RegistrantList mImeiInfoRegistrants = new RegistrantList(); 122 protected RegistrantList mCellularIdentifierDisclosedRegistrants = new RegistrantList(); 123 protected RegistrantList mSecurityAlgorithmUpdatedRegistrants = new RegistrantList(); 124 125 @UnsupportedAppUsage 126 protected Registrant mGsmSmsRegistrant; 127 @UnsupportedAppUsage 128 protected Registrant mCdmaSmsRegistrant; 129 @UnsupportedAppUsage 130 protected Registrant mNITZTimeRegistrant; 131 @UnsupportedAppUsage 132 protected Registrant mSignalStrengthRegistrant; 133 @UnsupportedAppUsage 134 protected Registrant mUSSDRegistrant; 135 @UnsupportedAppUsage 136 protected Registrant mSmsOnSimRegistrant; 137 @UnsupportedAppUsage 138 protected Registrant mSmsStatusRegistrant; 139 @UnsupportedAppUsage 140 protected Registrant mSsnRegistrant; 141 @UnsupportedAppUsage 142 protected Registrant mCatSessionEndRegistrant; 143 @UnsupportedAppUsage 144 protected Registrant mCatProCmdRegistrant; 145 @UnsupportedAppUsage 146 protected Registrant mCatEventRegistrant; 147 @UnsupportedAppUsage 148 protected Registrant mCatCallSetUpRegistrant; 149 @UnsupportedAppUsage 150 protected Registrant mIccSmsFullRegistrant; 151 @UnsupportedAppUsage 152 protected Registrant mEmergencyCallbackModeRegistrant; 153 @UnsupportedAppUsage 154 protected Registrant mRingRegistrant; 155 @UnsupportedAppUsage 156 protected Registrant mRestrictedStateRegistrant; 157 @UnsupportedAppUsage 158 protected Registrant mGsmBroadcastSmsRegistrant; 159 @UnsupportedAppUsage 160 protected Registrant mCatCcAlphaRegistrant; 161 @UnsupportedAppUsage 162 protected Registrant mSsRegistrant; 163 protected Registrant mRegistrationFailedRegistrant; 164 165 // Lock that mLastEmergencyNumberListIndication uses. 166 private Object mLastEmergencyNumberListIndicationLock = new Object(); 167 // Cache last emergency number list indication from radio 168 private final List<EmergencyNumber> mLastEmergencyNumberListIndication = new ArrayList<>(); 169 170 // The last barring information received 171 protected BarringInfo mLastBarringInfo = new BarringInfo(); 172 // Preferred network type received from PhoneFactory. 173 // This is used when establishing a connection to the 174 // vendor ril so it starts up in the correct mode. 175 @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553) 176 protected int mAllowedNetworkTypesBitmask; 177 // CDMA subscription received from PhoneFactory 178 protected int mCdmaSubscription; 179 // Type of Phone, GSM or CDMA. Set by GsmCdmaPhone. 180 @UnsupportedAppUsage 181 protected int mPhoneType; 182 // RIL Version 183 protected int mRilVersion = -1; 184 BaseCommands(Context context)185 public BaseCommands(Context context) { 186 mContext = context; // May be null (if so we won't log statistics) 187 } 188 189 //***** CommandsInterface implementation 190 191 @Override getRadioState()192 public @RadioPowerState int getRadioState() { 193 return mState; 194 } 195 196 @Override registerForRadioStateChanged(Handler h, int what, Object obj)197 public void registerForRadioStateChanged(Handler h, int what, Object obj) { 198 synchronized (mStateMonitor) { 199 mRadioStateChangedRegistrants.addUnique(h, what, obj); 200 Message.obtain(h, what, new AsyncResult(obj, null, null)).sendToTarget(); 201 } 202 } 203 204 @Override unregisterForRadioStateChanged(Handler h)205 public void unregisterForRadioStateChanged(Handler h) { 206 synchronized (mStateMonitor) { 207 mRadioStateChangedRegistrants.remove(h); 208 } 209 } 210 registerForImsNetworkStateChanged(Handler h, int what, Object obj)211 public void registerForImsNetworkStateChanged(Handler h, int what, Object obj) { 212 mImsNetworkStateChangedRegistrants.addUnique(h, what, obj); 213 } 214 unregisterForImsNetworkStateChanged(Handler h)215 public void unregisterForImsNetworkStateChanged(Handler h) { 216 mImsNetworkStateChangedRegistrants.remove(h); 217 } 218 219 @Override registerForOn(Handler h, int what, Object obj)220 public void registerForOn(Handler h, int what, Object obj) { 221 synchronized (mStateMonitor) { 222 mOnRegistrants.addUnique(h, what, obj); 223 224 if (mState == TelephonyManager.RADIO_POWER_ON) { 225 Message.obtain(h, what, new AsyncResult(obj, null, null)).sendToTarget(); 226 } 227 } 228 } 229 @Override unregisterForOn(Handler h)230 public void unregisterForOn(Handler h) { 231 synchronized (mStateMonitor) { 232 mOnRegistrants.remove(h); 233 } 234 } 235 236 237 @Override registerForAvailable(Handler h, int what, Object obj)238 public void registerForAvailable(Handler h, int what, Object obj) { 239 synchronized (mStateMonitor) { 240 mAvailRegistrants.addUnique(h, what, obj); 241 242 if (mState != TelephonyManager.RADIO_POWER_UNAVAILABLE) { 243 Message.obtain(h, what, new AsyncResult(obj, null, null)).sendToTarget(); 244 } 245 } 246 } 247 248 @Override unregisterForAvailable(Handler h)249 public void unregisterForAvailable(Handler h) { 250 synchronized(mStateMonitor) { 251 mAvailRegistrants.remove(h); 252 } 253 } 254 255 @Override registerForNotAvailable(Handler h, int what, Object obj)256 public void registerForNotAvailable(Handler h, int what, Object obj) { 257 synchronized (mStateMonitor) { 258 mNotAvailRegistrants.addUnique(h, what, obj); 259 260 if (mState == TelephonyManager.RADIO_POWER_UNAVAILABLE) { 261 Message.obtain(h, what, new AsyncResult(obj, null, null)).sendToTarget(); 262 } 263 } 264 } 265 266 @Override unregisterForNotAvailable(Handler h)267 public void unregisterForNotAvailable(Handler h) { 268 synchronized (mStateMonitor) { 269 mNotAvailRegistrants.remove(h); 270 } 271 } 272 273 @Override registerForOffOrNotAvailable(Handler h, int what, Object obj)274 public void registerForOffOrNotAvailable(Handler h, int what, Object obj) { 275 synchronized (mStateMonitor) { 276 mOffOrNotAvailRegistrants.addUnique(h, what, obj); 277 278 if (mState == TelephonyManager.RADIO_POWER_OFF 279 || mState == TelephonyManager.RADIO_POWER_UNAVAILABLE) { 280 Message.obtain(h, what, new AsyncResult(obj, null, null)).sendToTarget(); 281 } 282 } 283 } 284 @Override unregisterForOffOrNotAvailable(Handler h)285 public void unregisterForOffOrNotAvailable(Handler h) { 286 synchronized(mStateMonitor) { 287 mOffOrNotAvailRegistrants.remove(h); 288 } 289 } 290 291 @Override registerForCallStateChanged(Handler h, int what, Object obj)292 public void registerForCallStateChanged(Handler h, int what, Object obj) { 293 mCallStateRegistrants.addUnique(h, what, obj); 294 } 295 296 @Override unregisterForCallStateChanged(Handler h)297 public void unregisterForCallStateChanged(Handler h) { 298 mCallStateRegistrants.remove(h); 299 } 300 301 @Override registerForNetworkStateChanged(Handler h, int what, Object obj)302 public void registerForNetworkStateChanged(Handler h, int what, Object obj) { 303 mNetworkStateRegistrants.addUnique(h, what, obj); 304 } 305 306 @Override unregisterForNetworkStateChanged(Handler h)307 public void unregisterForNetworkStateChanged(Handler h) { 308 mNetworkStateRegistrants.remove(h); 309 } 310 311 @Override registerForDataCallListChanged(Handler h, int what, Object obj)312 public void registerForDataCallListChanged(Handler h, int what, Object obj) { 313 mDataCallListChangedRegistrants.addUnique(h, what, obj); 314 } 315 316 @Override unregisterForDataCallListChanged(Handler h)317 public void unregisterForDataCallListChanged(Handler h) { 318 mDataCallListChangedRegistrants.remove(h); 319 } 320 321 @Override registerForApnUnthrottled(Handler h, int what, Object obj)322 public void registerForApnUnthrottled(Handler h, int what, Object obj) { 323 mApnUnthrottledRegistrants.addUnique(h, what, obj); 324 } 325 326 @Override unregisterForApnUnthrottled(Handler h)327 public void unregisterForApnUnthrottled(Handler h) { 328 mApnUnthrottledRegistrants.remove(h); 329 } 330 331 @Override registerForSlicingConfigChanged(Handler h, int what, Object obj)332 public void registerForSlicingConfigChanged(Handler h, int what, Object obj) { 333 mSlicingConfigChangedRegistrants.addUnique(h, what, obj); 334 } 335 336 @Override unregisterForSlicingConfigChanged(Handler h)337 public void unregisterForSlicingConfigChanged(Handler h) { 338 mSlicingConfigChangedRegistrants.remove(h); 339 } 340 341 @Override registerForVoiceRadioTechChanged(Handler h, int what, Object obj)342 public void registerForVoiceRadioTechChanged(Handler h, int what, Object obj) { 343 mVoiceRadioTechChangedRegistrants.addUnique(h, what, obj); 344 } 345 346 @Override unregisterForVoiceRadioTechChanged(Handler h)347 public void unregisterForVoiceRadioTechChanged(Handler h) { 348 mVoiceRadioTechChangedRegistrants.remove(h); 349 } 350 351 @Override registerForIccStatusChanged(Handler h, int what, Object obj)352 public void registerForIccStatusChanged(Handler h, int what, Object obj) { 353 mIccStatusChangedRegistrants.addUnique(h, what, obj); 354 } 355 356 @Override unregisterForIccStatusChanged(Handler h)357 public void unregisterForIccStatusChanged(Handler h) { 358 mIccStatusChangedRegistrants.remove(h); 359 } 360 361 @Override registerForIccSlotStatusChanged(Handler h, int what, Object obj)362 public void registerForIccSlotStatusChanged(Handler h, int what, Object obj) { 363 mIccSlotStatusChangedRegistrants.addUnique(h, what, obj); 364 } 365 366 @Override unregisterForIccSlotStatusChanged(Handler h)367 public void unregisterForIccSlotStatusChanged(Handler h) { 368 mIccSlotStatusChangedRegistrants.remove(h); 369 } 370 371 @Override setOnNewGsmSms(Handler h, int what, Object obj)372 public void setOnNewGsmSms(Handler h, int what, Object obj) { 373 mGsmSmsRegistrant = new Registrant (h, what, obj); 374 } 375 376 @Override unSetOnNewGsmSms(Handler h)377 public void unSetOnNewGsmSms(Handler h) { 378 if (mGsmSmsRegistrant != null && mGsmSmsRegistrant.getHandler() == h) { 379 mGsmSmsRegistrant.clear(); 380 mGsmSmsRegistrant = null; 381 } 382 } 383 384 @Override setOnNewCdmaSms(Handler h, int what, Object obj)385 public void setOnNewCdmaSms(Handler h, int what, Object obj) { 386 mCdmaSmsRegistrant = new Registrant (h, what, obj); 387 } 388 389 @Override unSetOnNewCdmaSms(Handler h)390 public void unSetOnNewCdmaSms(Handler h) { 391 if (mCdmaSmsRegistrant != null && mCdmaSmsRegistrant.getHandler() == h) { 392 mCdmaSmsRegistrant.clear(); 393 mCdmaSmsRegistrant = null; 394 } 395 } 396 397 @Override setOnNewGsmBroadcastSms(Handler h, int what, Object obj)398 public void setOnNewGsmBroadcastSms(Handler h, int what, Object obj) { 399 mGsmBroadcastSmsRegistrant = new Registrant (h, what, obj); 400 } 401 402 @Override unSetOnNewGsmBroadcastSms(Handler h)403 public void unSetOnNewGsmBroadcastSms(Handler h) { 404 if (mGsmBroadcastSmsRegistrant != null && mGsmBroadcastSmsRegistrant.getHandler() == h) { 405 mGsmBroadcastSmsRegistrant.clear(); 406 mGsmBroadcastSmsRegistrant = null; 407 } 408 } 409 410 @Override setOnSmsOnSim(Handler h, int what, Object obj)411 public void setOnSmsOnSim(Handler h, int what, Object obj) { 412 mSmsOnSimRegistrant = new Registrant (h, what, obj); 413 } 414 415 @Override unSetOnSmsOnSim(Handler h)416 public void unSetOnSmsOnSim(Handler h) { 417 if (mSmsOnSimRegistrant != null && mSmsOnSimRegistrant.getHandler() == h) { 418 mSmsOnSimRegistrant.clear(); 419 mSmsOnSimRegistrant = null; 420 } 421 } 422 423 @Override setOnSmsStatus(Handler h, int what, Object obj)424 public void setOnSmsStatus(Handler h, int what, Object obj) { 425 mSmsStatusRegistrant = new Registrant (h, what, obj); 426 } 427 428 @Override unSetOnSmsStatus(Handler h)429 public void unSetOnSmsStatus(Handler h) { 430 if (mSmsStatusRegistrant != null && mSmsStatusRegistrant.getHandler() == h) { 431 mSmsStatusRegistrant.clear(); 432 mSmsStatusRegistrant = null; 433 } 434 } 435 436 @Override setOnSignalStrengthUpdate(Handler h, int what, Object obj)437 public void setOnSignalStrengthUpdate(Handler h, int what, Object obj) { 438 mSignalStrengthRegistrant = new Registrant (h, what, obj); 439 } 440 441 @Override unSetOnSignalStrengthUpdate(Handler h)442 public void unSetOnSignalStrengthUpdate(Handler h) { 443 if (mSignalStrengthRegistrant != null && mSignalStrengthRegistrant.getHandler() == h) { 444 mSignalStrengthRegistrant.clear(); 445 mSignalStrengthRegistrant = null; 446 } 447 } 448 449 @Override setOnNITZTime(Handler h, int what, Object obj)450 public void setOnNITZTime(Handler h, int what, Object obj) { 451 mNITZTimeRegistrant = new Registrant (h, what, obj); 452 } 453 454 @Override unSetOnNITZTime(Handler h)455 public void unSetOnNITZTime(Handler h) { 456 if (mNITZTimeRegistrant != null && mNITZTimeRegistrant.getHandler() == h) { 457 mNITZTimeRegistrant.clear(); 458 mNITZTimeRegistrant = null; 459 } 460 } 461 462 @Override setOnUSSD(Handler h, int what, Object obj)463 public void setOnUSSD(Handler h, int what, Object obj) { 464 mUSSDRegistrant = new Registrant (h, what, obj); 465 } 466 467 @Override unSetOnUSSD(Handler h)468 public void unSetOnUSSD(Handler h) { 469 if (mUSSDRegistrant != null && mUSSDRegistrant.getHandler() == h) { 470 mUSSDRegistrant.clear(); 471 mUSSDRegistrant = null; 472 } 473 } 474 475 @Override setOnSuppServiceNotification(Handler h, int what, Object obj)476 public void setOnSuppServiceNotification(Handler h, int what, Object obj) { 477 mSsnRegistrant = new Registrant (h, what, obj); 478 } 479 480 @Override unSetOnSuppServiceNotification(Handler h)481 public void unSetOnSuppServiceNotification(Handler h) { 482 if (mSsnRegistrant != null && mSsnRegistrant.getHandler() == h) { 483 mSsnRegistrant.clear(); 484 mSsnRegistrant = null; 485 } 486 } 487 488 @Override setOnCatSessionEnd(Handler h, int what, Object obj)489 public void setOnCatSessionEnd(Handler h, int what, Object obj) { 490 mCatSessionEndRegistrant = new Registrant (h, what, obj); 491 } 492 493 @Override unSetOnCatSessionEnd(Handler h)494 public void unSetOnCatSessionEnd(Handler h) { 495 if (mCatSessionEndRegistrant != null && mCatSessionEndRegistrant.getHandler() == h) { 496 mCatSessionEndRegistrant.clear(); 497 mCatSessionEndRegistrant = null; 498 } 499 } 500 501 @Override setOnCatProactiveCmd(Handler h, int what, Object obj)502 public void setOnCatProactiveCmd(Handler h, int what, Object obj) { 503 mCatProCmdRegistrant = new Registrant (h, what, obj); 504 } 505 506 @Override unSetOnCatProactiveCmd(Handler h)507 public void unSetOnCatProactiveCmd(Handler h) { 508 if (mCatProCmdRegistrant != null && mCatProCmdRegistrant.getHandler() == h) { 509 mCatProCmdRegistrant.clear(); 510 mCatProCmdRegistrant = null; 511 } 512 } 513 514 @Override setOnCatEvent(Handler h, int what, Object obj)515 public void setOnCatEvent(Handler h, int what, Object obj) { 516 mCatEventRegistrant = new Registrant (h, what, obj); 517 } 518 519 @Override unSetOnCatEvent(Handler h)520 public void unSetOnCatEvent(Handler h) { 521 if (mCatEventRegistrant != null && mCatEventRegistrant.getHandler() == h) { 522 mCatEventRegistrant.clear(); 523 mCatEventRegistrant = null; 524 } 525 } 526 527 @Override setOnCatCallSetUp(Handler h, int what, Object obj)528 public void setOnCatCallSetUp(Handler h, int what, Object obj) { 529 mCatCallSetUpRegistrant = new Registrant (h, what, obj); 530 } 531 532 @Override unSetOnCatCallSetUp(Handler h)533 public void unSetOnCatCallSetUp(Handler h) { 534 if (mCatCallSetUpRegistrant != null && mCatCallSetUpRegistrant.getHandler() == h) { 535 mCatCallSetUpRegistrant.clear(); 536 mCatCallSetUpRegistrant = null; 537 } 538 } 539 540 @Override setOnIccSmsFull(Handler h, int what, Object obj)541 public void setOnIccSmsFull(Handler h, int what, Object obj) { 542 mIccSmsFullRegistrant = new Registrant (h, what, obj); 543 } 544 545 @Override unSetOnIccSmsFull(Handler h)546 public void unSetOnIccSmsFull(Handler h) { 547 if (mIccSmsFullRegistrant != null && mIccSmsFullRegistrant.getHandler() == h) { 548 mIccSmsFullRegistrant.clear(); 549 mIccSmsFullRegistrant = null; 550 } 551 } 552 553 @Override registerForIccRefresh(Handler h, int what, Object obj)554 public void registerForIccRefresh(Handler h, int what, Object obj) { 555 mIccRefreshRegistrants.addUnique(h, what, obj); 556 } 557 @Override setOnIccRefresh(Handler h, int what, Object obj)558 public void setOnIccRefresh(Handler h, int what, Object obj) { 559 registerForIccRefresh(h, what, obj); 560 } 561 562 @Override setEmergencyCallbackMode(Handler h, int what, Object obj)563 public void setEmergencyCallbackMode(Handler h, int what, Object obj) { 564 mEmergencyCallbackModeRegistrant = new Registrant (h, what, obj); 565 } 566 567 @Override unregisterForIccRefresh(Handler h)568 public void unregisterForIccRefresh(Handler h) { 569 mIccRefreshRegistrants.remove(h); 570 } 571 @Override unsetOnIccRefresh(Handler h)572 public void unsetOnIccRefresh(Handler h) { 573 unregisterForIccRefresh(h); 574 } 575 576 @Override setOnCallRing(Handler h, int what, Object obj)577 public void setOnCallRing(Handler h, int what, Object obj) { 578 mRingRegistrant = new Registrant (h, what, obj); 579 } 580 581 @Override unSetOnCallRing(Handler h)582 public void unSetOnCallRing(Handler h) { 583 if (mRingRegistrant != null && mRingRegistrant.getHandler() == h) { 584 mRingRegistrant.clear(); 585 mRingRegistrant = null; 586 } 587 } 588 589 @Override setOnSs(Handler h, int what, Object obj)590 public void setOnSs(Handler h, int what, Object obj) { 591 mSsRegistrant = new Registrant (h, what, obj); 592 } 593 594 @Override unSetOnSs(Handler h)595 public void unSetOnSs(Handler h) { 596 mSsRegistrant.clear(); 597 } 598 599 @Override setOnCatCcAlphaNotify(Handler h, int what, Object obj)600 public void setOnCatCcAlphaNotify(Handler h, int what, Object obj) { 601 mCatCcAlphaRegistrant = new Registrant (h, what, obj); 602 } 603 604 @Override unSetOnCatCcAlphaNotify(Handler h)605 public void unSetOnCatCcAlphaNotify(Handler h) { 606 mCatCcAlphaRegistrant.clear(); 607 } 608 609 @Override setOnRegistrationFailed(Handler h, int what, Object obj)610 public void setOnRegistrationFailed(Handler h, int what, Object obj) { 611 mRegistrationFailedRegistrant = new Registrant(h, what, obj); 612 } 613 614 @Override unSetOnRegistrationFailed(Handler h)615 public void unSetOnRegistrationFailed(Handler h) { 616 mRegistrationFailedRegistrant.clear(); 617 } 618 619 @Override registerForInCallVoicePrivacyOn(Handler h, int what, Object obj)620 public void registerForInCallVoicePrivacyOn(Handler h, int what, Object obj) { 621 mVoicePrivacyOnRegistrants.addUnique(h, what, obj); 622 } 623 624 @Override unregisterForInCallVoicePrivacyOn(Handler h)625 public void unregisterForInCallVoicePrivacyOn(Handler h){ 626 mVoicePrivacyOnRegistrants.remove(h); 627 } 628 629 @Override registerForInCallVoicePrivacyOff(Handler h, int what, Object obj)630 public void registerForInCallVoicePrivacyOff(Handler h, int what, Object obj) { 631 mVoicePrivacyOffRegistrants.addUnique(h, what, obj); 632 } 633 634 @Override unregisterForInCallVoicePrivacyOff(Handler h)635 public void unregisterForInCallVoicePrivacyOff(Handler h){ 636 mVoicePrivacyOffRegistrants.remove(h); 637 } 638 639 @Override setOnRestrictedStateChanged(Handler h, int what, Object obj)640 public void setOnRestrictedStateChanged(Handler h, int what, Object obj) { 641 mRestrictedStateRegistrant = new Registrant (h, what, obj); 642 } 643 644 @Override unSetOnRestrictedStateChanged(Handler h)645 public void unSetOnRestrictedStateChanged(Handler h) { 646 if (mRestrictedStateRegistrant != null && mRestrictedStateRegistrant.getHandler() == h) { 647 mRestrictedStateRegistrant.clear(); 648 mRestrictedStateRegistrant = null; 649 } 650 } 651 652 @Override registerForDisplayInfo(Handler h, int what, Object obj)653 public void registerForDisplayInfo(Handler h, int what, Object obj) { 654 mDisplayInfoRegistrants.addUnique(h, what, obj); 655 } 656 657 @Override unregisterForDisplayInfo(Handler h)658 public void unregisterForDisplayInfo(Handler h) { 659 mDisplayInfoRegistrants.remove(h); 660 } 661 662 @Override registerForCallWaitingInfo(Handler h, int what, Object obj)663 public void registerForCallWaitingInfo(Handler h, int what, Object obj) { 664 mCallWaitingInfoRegistrants.addUnique(h, what, obj); 665 } 666 667 @Override unregisterForCallWaitingInfo(Handler h)668 public void unregisterForCallWaitingInfo(Handler h) { 669 mCallWaitingInfoRegistrants.remove(h); 670 } 671 672 @Override registerForSignalInfo(Handler h, int what, Object obj)673 public void registerForSignalInfo(Handler h, int what, Object obj) { 674 mSignalInfoRegistrants.addUnique(h, what, obj); 675 } 676 677 @Override unregisterForSignalInfo(Handler h)678 public void unregisterForSignalInfo(Handler h) { 679 mSignalInfoRegistrants.remove(h); 680 } 681 682 @Override registerForCdmaOtaProvision(Handler h,int what, Object obj)683 public void registerForCdmaOtaProvision(Handler h,int what, Object obj){ 684 mOtaProvisionRegistrants.addUnique(h, what, obj); 685 } 686 687 @Override unregisterForCdmaOtaProvision(Handler h)688 public void unregisterForCdmaOtaProvision(Handler h){ 689 mOtaProvisionRegistrants.remove(h); 690 } 691 692 @Override registerForNumberInfo(Handler h,int what, Object obj)693 public void registerForNumberInfo(Handler h,int what, Object obj) { 694 mNumberInfoRegistrants.addUnique(h, what, obj); 695 } 696 697 @Override unregisterForNumberInfo(Handler h)698 public void unregisterForNumberInfo(Handler h){ 699 mNumberInfoRegistrants.remove(h); 700 } 701 702 @Override registerForRedirectedNumberInfo(Handler h,int what, Object obj)703 public void registerForRedirectedNumberInfo(Handler h,int what, Object obj) { 704 mRedirNumInfoRegistrants.addUnique(h, what, obj); 705 } 706 707 @Override unregisterForRedirectedNumberInfo(Handler h)708 public void unregisterForRedirectedNumberInfo(Handler h) { 709 mRedirNumInfoRegistrants.remove(h); 710 } 711 712 @Override registerForLineControlInfo(Handler h, int what, Object obj)713 public void registerForLineControlInfo(Handler h, int what, Object obj) { 714 mLineControlInfoRegistrants.addUnique(h, what, obj); 715 } 716 717 @Override unregisterForLineControlInfo(Handler h)718 public void unregisterForLineControlInfo(Handler h) { 719 mLineControlInfoRegistrants.remove(h); 720 } 721 722 @Override registerFoT53ClirlInfo(Handler h,int what, Object obj)723 public void registerFoT53ClirlInfo(Handler h,int what, Object obj) { 724 mT53ClirInfoRegistrants.addUnique(h, what, obj); 725 } 726 727 @Override unregisterForT53ClirInfo(Handler h)728 public void unregisterForT53ClirInfo(Handler h) { 729 mT53ClirInfoRegistrants.remove(h); 730 } 731 732 @Override registerForT53AudioControlInfo(Handler h,int what, Object obj)733 public void registerForT53AudioControlInfo(Handler h,int what, Object obj) { 734 mT53AudCntrlInfoRegistrants.addUnique(h, what, obj); 735 } 736 737 @Override unregisterForT53AudioControlInfo(Handler h)738 public void unregisterForT53AudioControlInfo(Handler h) { 739 mT53AudCntrlInfoRegistrants.remove(h); 740 } 741 742 @Override registerForRingbackTone(Handler h, int what, Object obj)743 public void registerForRingbackTone(Handler h, int what, Object obj) { 744 mRingbackToneRegistrants.addUnique(h, what, obj); 745 } 746 747 @Override unregisterForRingbackTone(Handler h)748 public void unregisterForRingbackTone(Handler h) { 749 mRingbackToneRegistrants.remove(h); 750 } 751 752 @Override registerForResendIncallMute(Handler h, int what, Object obj)753 public void registerForResendIncallMute(Handler h, int what, Object obj) { 754 mResendIncallMuteRegistrants.addUnique(h, what, obj); 755 } 756 757 @Override unregisterForResendIncallMute(Handler h)758 public void unregisterForResendIncallMute(Handler h) { 759 mResendIncallMuteRegistrants.remove(h); 760 } 761 762 @Override registerForCdmaSubscriptionChanged(Handler h, int what, Object obj)763 public void registerForCdmaSubscriptionChanged(Handler h, int what, Object obj) { 764 mCdmaSubscriptionChangedRegistrants.addUnique(h, what, obj); 765 } 766 767 @Override unregisterForCdmaSubscriptionChanged(Handler h)768 public void unregisterForCdmaSubscriptionChanged(Handler h) { 769 mCdmaSubscriptionChangedRegistrants.remove(h); 770 } 771 772 @Override registerForCdmaPrlChanged(Handler h, int what, Object obj)773 public void registerForCdmaPrlChanged(Handler h, int what, Object obj) { 774 mCdmaPrlChangedRegistrants.addUnique(h, what, obj); 775 } 776 777 @Override unregisterForCdmaPrlChanged(Handler h)778 public void unregisterForCdmaPrlChanged(Handler h) { 779 mCdmaPrlChangedRegistrants.remove(h); 780 } 781 782 @Override registerForExitEmergencyCallbackMode(Handler h, int what, Object obj)783 public void registerForExitEmergencyCallbackMode(Handler h, int what, Object obj) { 784 mExitEmergencyCallbackModeRegistrants.addUnique(h, what, obj); 785 } 786 787 @Override unregisterForExitEmergencyCallbackMode(Handler h)788 public void unregisterForExitEmergencyCallbackMode(Handler h) { 789 mExitEmergencyCallbackModeRegistrants.remove(h); 790 } 791 792 @Override registerForHardwareConfigChanged(Handler h, int what, Object obj)793 public void registerForHardwareConfigChanged(Handler h, int what, Object obj) { 794 mHardwareConfigChangeRegistrants.addUnique(h, what, obj); 795 } 796 797 @Override unregisterForHardwareConfigChanged(Handler h)798 public void unregisterForHardwareConfigChanged(Handler h) { 799 mHardwareConfigChangeRegistrants.remove(h); 800 } 801 802 @Override registerForNetworkScanResult(Handler h, int what, Object obj)803 public void registerForNetworkScanResult(Handler h, int what, Object obj) { 804 mRilNetworkScanResultRegistrants.addUnique(h, what, obj); 805 } 806 807 @Override unregisterForNetworkScanResult(Handler h)808 public void unregisterForNetworkScanResult(Handler h) { 809 mRilNetworkScanResultRegistrants.remove(h); 810 } 811 812 /** 813 * {@inheritDoc} 814 */ 815 @Override registerForRilConnected(Handler h, int what, Object obj)816 public void registerForRilConnected(Handler h, int what, Object obj) { 817 mRilConnectedRegistrants.addUnique(h, what, obj); 818 if (mRilVersion != -1) { 819 Message.obtain(h, what, new AsyncResult(obj, new Integer(mRilVersion), null)) 820 .sendToTarget(); 821 } 822 } 823 824 @Override unregisterForRilConnected(Handler h)825 public void unregisterForRilConnected(Handler h) { 826 mRilConnectedRegistrants.remove(h); 827 } 828 registerForSubscriptionStatusChanged(Handler h, int what, Object obj)829 public void registerForSubscriptionStatusChanged(Handler h, int what, Object obj) { 830 mSubscriptionStatusRegistrants.addUnique(h, what, obj); 831 } 832 unregisterForSubscriptionStatusChanged(Handler h)833 public void unregisterForSubscriptionStatusChanged(Handler h) { 834 mSubscriptionStatusRegistrants.remove(h); 835 } 836 837 @Override registerForEmergencyNumberList(Handler h, int what, Object obj)838 public void registerForEmergencyNumberList(Handler h, int what, Object obj) { 839 mEmergencyNumberListRegistrants.addUnique(h, what, obj); 840 // Notify the last emergency number list from radio to new registrants because they may 841 // miss the latest indication (e.g. constructed in a delay after HAL is registrated). 842 List<EmergencyNumber> lastEmergencyNumberListIndication = 843 getLastEmergencyNumberListIndication(); 844 if (lastEmergencyNumberListIndication != null) { 845 mEmergencyNumberListRegistrants.notifyRegistrants(new AsyncResult( 846 null, lastEmergencyNumberListIndication, null)); 847 } 848 } 849 850 @Override unregisterForEmergencyNumberList(Handler h)851 public void unregisterForEmergencyNumberList(Handler h) { 852 mEmergencyNumberListRegistrants.remove(h); 853 } 854 855 //***** Protected Methods 856 /** 857 * Store new RadioState and send notification based on the changes 858 * 859 * This function is called only by RIL.java when receiving unsolicited 860 * RIL_UNSOL_RESPONSE_RADIO_STATE_CHANGED 861 * 862 * RadioState has 3 values : RADIO_OFF, RADIO_UNAVAILABLE, RADIO_ON. 863 * 864 * @param newState new RadioState decoded from RIL_UNSOL_RADIO_STATE_CHANGED 865 * @param forceNotifyRegistrants boolean indicating if registrants should be notified even if 866 * there is no change in state 867 */ setRadioState(int newState, boolean forceNotifyRegistrants)868 protected void setRadioState(int newState, boolean forceNotifyRegistrants) { 869 int oldState; 870 871 synchronized (mStateMonitor) { 872 oldState = mState; 873 mState = newState; 874 875 if (oldState == mState && !forceNotifyRegistrants) { 876 // no state transition 877 return; 878 } 879 880 mRadioStateChangedRegistrants.notifyRegistrants(); 881 882 if (mState != TelephonyManager.RADIO_POWER_UNAVAILABLE 883 && oldState == TelephonyManager.RADIO_POWER_UNAVAILABLE) { 884 mAvailRegistrants.notifyRegistrants(); 885 } 886 887 if (mState == TelephonyManager.RADIO_POWER_UNAVAILABLE 888 && oldState != TelephonyManager.RADIO_POWER_UNAVAILABLE) { 889 mNotAvailRegistrants.notifyRegistrants(); 890 } 891 892 if (mState == TelephonyManager.RADIO_POWER_ON 893 && oldState != TelephonyManager.RADIO_POWER_ON) { 894 mOnRegistrants.notifyRegistrants(); 895 } 896 897 if ((mState == TelephonyManager.RADIO_POWER_OFF 898 || mState == TelephonyManager.RADIO_POWER_UNAVAILABLE) 899 && (oldState == TelephonyManager.RADIO_POWER_ON)) { 900 mOffOrNotAvailRegistrants.notifyRegistrants(); 901 mLastBarringInfo = new BarringInfo(); 902 } 903 } 904 } 905 cacheEmergencyNumberListIndication( List<EmergencyNumber> emergencyNumberListIndication)906 protected void cacheEmergencyNumberListIndication( 907 List<EmergencyNumber> emergencyNumberListIndication) { 908 synchronized (mLastEmergencyNumberListIndicationLock) { 909 mLastEmergencyNumberListIndication.clear(); 910 mLastEmergencyNumberListIndication.addAll(emergencyNumberListIndication); 911 } 912 } 913 getLastEmergencyNumberListIndication()914 private List<EmergencyNumber> getLastEmergencyNumberListIndication() { 915 synchronized (mLastEmergencyNumberListIndicationLock) { 916 return new ArrayList<>(mLastEmergencyNumberListIndication); 917 } 918 } 919 920 /** {@inheritDoc} */ 921 @Override getLastBarringInfo()922 public @NonNull BarringInfo getLastBarringInfo() { 923 return mLastBarringInfo; 924 } 925 926 /** 927 * {@inheritDoc} 928 */ 929 @Override registerForCellInfoList(Handler h, int what, Object obj)930 public void registerForCellInfoList(Handler h, int what, Object obj) { 931 mRilCellInfoListRegistrants.addUnique(h, what, obj); 932 } 933 @Override unregisterForCellInfoList(Handler h)934 public void unregisterForCellInfoList(Handler h) { 935 mRilCellInfoListRegistrants.remove(h); 936 } 937 938 @Override registerForPhysicalChannelConfiguration(Handler h, int what, Object obj)939 public void registerForPhysicalChannelConfiguration(Handler h, int what, Object obj) { 940 mPhysicalChannelConfigurationRegistrants.addUnique(h, what, obj); 941 } 942 943 @Override unregisterForPhysicalChannelConfiguration(Handler h)944 public void unregisterForPhysicalChannelConfiguration(Handler h) { 945 mPhysicalChannelConfigurationRegistrants.remove(h); 946 } 947 948 @Override registerForSrvccStateChanged(Handler h, int what, Object obj)949 public void registerForSrvccStateChanged(Handler h, int what, Object obj) { 950 mSrvccStateRegistrants.addUnique(h, what, obj); 951 } 952 953 @Override unregisterForSrvccStateChanged(Handler h)954 public void unregisterForSrvccStateChanged(Handler h) { 955 mSrvccStateRegistrants.remove(h); 956 } 957 958 @Override testingEmergencyCall()959 public void testingEmergencyCall() {} 960 961 @Override getRilVersion()962 public int getRilVersion() { 963 return mRilVersion; 964 } 965 setUiccSubscription(int slotId, int appIndex, int subId, int subStatus, Message response)966 public void setUiccSubscription(int slotId, int appIndex, int subId, int subStatus, 967 Message response) { 968 } 969 setDataAllowed(boolean allowed, Message response)970 public void setDataAllowed(boolean allowed, Message response) { 971 } 972 973 @Override requestShutdown(Message result)974 public void requestShutdown(Message result) { 975 } 976 977 @Override getRadioCapability(Message result)978 public void getRadioCapability(Message result) { 979 } 980 981 @Override setRadioCapability(RadioCapability rc, Message response)982 public void setRadioCapability(RadioCapability rc, Message response) { 983 } 984 985 @Override registerForRadioCapabilityChanged(Handler h, int what, Object obj)986 public void registerForRadioCapabilityChanged(Handler h, int what, Object obj) { 987 mPhoneRadioCapabilityChangedRegistrants.addUnique(h, what, obj); 988 } 989 990 @Override unregisterForRadioCapabilityChanged(Handler h)991 public void unregisterForRadioCapabilityChanged(Handler h) { 992 mPhoneRadioCapabilityChangedRegistrants.remove(h); 993 } 994 995 @Override registerForLceInfo(Handler h, int what, Object obj)996 public void registerForLceInfo(Handler h, int what, Object obj) { 997 synchronized (mStateMonitor) { 998 mLceInfoRegistrants.addUnique(h, what, obj); 999 } 1000 } 1001 1002 @Override unregisterForLceInfo(Handler h)1003 public void unregisterForLceInfo(Handler h) { 1004 synchronized (mStateMonitor) { 1005 mLceInfoRegistrants.remove(h); 1006 } 1007 } 1008 1009 @Override registerForModemReset(Handler h, int what, Object obj)1010 public void registerForModemReset(Handler h, int what, Object obj) { 1011 mModemResetRegistrants.addUnique(h, what, obj); 1012 } 1013 1014 @Override unregisterForModemReset(Handler h)1015 public void unregisterForModemReset(Handler h) { 1016 mModemResetRegistrants.remove(h); 1017 } 1018 1019 @Override registerForPcoData(Handler h, int what, Object obj)1020 public void registerForPcoData(Handler h, int what, Object obj) { 1021 mPcoDataRegistrants.addUnique(h, what, obj); 1022 } 1023 1024 @Override unregisterForPcoData(Handler h)1025 public void unregisterForPcoData(Handler h) { 1026 mPcoDataRegistrants.remove(h); 1027 } 1028 1029 @Override registerForCarrierInfoForImsiEncryption(Handler h, int what, Object obj)1030 public void registerForCarrierInfoForImsiEncryption(Handler h, int what, Object obj) { 1031 mCarrierInfoForImsiEncryptionRegistrants.addUnique(h, what, obj); 1032 } 1033 1034 @Override unregisterForCarrierInfoForImsiEncryption(Handler h)1035 public void unregisterForCarrierInfoForImsiEncryption(Handler h) { 1036 mCarrierInfoForImsiEncryptionRegistrants.remove(h); 1037 } 1038 1039 @Override registerForNattKeepaliveStatus(Handler h, int what, Object obj)1040 public void registerForNattKeepaliveStatus(Handler h, int what, Object obj) { 1041 synchronized (mStateMonitor) { 1042 mNattKeepaliveStatusRegistrants.addUnique(h, what, obj); 1043 } 1044 } 1045 1046 @Override unregisterForNattKeepaliveStatus(Handler h)1047 public void unregisterForNattKeepaliveStatus(Handler h) { 1048 synchronized (mStateMonitor) { 1049 mNattKeepaliveStatusRegistrants.remove(h); 1050 } 1051 } 1052 1053 /** 1054 * Registers the handler for RIL_UNSOL_UICC_APPLICATIONS_ENABLEMENT_CHANGED events. 1055 * 1056 * @param h Handler for notification message. 1057 * @param what User-defined message code. 1058 * @param obj User object. 1059 */ 1060 @Override registerUiccApplicationEnablementChanged(Handler h, int what, Object obj)1061 public void registerUiccApplicationEnablementChanged(Handler h, int what, Object obj) { 1062 mUiccApplicationsEnablementRegistrants.addUnique(h, what, obj); 1063 } 1064 1065 /** 1066 * Unregisters the handler for RIL_UNSOL_UICC_APPLICATIONS_ENABLEMENT_CHANGED events. 1067 * 1068 * @param h Handler for notification message. 1069 */ 1070 @Override unregisterUiccApplicationEnablementChanged(Handler h)1071 public void unregisterUiccApplicationEnablementChanged(Handler h) { 1072 mUiccApplicationsEnablementRegistrants.remove(h); 1073 } 1074 1075 /** 1076 * Registers the handler for RIL_UNSOL_BARRING_INFO_CHANGED events. 1077 * 1078 * @param h Handler for notification message. 1079 * @param what User-defined message code. 1080 * @param obj User object. 1081 */ 1082 @Override registerForBarringInfoChanged(Handler h, int what, Object obj)1083 public void registerForBarringInfoChanged(Handler h, int what, Object obj) { 1084 mBarringInfoChangedRegistrants.addUnique(h, what, obj); 1085 } 1086 1087 /** 1088 * Unregisters the handler for RIL_UNSOL_BARRING_INFO_CHANGED events. 1089 * 1090 * @param h Handler for notification message. 1091 */ 1092 @Override unregisterForBarringInfoChanged(Handler h)1093 public void unregisterForBarringInfoChanged(Handler h) { 1094 mBarringInfoChangedRegistrants.remove(h); 1095 } 1096 1097 @Override registerForSimPhonebookChanged(Handler h, int what, Object obj)1098 public void registerForSimPhonebookChanged(Handler h, int what, Object obj) { 1099 mSimPhonebookChangedRegistrants.addUnique(h, what, obj); 1100 } 1101 1102 @Override unregisterForSimPhonebookChanged(Handler h)1103 public void unregisterForSimPhonebookChanged(Handler h) { 1104 mSimPhonebookChangedRegistrants.remove(h); 1105 } 1106 1107 @Override registerForSimPhonebookRecordsReceived(Handler h, int what, Object obj)1108 public void registerForSimPhonebookRecordsReceived(Handler h, int what, Object obj) { 1109 mSimPhonebookRecordsReceivedRegistrants.addUnique(h, what, obj); 1110 } 1111 1112 @Override unregisterForSimPhonebookRecordsReceived(Handler h)1113 public void unregisterForSimPhonebookRecordsReceived(Handler h) { 1114 mSimPhonebookRecordsReceivedRegistrants.remove(h); 1115 } 1116 1117 @Override getSimPhonebookRecords(Message result)1118 public void getSimPhonebookRecords(Message result) { 1119 } 1120 1121 @Override getSimPhonebookCapacity(Message result)1122 public void getSimPhonebookCapacity(Message result) { 1123 } 1124 1125 @Override updateSimPhonebookRecord(SimPhonebookRecord phonebookRecord, Message result)1126 public void updateSimPhonebookRecord(SimPhonebookRecord phonebookRecord, Message result) { 1127 } 1128 1129 /** 1130 * Register for Emergency network scan result. 1131 * 1132 * @param h Handler for notification message. 1133 * @param what User-defined message code. 1134 * @param obj User object. 1135 */ 1136 @Override registerForEmergencyNetworkScan(Handler h, int what, Object obj)1137 public void registerForEmergencyNetworkScan(Handler h, int what, Object obj) { 1138 mEmergencyNetworkScanRegistrants.add(h, what, obj); 1139 } 1140 1141 /** 1142 * Unregister for Emergency network scan result. 1143 * 1144 * @param h Handler to be removed from the registrant list. 1145 */ 1146 @Override unregisterForEmergencyNetworkScan(Handler h)1147 public void unregisterForEmergencyNetworkScan(Handler h) { 1148 mEmergencyNetworkScanRegistrants.remove(h); 1149 } 1150 1151 @Override registerForConnectionSetupFailure(Handler h, int what, Object obj)1152 public void registerForConnectionSetupFailure(Handler h, int what, Object obj) { 1153 mConnectionSetupFailureRegistrants.addUnique(h, what, obj); 1154 } 1155 1156 @Override unregisterForConnectionSetupFailure(Handler h)1157 public void unregisterForConnectionSetupFailure(Handler h) { 1158 mConnectionSetupFailureRegistrants.remove(h); 1159 } 1160 1161 @Override registerForNotifyAnbr(Handler h, int what, Object obj)1162 public void registerForNotifyAnbr(Handler h, int what, Object obj) { 1163 mNotifyAnbrRegistrants.addUnique(h, what, obj); 1164 } 1165 1166 @Override unregisterForNotifyAnbr(Handler h)1167 public void unregisterForNotifyAnbr(Handler h) { 1168 mNotifyAnbrRegistrants.remove(h); 1169 } 1170 1171 @Override registerForTriggerImsDeregistration(Handler h, int what, Object obj)1172 public void registerForTriggerImsDeregistration(Handler h, int what, Object obj) { 1173 mTriggerImsDeregistrationRegistrants.add(h, what, obj); 1174 } 1175 1176 @Override unregisterForTriggerImsDeregistration(Handler h)1177 public void unregisterForTriggerImsDeregistration(Handler h) { 1178 mTriggerImsDeregistrationRegistrants.remove(h); 1179 } 1180 1181 /** 1182 * Register to listen for the changes in the primary IMEI with respect to the sim slot. 1183 */ 1184 @Override registerForImeiMappingChanged(Handler h, int what, Object obj)1185 public void registerForImeiMappingChanged(Handler h, int what, Object obj) { 1186 mImeiInfoRegistrants.add(h, what, obj); 1187 } 1188 1189 @Override registerForCellularIdentifierDisclosures(Handler h, int what, Object obj)1190 public void registerForCellularIdentifierDisclosures(Handler h, int what, Object obj) { 1191 mCellularIdentifierDisclosedRegistrants.add(h, what, obj); 1192 } 1193 1194 @Override unregisterForCellularIdentifierDisclosures(Handler h)1195 public void unregisterForCellularIdentifierDisclosures(Handler h) { 1196 mCellularIdentifierDisclosedRegistrants.remove(h); 1197 } 1198 1199 @Override registerForSecurityAlgorithmUpdates(Handler h, int what, Object obj)1200 public void registerForSecurityAlgorithmUpdates(Handler h, int what, Object obj) { 1201 mSecurityAlgorithmUpdatedRegistrants.add(h, what, obj); 1202 } 1203 1204 @Override unregisterForSecurityAlgorithmUpdates(Handler h)1205 public void unregisterForSecurityAlgorithmUpdates(Handler h) { 1206 mSecurityAlgorithmUpdatedRegistrants.remove(h); 1207 } 1208 } 1209