1 /* 2 * Copyright (C) 2006 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 android.telephony; 18 19 import android.os.Bundle; 20 import android.os.Parcel; 21 import android.os.Parcelable; 22 import android.telephony.Rlog; 23 24 /** 25 * Contains phone state and service related information. 26 * 27 * The following phone information is included in returned ServiceState: 28 * 29 * <ul> 30 * <li>Service state: IN_SERVICE, OUT_OF_SERVICE, EMERGENCY_ONLY, POWER_OFF 31 * <li>Roaming indicator 32 * <li>Operator name, short name and numeric id 33 * <li>Network selection mode 34 * </ul> 35 */ 36 public class ServiceState implements Parcelable { 37 38 static final String LOG_TAG = "PHONE"; 39 static final boolean DBG = true; 40 41 /** 42 * Normal operation condition, the phone is registered 43 * with an operator either in home network or in roaming. 44 */ 45 public static final int STATE_IN_SERVICE = 0; 46 47 /** 48 * Phone is not registered with any operator, the phone 49 * can be currently searching a new operator to register to, or not 50 * searching to registration at all, or registration is denied, or radio 51 * signal is not available. 52 */ 53 public static final int STATE_OUT_OF_SERVICE = 1; 54 55 /** 56 * The phone is registered and locked. Only emergency numbers are allowed. {@more} 57 */ 58 public static final int STATE_EMERGENCY_ONLY = 2; 59 60 /** 61 * Radio of telephony is explicitly powered off. 62 */ 63 public static final int STATE_POWER_OFF = 3; 64 65 /** 66 * RIL level registration state values from ril.h 67 * ((const char **)response)[0] is registration state 0-6, 68 * 0 - Not registered, MT is not currently searching 69 * a new operator to register 70 * 1 - Registered, home network 71 * 2 - Not registered, but MT is currently searching 72 * a new operator to register 73 * 3 - Registration denied 74 * 4 - Unknown 75 * 5 - Registered, roaming 76 * 10 - Same as 0, but indicates that emergency calls 77 * are enabled. 78 * 12 - Same as 2, but indicates that emergency calls 79 * are enabled. 80 * 13 - Same as 3, but indicates that emergency calls 81 * are enabled. 82 * 14 - Same as 4, but indicates that emergency calls 83 * are enabled. 84 * @hide 85 */ 86 public static final int RIL_REG_STATE_NOT_REG = 0; 87 /** @hide */ 88 public static final int RIL_REG_STATE_HOME = 1; 89 /** @hide */ 90 public static final int RIL_REG_STATE_SEARCHING = 2; 91 /** @hide */ 92 public static final int RIL_REG_STATE_DENIED = 3; 93 /** @hide */ 94 public static final int RIL_REG_STATE_UNKNOWN = 4; 95 /** @hide */ 96 public static final int RIL_REG_STATE_ROAMING = 5; 97 /** @hide */ 98 public static final int RIL_REG_STATE_NOT_REG_EMERGENCY_CALL_ENABLED = 10; 99 /** @hide */ 100 public static final int RIL_REG_STATE_SEARCHING_EMERGENCY_CALL_ENABLED = 12; 101 /** @hide */ 102 public static final int RIL_REG_STATE_DENIED_EMERGENCY_CALL_ENABLED = 13; 103 /** @hide */ 104 public static final int RIL_REG_STATE_UNKNOWN_EMERGENCY_CALL_ENABLED = 14; 105 106 /** 107 * Available radio technologies for GSM, UMTS and CDMA. 108 * Duplicates the constants from hardware/radio/include/ril.h 109 * This should only be used by agents working with the ril. Others 110 * should use the equivalent TelephonyManager.NETWORK_TYPE_* 111 */ 112 /** @hide */ 113 public static final int RIL_RADIO_TECHNOLOGY_UNKNOWN = 0; 114 /** @hide */ 115 public static final int RIL_RADIO_TECHNOLOGY_GPRS = 1; 116 /** @hide */ 117 public static final int RIL_RADIO_TECHNOLOGY_EDGE = 2; 118 /** @hide */ 119 public static final int RIL_RADIO_TECHNOLOGY_UMTS = 3; 120 /** @hide */ 121 public static final int RIL_RADIO_TECHNOLOGY_IS95A = 4; 122 /** @hide */ 123 public static final int RIL_RADIO_TECHNOLOGY_IS95B = 5; 124 /** @hide */ 125 public static final int RIL_RADIO_TECHNOLOGY_1xRTT = 6; 126 /** @hide */ 127 public static final int RIL_RADIO_TECHNOLOGY_EVDO_0 = 7; 128 /** @hide */ 129 public static final int RIL_RADIO_TECHNOLOGY_EVDO_A = 8; 130 /** @hide */ 131 public static final int RIL_RADIO_TECHNOLOGY_HSDPA = 9; 132 /** @hide */ 133 public static final int RIL_RADIO_TECHNOLOGY_HSUPA = 10; 134 /** @hide */ 135 public static final int RIL_RADIO_TECHNOLOGY_HSPA = 11; 136 /** @hide */ 137 public static final int RIL_RADIO_TECHNOLOGY_EVDO_B = 12; 138 /** @hide */ 139 public static final int RIL_RADIO_TECHNOLOGY_EHRPD = 13; 140 /** @hide */ 141 public static final int RIL_RADIO_TECHNOLOGY_LTE = 14; 142 /** @hide */ 143 public static final int RIL_RADIO_TECHNOLOGY_HSPAP = 15; 144 /** 145 * GSM radio technology only supports voice. It does not support data. 146 * @hide 147 */ 148 public static final int RIL_RADIO_TECHNOLOGY_GSM = 16; 149 /** @hide */ 150 public static final int RIL_RADIO_TECHNOLOGY_TD_SCDMA = 17; 151 /** 152 * IWLAN 153 * @hide 154 */ 155 public static final int RIL_RADIO_TECHNOLOGY_IWLAN = 18; 156 /** 157 * Available registration states for GSM, UMTS and CDMA. 158 */ 159 /** @hide */ 160 public static final int REGISTRATION_STATE_NOT_REGISTERED_AND_NOT_SEARCHING = 0; 161 /** @hide */ 162 public static final int REGISTRATION_STATE_HOME_NETWORK = 1; 163 /** @hide */ 164 public static final int REGISTRATION_STATE_NOT_REGISTERED_AND_SEARCHING = 2; 165 /** @hide */ 166 public static final int REGISTRATION_STATE_REGISTRATION_DENIED = 3; 167 /** @hide */ 168 public static final int REGISTRATION_STATE_UNKNOWN = 4; 169 /** @hide */ 170 public static final int REGISTRATION_STATE_ROAMING = 5; 171 172 private int mVoiceRegState = STATE_OUT_OF_SERVICE; 173 private int mDataRegState = STATE_OUT_OF_SERVICE; 174 175 /** 176 * Roaming type 177 * HOME : in home network 178 * @hide 179 */ 180 public static final int ROAMING_TYPE_NOT_ROAMING = 0; 181 /** 182 * Roaming type 183 * UNKNOWN : in a roaming network, but we can not tell if it's domestic or international 184 * @hide 185 */ 186 public static final int ROAMING_TYPE_UNKNOWN = 1; 187 /** 188 * Roaming type 189 * DOMESTIC : in domestic roaming network 190 * @hide 191 */ 192 public static final int ROAMING_TYPE_DOMESTIC = 2; 193 /** 194 * Roaming type 195 * INTERNATIONAL : in international roaming network 196 * @hide 197 */ 198 public static final int ROAMING_TYPE_INTERNATIONAL = 3; 199 200 private int mVoiceRoamingType; 201 private int mDataRoamingType; 202 private String mVoiceOperatorAlphaLong; 203 private String mVoiceOperatorAlphaShort; 204 private String mVoiceOperatorNumeric; 205 private String mDataOperatorAlphaLong; 206 private String mDataOperatorAlphaShort; 207 private String mDataOperatorNumeric; 208 private boolean mIsManualNetworkSelection; 209 210 private boolean mIsEmergencyOnly; 211 212 private int mRilVoiceRadioTechnology; 213 private int mRilDataRadioTechnology; 214 215 private boolean mCssIndicator; 216 private int mNetworkId; 217 private int mSystemId; 218 private int mCdmaRoamingIndicator; 219 private int mCdmaDefaultRoamingIndicator; 220 private int mCdmaEriIconIndex; 221 private int mCdmaEriIconMode; 222 223 private boolean mIsDataRoamingFromRegistration; 224 225 /** 226 * get String description of roaming type 227 * @hide 228 */ getRoamingLogString(int roamingType)229 public static final String getRoamingLogString(int roamingType) { 230 switch (roamingType) { 231 case ROAMING_TYPE_NOT_ROAMING: 232 return "home"; 233 234 case ROAMING_TYPE_UNKNOWN: 235 return "roaming"; 236 237 case ROAMING_TYPE_DOMESTIC: 238 return "Domestic Roaming"; 239 240 case ROAMING_TYPE_INTERNATIONAL: 241 return "International Roaming"; 242 243 default: 244 return "UNKNOWN"; 245 } 246 } 247 248 /** 249 * Create a new ServiceState from a intent notifier Bundle 250 * 251 * This method is used by PhoneStateIntentReceiver and maybe by 252 * external applications. 253 * 254 * @param m Bundle from intent notifier 255 * @return newly created ServiceState 256 * @hide 257 */ newFromBundle(Bundle m)258 public static ServiceState newFromBundle(Bundle m) { 259 ServiceState ret; 260 ret = new ServiceState(); 261 ret.setFromNotifierBundle(m); 262 return ret; 263 } 264 265 /** 266 * Empty constructor 267 */ ServiceState()268 public ServiceState() { 269 } 270 271 /** 272 * Copy constructors 273 * 274 * @param s Source service state 275 */ ServiceState(ServiceState s)276 public ServiceState(ServiceState s) { 277 copyFrom(s); 278 } 279 copyFrom(ServiceState s)280 protected void copyFrom(ServiceState s) { 281 mVoiceRegState = s.mVoiceRegState; 282 mDataRegState = s.mDataRegState; 283 mVoiceRoamingType = s.mVoiceRoamingType; 284 mDataRoamingType = s.mDataRoamingType; 285 mVoiceOperatorAlphaLong = s.mVoiceOperatorAlphaLong; 286 mVoiceOperatorAlphaShort = s.mVoiceOperatorAlphaShort; 287 mVoiceOperatorNumeric = s.mVoiceOperatorNumeric; 288 mDataOperatorAlphaLong = s.mDataOperatorAlphaLong; 289 mDataOperatorAlphaShort = s.mDataOperatorAlphaShort; 290 mDataOperatorNumeric = s.mDataOperatorNumeric; 291 mIsManualNetworkSelection = s.mIsManualNetworkSelection; 292 mRilVoiceRadioTechnology = s.mRilVoiceRadioTechnology; 293 mRilDataRadioTechnology = s.mRilDataRadioTechnology; 294 mCssIndicator = s.mCssIndicator; 295 mNetworkId = s.mNetworkId; 296 mSystemId = s.mSystemId; 297 mCdmaRoamingIndicator = s.mCdmaRoamingIndicator; 298 mCdmaDefaultRoamingIndicator = s.mCdmaDefaultRoamingIndicator; 299 mCdmaEriIconIndex = s.mCdmaEriIconIndex; 300 mCdmaEriIconMode = s.mCdmaEriIconMode; 301 mIsEmergencyOnly = s.mIsEmergencyOnly; 302 mIsDataRoamingFromRegistration = s.mIsDataRoamingFromRegistration; 303 } 304 305 /** 306 * Construct a ServiceState object from the given parcel. 307 */ ServiceState(Parcel in)308 public ServiceState(Parcel in) { 309 mVoiceRegState = in.readInt(); 310 mDataRegState = in.readInt(); 311 mVoiceRoamingType = in.readInt(); 312 mDataRoamingType = in.readInt(); 313 mVoiceOperatorAlphaLong = in.readString(); 314 mVoiceOperatorAlphaShort = in.readString(); 315 mVoiceOperatorNumeric = in.readString(); 316 mDataOperatorAlphaLong = in.readString(); 317 mDataOperatorAlphaShort = in.readString(); 318 mDataOperatorNumeric = in.readString(); 319 mIsManualNetworkSelection = in.readInt() != 0; 320 mRilVoiceRadioTechnology = in.readInt(); 321 mRilDataRadioTechnology = in.readInt(); 322 mCssIndicator = (in.readInt() != 0); 323 mNetworkId = in.readInt(); 324 mSystemId = in.readInt(); 325 mCdmaRoamingIndicator = in.readInt(); 326 mCdmaDefaultRoamingIndicator = in.readInt(); 327 mCdmaEriIconIndex = in.readInt(); 328 mCdmaEriIconMode = in.readInt(); 329 mIsEmergencyOnly = in.readInt() != 0; 330 mIsDataRoamingFromRegistration = in.readInt() != 0; 331 } 332 writeToParcel(Parcel out, int flags)333 public void writeToParcel(Parcel out, int flags) { 334 out.writeInt(mVoiceRegState); 335 out.writeInt(mDataRegState); 336 out.writeInt(mVoiceRoamingType); 337 out.writeInt(mDataRoamingType); 338 out.writeString(mVoiceOperatorAlphaLong); 339 out.writeString(mVoiceOperatorAlphaShort); 340 out.writeString(mVoiceOperatorNumeric); 341 out.writeString(mDataOperatorAlphaLong); 342 out.writeString(mDataOperatorAlphaShort); 343 out.writeString(mDataOperatorNumeric); 344 out.writeInt(mIsManualNetworkSelection ? 1 : 0); 345 out.writeInt(mRilVoiceRadioTechnology); 346 out.writeInt(mRilDataRadioTechnology); 347 out.writeInt(mCssIndicator ? 1 : 0); 348 out.writeInt(mNetworkId); 349 out.writeInt(mSystemId); 350 out.writeInt(mCdmaRoamingIndicator); 351 out.writeInt(mCdmaDefaultRoamingIndicator); 352 out.writeInt(mCdmaEriIconIndex); 353 out.writeInt(mCdmaEriIconMode); 354 out.writeInt(mIsEmergencyOnly ? 1 : 0); 355 out.writeInt(mIsDataRoamingFromRegistration ? 1 : 0); 356 } 357 describeContents()358 public int describeContents() { 359 return 0; 360 } 361 362 public static final Parcelable.Creator<ServiceState> CREATOR = 363 new Parcelable.Creator<ServiceState>() { 364 public ServiceState createFromParcel(Parcel in) { 365 return new ServiceState(in); 366 } 367 368 public ServiceState[] newArray(int size) { 369 return new ServiceState[size]; 370 } 371 }; 372 373 /** 374 * Get current voice service state 375 */ getState()376 public int getState() { 377 return getVoiceRegState(); 378 } 379 380 /** 381 * Get current voice service state 382 * 383 * @see #STATE_IN_SERVICE 384 * @see #STATE_OUT_OF_SERVICE 385 * @see #STATE_EMERGENCY_ONLY 386 * @see #STATE_POWER_OFF 387 * 388 * @hide 389 */ getVoiceRegState()390 public int getVoiceRegState() { 391 return mVoiceRegState; 392 } 393 394 /** 395 * Get current data service state 396 * 397 * @see #STATE_IN_SERVICE 398 * @see #STATE_OUT_OF_SERVICE 399 * @see #STATE_EMERGENCY_ONLY 400 * @see #STATE_POWER_OFF 401 * 402 * @hide 403 */ getDataRegState()404 public int getDataRegState() { 405 return mDataRegState; 406 } 407 408 /** 409 * Get current roaming indicator of phone 410 * (note: not just decoding from TS 27.007 7.2) 411 * 412 * @return true if TS 27.007 7.2 roaming is true 413 * and ONS is different from SPN 414 */ getRoaming()415 public boolean getRoaming() { 416 return getVoiceRoaming() || getDataRoaming(); 417 } 418 419 /** 420 * Get current voice network roaming status 421 * @return roaming status 422 * @hide 423 */ getVoiceRoaming()424 public boolean getVoiceRoaming() { 425 return mVoiceRoamingType != ROAMING_TYPE_NOT_ROAMING; 426 } 427 428 /** 429 * Get current voice network roaming type 430 * @return roaming type 431 * @hide 432 */ getVoiceRoamingType()433 public int getVoiceRoamingType() { 434 return mVoiceRoamingType; 435 } 436 437 /** 438 * Get current data network roaming type 439 * @return roaming type 440 * @hide 441 */ getDataRoaming()442 public boolean getDataRoaming() { 443 return mDataRoamingType != ROAMING_TYPE_NOT_ROAMING; 444 } 445 446 /** 447 * Set whether data network registration state is roaming 448 * 449 * This should only be set to the roaming value received 450 * once the data registration phase has completed. 451 * @hide 452 */ setDataRoamingFromRegistration(boolean dataRoaming)453 public void setDataRoamingFromRegistration(boolean dataRoaming) { 454 mIsDataRoamingFromRegistration = dataRoaming; 455 } 456 457 /** 458 * Get whether data network registration state is roaming 459 * @return true if registration indicates roaming, false otherwise 460 * @hide 461 */ getDataRoamingFromRegistration()462 public boolean getDataRoamingFromRegistration() { 463 return mIsDataRoamingFromRegistration; 464 } 465 466 /** 467 * Get current data network roaming type 468 * @return roaming type 469 * @hide 470 */ getDataRoamingType()471 public int getDataRoamingType() { 472 return mDataRoamingType; 473 } 474 475 /** 476 * @hide 477 */ isEmergencyOnly()478 public boolean isEmergencyOnly() { 479 return mIsEmergencyOnly; 480 } 481 482 /** 483 * @hide 484 */ getCdmaRoamingIndicator()485 public int getCdmaRoamingIndicator(){ 486 return this.mCdmaRoamingIndicator; 487 } 488 489 /** 490 * @hide 491 */ getCdmaDefaultRoamingIndicator()492 public int getCdmaDefaultRoamingIndicator(){ 493 return this.mCdmaDefaultRoamingIndicator; 494 } 495 496 /** 497 * @hide 498 */ getCdmaEriIconIndex()499 public int getCdmaEriIconIndex() { 500 return this.mCdmaEriIconIndex; 501 } 502 503 /** 504 * @hide 505 */ getCdmaEriIconMode()506 public int getCdmaEriIconMode() { 507 return this.mCdmaEriIconMode; 508 } 509 510 /** 511 * Get current registered operator name in long alphanumeric format. 512 * 513 * In GSM/UMTS, long format can be up to 16 characters long. 514 * In CDMA, returns the ERI text, if set. Otherwise, returns the ONS. 515 * 516 * @return long name of operator, null if unregistered or unknown 517 */ getOperatorAlphaLong()518 public String getOperatorAlphaLong() { 519 return mVoiceOperatorAlphaLong; 520 } 521 522 /** 523 * Get current registered voice network operator name in long alphanumeric format. 524 * @return long name of operator 525 * @hide 526 */ getVoiceOperatorAlphaLong()527 public String getVoiceOperatorAlphaLong() { 528 return mVoiceOperatorAlphaLong; 529 } 530 531 /** 532 * Get current registered data network operator name in long alphanumeric format. 533 * @return long name of voice operator 534 * @hide 535 */ getDataOperatorAlphaLong()536 public String getDataOperatorAlphaLong() { 537 return mDataOperatorAlphaLong; 538 } 539 540 /** 541 * Get current registered operator name in short alphanumeric format. 542 * 543 * In GSM/UMTS, short format can be up to 8 characters long. 544 * 545 * @return short name of operator, null if unregistered or unknown 546 */ getOperatorAlphaShort()547 public String getOperatorAlphaShort() { 548 return mVoiceOperatorAlphaShort; 549 } 550 551 /** 552 * Get current registered voice network operator name in short alphanumeric format. 553 * @return short name of operator, null if unregistered or unknown 554 * @hide 555 */ getVoiceOperatorAlphaShort()556 public String getVoiceOperatorAlphaShort() { 557 return mVoiceOperatorAlphaShort; 558 } 559 560 /** 561 * Get current registered data network operator name in short alphanumeric format. 562 * @return short name of operator, null if unregistered or unknown 563 * @hide 564 */ getDataOperatorAlphaShort()565 public String getDataOperatorAlphaShort() { 566 return mDataOperatorAlphaShort; 567 } 568 569 /** 570 * Get current registered operator numeric id. 571 * 572 * In GSM/UMTS, numeric format is 3 digit country code plus 2 or 3 digit 573 * network code. 574 * 575 * @return numeric format of operator, null if unregistered or unknown 576 */ 577 /* 578 * The country code can be decoded using 579 * {@link com.android.internal.telephony.MccTable#countryCodeForMcc(int)}. 580 */ getOperatorNumeric()581 public String getOperatorNumeric() { 582 return mVoiceOperatorNumeric; 583 } 584 585 /** 586 * Get current registered voice network operator numeric id. 587 * @return numeric format of operator, null if unregistered or unknown 588 * @hide 589 */ getVoiceOperatorNumeric()590 public String getVoiceOperatorNumeric() { 591 return mVoiceOperatorNumeric; 592 } 593 594 /** 595 * Get current registered data network operator numeric id. 596 * @return numeric format of operator, null if unregistered or unknown 597 * @hide 598 */ getDataOperatorNumeric()599 public String getDataOperatorNumeric() { 600 return mDataOperatorNumeric; 601 } 602 603 /** 604 * Get current network selection mode. 605 * 606 * @return true if manual mode, false if automatic mode 607 */ getIsManualSelection()608 public boolean getIsManualSelection() { 609 return mIsManualNetworkSelection; 610 } 611 612 @Override hashCode()613 public int hashCode() { 614 return ((mVoiceRegState * 31) 615 + (mDataRegState * 37) 616 + mVoiceRoamingType 617 + mDataRoamingType 618 + (mIsManualNetworkSelection ? 1 : 0) 619 + ((null == mVoiceOperatorAlphaLong) ? 0 : mVoiceOperatorAlphaLong.hashCode()) 620 + ((null == mVoiceOperatorAlphaShort) ? 0 : mVoiceOperatorAlphaShort.hashCode()) 621 + ((null == mVoiceOperatorNumeric) ? 0 : mVoiceOperatorNumeric.hashCode()) 622 + ((null == mDataOperatorAlphaLong) ? 0 : mDataOperatorAlphaLong.hashCode()) 623 + ((null == mDataOperatorAlphaShort) ? 0 : mDataOperatorAlphaShort.hashCode()) 624 + ((null == mDataOperatorNumeric) ? 0 : mDataOperatorNumeric.hashCode()) 625 + mCdmaRoamingIndicator 626 + mCdmaDefaultRoamingIndicator 627 + (mIsEmergencyOnly ? 1 : 0) 628 + (mIsDataRoamingFromRegistration ? 1 : 0)); 629 } 630 631 @Override equals(Object o)632 public boolean equals (Object o) { 633 ServiceState s; 634 635 try { 636 s = (ServiceState) o; 637 } catch (ClassCastException ex) { 638 return false; 639 } 640 641 if (o == null) { 642 return false; 643 } 644 645 return (mVoiceRegState == s.mVoiceRegState 646 && mDataRegState == s.mDataRegState 647 && mIsManualNetworkSelection == s.mIsManualNetworkSelection 648 && mVoiceRoamingType == s.mVoiceRoamingType 649 && mDataRoamingType == s.mDataRoamingType 650 && equalsHandlesNulls(mVoiceOperatorAlphaLong, s.mVoiceOperatorAlphaLong) 651 && equalsHandlesNulls(mVoiceOperatorAlphaShort, s.mVoiceOperatorAlphaShort) 652 && equalsHandlesNulls(mVoiceOperatorNumeric, s.mVoiceOperatorNumeric) 653 && equalsHandlesNulls(mDataOperatorAlphaLong, s.mDataOperatorAlphaLong) 654 && equalsHandlesNulls(mDataOperatorAlphaShort, s.mDataOperatorAlphaShort) 655 && equalsHandlesNulls(mDataOperatorNumeric, s.mDataOperatorNumeric) 656 && equalsHandlesNulls(mRilVoiceRadioTechnology, s.mRilVoiceRadioTechnology) 657 && equalsHandlesNulls(mRilDataRadioTechnology, s.mRilDataRadioTechnology) 658 && equalsHandlesNulls(mCssIndicator, s.mCssIndicator) 659 && equalsHandlesNulls(mNetworkId, s.mNetworkId) 660 && equalsHandlesNulls(mSystemId, s.mSystemId) 661 && equalsHandlesNulls(mCdmaRoamingIndicator, s.mCdmaRoamingIndicator) 662 && equalsHandlesNulls(mCdmaDefaultRoamingIndicator, 663 s.mCdmaDefaultRoamingIndicator) 664 && mIsEmergencyOnly == s.mIsEmergencyOnly 665 && mIsDataRoamingFromRegistration == s.mIsDataRoamingFromRegistration); 666 } 667 668 /** 669 * Convert radio technology to String 670 * 671 * @param radioTechnology 672 * @return String representation of the RAT 673 * 674 * @hide 675 */ rilRadioTechnologyToString(int rt)676 public static String rilRadioTechnologyToString(int rt) { 677 String rtString; 678 679 switch(rt) { 680 case RIL_RADIO_TECHNOLOGY_UNKNOWN: 681 rtString = "Unknown"; 682 break; 683 case RIL_RADIO_TECHNOLOGY_GPRS: 684 rtString = "GPRS"; 685 break; 686 case RIL_RADIO_TECHNOLOGY_EDGE: 687 rtString = "EDGE"; 688 break; 689 case RIL_RADIO_TECHNOLOGY_UMTS: 690 rtString = "UMTS"; 691 break; 692 case RIL_RADIO_TECHNOLOGY_IS95A: 693 rtString = "CDMA-IS95A"; 694 break; 695 case RIL_RADIO_TECHNOLOGY_IS95B: 696 rtString = "CDMA-IS95B"; 697 break; 698 case RIL_RADIO_TECHNOLOGY_1xRTT: 699 rtString = "1xRTT"; 700 break; 701 case RIL_RADIO_TECHNOLOGY_EVDO_0: 702 rtString = "EvDo-rev.0"; 703 break; 704 case RIL_RADIO_TECHNOLOGY_EVDO_A: 705 rtString = "EvDo-rev.A"; 706 break; 707 case RIL_RADIO_TECHNOLOGY_HSDPA: 708 rtString = "HSDPA"; 709 break; 710 case RIL_RADIO_TECHNOLOGY_HSUPA: 711 rtString = "HSUPA"; 712 break; 713 case RIL_RADIO_TECHNOLOGY_HSPA: 714 rtString = "HSPA"; 715 break; 716 case RIL_RADIO_TECHNOLOGY_EVDO_B: 717 rtString = "EvDo-rev.B"; 718 break; 719 case RIL_RADIO_TECHNOLOGY_EHRPD: 720 rtString = "eHRPD"; 721 break; 722 case RIL_RADIO_TECHNOLOGY_LTE: 723 rtString = "LTE"; 724 break; 725 case RIL_RADIO_TECHNOLOGY_HSPAP: 726 rtString = "HSPAP"; 727 break; 728 case RIL_RADIO_TECHNOLOGY_GSM: 729 rtString = "GSM"; 730 break; 731 case RIL_RADIO_TECHNOLOGY_IWLAN: 732 rtString = "IWLAN"; 733 break; 734 default: 735 rtString = "Unexpected"; 736 Rlog.w(LOG_TAG, "Unexpected radioTechnology=" + rt); 737 break; 738 } 739 return rtString; 740 } 741 742 @Override toString()743 public String toString() { 744 String radioTechnology = rilRadioTechnologyToString(mRilVoiceRadioTechnology); 745 String dataRadioTechnology = rilRadioTechnologyToString(mRilDataRadioTechnology); 746 747 return (mVoiceRegState + " " + mDataRegState 748 + " " 749 + "voice " + getRoamingLogString(mVoiceRoamingType) 750 + " " 751 + "data " + getRoamingLogString(mDataRoamingType) 752 + " " + mVoiceOperatorAlphaLong 753 + " " + mVoiceOperatorAlphaShort 754 + " " + mVoiceOperatorNumeric 755 + " " + mDataOperatorAlphaLong 756 + " " + mDataOperatorAlphaShort 757 + " " + mDataOperatorNumeric 758 + " " + (mIsManualNetworkSelection ? "(manual)" : "") 759 + " " + radioTechnology 760 + " " + dataRadioTechnology 761 + " " + (mCssIndicator ? "CSS supported" : "CSS not supported") 762 + " " + mNetworkId 763 + " " + mSystemId 764 + " RoamInd=" + mCdmaRoamingIndicator 765 + " DefRoamInd=" + mCdmaDefaultRoamingIndicator 766 + " EmergOnly=" + mIsEmergencyOnly 767 + " IsDataRoamingFromRegistration=" + mIsDataRoamingFromRegistration); 768 } 769 setNullState(int state)770 private void setNullState(int state) { 771 if (DBG) Rlog.d(LOG_TAG, "[ServiceState] setNullState=" + state); 772 mVoiceRegState = state; 773 mDataRegState = state; 774 mVoiceRoamingType = ROAMING_TYPE_NOT_ROAMING; 775 mDataRoamingType = ROAMING_TYPE_NOT_ROAMING; 776 mVoiceOperatorAlphaLong = null; 777 mVoiceOperatorAlphaShort = null; 778 mVoiceOperatorNumeric = null; 779 mDataOperatorAlphaLong = null; 780 mDataOperatorAlphaShort = null; 781 mDataOperatorNumeric = null; 782 mIsManualNetworkSelection = false; 783 mRilVoiceRadioTechnology = 0; 784 mRilDataRadioTechnology = 0; 785 mCssIndicator = false; 786 mNetworkId = -1; 787 mSystemId = -1; 788 mCdmaRoamingIndicator = -1; 789 mCdmaDefaultRoamingIndicator = -1; 790 mCdmaEriIconIndex = -1; 791 mCdmaEriIconMode = -1; 792 mIsEmergencyOnly = false; 793 mIsDataRoamingFromRegistration = false; 794 } 795 setStateOutOfService()796 public void setStateOutOfService() { 797 setNullState(STATE_OUT_OF_SERVICE); 798 } 799 setStateOff()800 public void setStateOff() { 801 setNullState(STATE_POWER_OFF); 802 } 803 setState(int state)804 public void setState(int state) { 805 setVoiceRegState(state); 806 if (DBG) Rlog.e(LOG_TAG, "[ServiceState] setState deprecated use setVoiceRegState()"); 807 } 808 809 /** @hide */ setVoiceRegState(int state)810 public void setVoiceRegState(int state) { 811 mVoiceRegState = state; 812 if (DBG) Rlog.d(LOG_TAG, "[ServiceState] setVoiceRegState=" + mVoiceRegState); 813 } 814 815 /** @hide */ setDataRegState(int state)816 public void setDataRegState(int state) { 817 mDataRegState = state; 818 if (DBG) Rlog.d(LOG_TAG, "[ServiceState] setDataRegState=" + mDataRegState); 819 } 820 setRoaming(boolean roaming)821 public void setRoaming(boolean roaming) { 822 mVoiceRoamingType = (roaming ? ROAMING_TYPE_UNKNOWN : ROAMING_TYPE_NOT_ROAMING); 823 mDataRoamingType = mVoiceRoamingType; 824 } 825 826 /** @hide */ setVoiceRoaming(boolean roaming)827 public void setVoiceRoaming(boolean roaming) { 828 mVoiceRoamingType = (roaming ? ROAMING_TYPE_UNKNOWN : ROAMING_TYPE_NOT_ROAMING); 829 } 830 831 /** @hide */ setVoiceRoamingType(int type)832 public void setVoiceRoamingType(int type) { 833 mVoiceRoamingType = type; 834 } 835 836 /** @hide */ setDataRoaming(boolean dataRoaming)837 public void setDataRoaming(boolean dataRoaming) { 838 mDataRoamingType = (dataRoaming ? ROAMING_TYPE_UNKNOWN : ROAMING_TYPE_NOT_ROAMING); 839 } 840 841 /** @hide */ setDataRoamingType(int type)842 public void setDataRoamingType(int type) { 843 mDataRoamingType = type; 844 } 845 846 /** 847 * @hide 848 */ setEmergencyOnly(boolean emergencyOnly)849 public void setEmergencyOnly(boolean emergencyOnly) { 850 mIsEmergencyOnly = emergencyOnly; 851 } 852 853 /** 854 * @hide 855 */ setCdmaRoamingIndicator(int roaming)856 public void setCdmaRoamingIndicator(int roaming) { 857 this.mCdmaRoamingIndicator = roaming; 858 } 859 860 /** 861 * @hide 862 */ setCdmaDefaultRoamingIndicator(int roaming)863 public void setCdmaDefaultRoamingIndicator (int roaming) { 864 this.mCdmaDefaultRoamingIndicator = roaming; 865 } 866 867 /** 868 * @hide 869 */ setCdmaEriIconIndex(int index)870 public void setCdmaEriIconIndex(int index) { 871 this.mCdmaEriIconIndex = index; 872 } 873 874 /** 875 * @hide 876 */ setCdmaEriIconMode(int mode)877 public void setCdmaEriIconMode(int mode) { 878 this.mCdmaEriIconMode = mode; 879 } 880 setOperatorName(String longName, String shortName, String numeric)881 public void setOperatorName(String longName, String shortName, String numeric) { 882 mVoiceOperatorAlphaLong = longName; 883 mVoiceOperatorAlphaShort = shortName; 884 mVoiceOperatorNumeric = numeric; 885 mDataOperatorAlphaLong = longName; 886 mDataOperatorAlphaShort = shortName; 887 mDataOperatorNumeric = numeric; 888 } 889 890 /** @hide */ setVoiceOperatorName(String longName, String shortName, String numeric)891 public void setVoiceOperatorName(String longName, String shortName, String numeric) { 892 mVoiceOperatorAlphaLong = longName; 893 mVoiceOperatorAlphaShort = shortName; 894 mVoiceOperatorNumeric = numeric; 895 } 896 897 /** @hide */ setDataOperatorName(String longName, String shortName, String numeric)898 public void setDataOperatorName(String longName, String shortName, String numeric) { 899 mDataOperatorAlphaLong = longName; 900 mDataOperatorAlphaShort = shortName; 901 mDataOperatorNumeric = numeric; 902 } 903 904 /** 905 * In CDMA, mOperatorAlphaLong can be set from the ERI text. 906 * This is done from the CDMAPhone and not from the CdmaServiceStateTracker. 907 * 908 * @hide 909 */ setOperatorAlphaLong(String longName)910 public void setOperatorAlphaLong(String longName) { 911 mVoiceOperatorAlphaLong = longName; 912 mDataOperatorAlphaLong = longName; 913 } 914 915 /** @hide */ setVoiceOperatorAlphaLong(String longName)916 public void setVoiceOperatorAlphaLong(String longName) { 917 mVoiceOperatorAlphaLong = longName; 918 } 919 920 /** @hide */ setDataOperatorAlphaLong(String longName)921 public void setDataOperatorAlphaLong(String longName) { 922 mDataOperatorAlphaLong = longName; 923 } 924 setIsManualSelection(boolean isManual)925 public void setIsManualSelection(boolean isManual) { 926 mIsManualNetworkSelection = isManual; 927 } 928 929 /** 930 * Test whether two objects hold the same data values or both are null. 931 * 932 * @param a first obj 933 * @param b second obj 934 * @return true if two objects equal or both are null 935 */ equalsHandlesNulls(Object a, Object b)936 private static boolean equalsHandlesNulls (Object a, Object b) { 937 return (a == null) ? (b == null) : a.equals (b); 938 } 939 940 /** 941 * Set ServiceState based on intent notifier map. 942 * 943 * @param m intent notifier map 944 * @hide 945 */ setFromNotifierBundle(Bundle m)946 private void setFromNotifierBundle(Bundle m) { 947 mVoiceRegState = m.getInt("voiceRegState"); 948 mDataRegState = m.getInt("dataRegState"); 949 mVoiceRoamingType = m.getInt("voiceRoamingType"); 950 mDataRoamingType = m.getInt("dataRoamingType"); 951 mVoiceOperatorAlphaLong = m.getString("operator-alpha-long"); 952 mVoiceOperatorAlphaShort = m.getString("operator-alpha-short"); 953 mVoiceOperatorNumeric = m.getString("operator-numeric"); 954 mDataOperatorAlphaLong = m.getString("data-operator-alpha-long"); 955 mDataOperatorAlphaShort = m.getString("data-operator-alpha-short"); 956 mDataOperatorNumeric = m.getString("data-operator-numeric"); 957 mIsManualNetworkSelection = m.getBoolean("manual"); 958 mRilVoiceRadioTechnology = m.getInt("radioTechnology"); 959 mRilDataRadioTechnology = m.getInt("dataRadioTechnology"); 960 mCssIndicator = m.getBoolean("cssIndicator"); 961 mNetworkId = m.getInt("networkId"); 962 mSystemId = m.getInt("systemId"); 963 mCdmaRoamingIndicator = m.getInt("cdmaRoamingIndicator"); 964 mCdmaDefaultRoamingIndicator = m.getInt("cdmaDefaultRoamingIndicator"); 965 mIsEmergencyOnly = m.getBoolean("emergencyOnly"); 966 mIsDataRoamingFromRegistration = m.getBoolean("isDataRoamingFromRegistration"); 967 } 968 969 /** 970 * Set intent notifier Bundle based on service state. 971 * 972 * @param m intent notifier Bundle 973 * @hide 974 */ fillInNotifierBundle(Bundle m)975 public void fillInNotifierBundle(Bundle m) { 976 m.putInt("voiceRegState", mVoiceRegState); 977 m.putInt("dataRegState", mDataRegState); 978 m.putInt("voiceRoamingType", mVoiceRoamingType); 979 m.putInt("dataRoamingType", mDataRoamingType); 980 m.putString("operator-alpha-long", mVoiceOperatorAlphaLong); 981 m.putString("operator-alpha-short", mVoiceOperatorAlphaShort); 982 m.putString("operator-numeric", mVoiceOperatorNumeric); 983 m.putString("data-operator-alpha-long", mDataOperatorAlphaLong); 984 m.putString("data-operator-alpha-short", mDataOperatorAlphaShort); 985 m.putString("data-operator-numeric", mDataOperatorNumeric); 986 m.putBoolean("manual", Boolean.valueOf(mIsManualNetworkSelection)); 987 m.putInt("radioTechnology", mRilVoiceRadioTechnology); 988 m.putInt("dataRadioTechnology", mRilDataRadioTechnology); 989 m.putBoolean("cssIndicator", mCssIndicator); 990 m.putInt("networkId", mNetworkId); 991 m.putInt("systemId", mSystemId); 992 m.putInt("cdmaRoamingIndicator", mCdmaRoamingIndicator); 993 m.putInt("cdmaDefaultRoamingIndicator", mCdmaDefaultRoamingIndicator); 994 m.putBoolean("emergencyOnly", Boolean.valueOf(mIsEmergencyOnly)); 995 m.putBoolean("isDataRoamingFromRegistration", Boolean.valueOf(mIsDataRoamingFromRegistration)); 996 } 997 998 /** @hide */ setRilVoiceRadioTechnology(int rt)999 public void setRilVoiceRadioTechnology(int rt) { 1000 this.mRilVoiceRadioTechnology = rt; 1001 } 1002 1003 /** @hide */ setRilDataRadioTechnology(int rt)1004 public void setRilDataRadioTechnology(int rt) { 1005 this.mRilDataRadioTechnology = rt; 1006 if (DBG) Rlog.d(LOG_TAG, "[ServiceState] setDataRadioTechnology=" + mRilDataRadioTechnology); 1007 } 1008 1009 /** @hide */ setCssIndicator(int css)1010 public void setCssIndicator(int css) { 1011 this.mCssIndicator = (css != 0); 1012 } 1013 1014 /** @hide */ setSystemAndNetworkId(int systemId, int networkId)1015 public void setSystemAndNetworkId(int systemId, int networkId) { 1016 this.mSystemId = systemId; 1017 this.mNetworkId = networkId; 1018 } 1019 1020 /** @hide */ getRilVoiceRadioTechnology()1021 public int getRilVoiceRadioTechnology() { 1022 return this.mRilVoiceRadioTechnology; 1023 } 1024 /** @hide */ getRilDataRadioTechnology()1025 public int getRilDataRadioTechnology() { 1026 return this.mRilDataRadioTechnology; 1027 } 1028 /** 1029 * @hide 1030 * @Deprecated to be removed Q3 2013 use {@link #getRilDataRadioTechnology} or 1031 * {@link #getRilVoiceRadioTechnology} 1032 */ getRadioTechnology()1033 public int getRadioTechnology() { 1034 Rlog.e(LOG_TAG, "ServiceState.getRadioTechnology() DEPRECATED will be removed *******"); 1035 return getRilDataRadioTechnology(); 1036 } 1037 rilRadioTechnologyToNetworkType(int rt)1038 private int rilRadioTechnologyToNetworkType(int rt) { 1039 switch(rt) { 1040 case ServiceState.RIL_RADIO_TECHNOLOGY_GPRS: 1041 return TelephonyManager.NETWORK_TYPE_GPRS; 1042 case ServiceState.RIL_RADIO_TECHNOLOGY_EDGE: 1043 return TelephonyManager.NETWORK_TYPE_EDGE; 1044 case ServiceState.RIL_RADIO_TECHNOLOGY_UMTS: 1045 return TelephonyManager.NETWORK_TYPE_UMTS; 1046 case ServiceState.RIL_RADIO_TECHNOLOGY_HSDPA: 1047 return TelephonyManager.NETWORK_TYPE_HSDPA; 1048 case ServiceState.RIL_RADIO_TECHNOLOGY_HSUPA: 1049 return TelephonyManager.NETWORK_TYPE_HSUPA; 1050 case ServiceState.RIL_RADIO_TECHNOLOGY_HSPA: 1051 return TelephonyManager.NETWORK_TYPE_HSPA; 1052 case ServiceState.RIL_RADIO_TECHNOLOGY_IS95A: 1053 case ServiceState.RIL_RADIO_TECHNOLOGY_IS95B: 1054 return TelephonyManager.NETWORK_TYPE_CDMA; 1055 case ServiceState.RIL_RADIO_TECHNOLOGY_1xRTT: 1056 return TelephonyManager.NETWORK_TYPE_1xRTT; 1057 case ServiceState.RIL_RADIO_TECHNOLOGY_EVDO_0: 1058 return TelephonyManager.NETWORK_TYPE_EVDO_0; 1059 case ServiceState.RIL_RADIO_TECHNOLOGY_EVDO_A: 1060 return TelephonyManager.NETWORK_TYPE_EVDO_A; 1061 case ServiceState.RIL_RADIO_TECHNOLOGY_EVDO_B: 1062 return TelephonyManager.NETWORK_TYPE_EVDO_B; 1063 case ServiceState.RIL_RADIO_TECHNOLOGY_EHRPD: 1064 return TelephonyManager.NETWORK_TYPE_EHRPD; 1065 case ServiceState.RIL_RADIO_TECHNOLOGY_LTE: 1066 return TelephonyManager.NETWORK_TYPE_LTE; 1067 case ServiceState.RIL_RADIO_TECHNOLOGY_HSPAP: 1068 return TelephonyManager.NETWORK_TYPE_HSPAP; 1069 case ServiceState.RIL_RADIO_TECHNOLOGY_GSM: 1070 return TelephonyManager.NETWORK_TYPE_GSM; 1071 case ServiceState.RIL_RADIO_TECHNOLOGY_IWLAN: 1072 return TelephonyManager.NETWORK_TYPE_IWLAN; 1073 default: 1074 return TelephonyManager.NETWORK_TYPE_UNKNOWN; 1075 } 1076 } 1077 1078 /** 1079 * @Deprecated to be removed Q3 2013 use {@link #getVoiceNetworkType} 1080 * @hide 1081 */ getNetworkType()1082 public int getNetworkType() { 1083 Rlog.e(LOG_TAG, "ServiceState.getNetworkType() DEPRECATED will be removed *******"); 1084 return rilRadioTechnologyToNetworkType(mRilVoiceRadioTechnology); 1085 } 1086 1087 /** @hide */ getDataNetworkType()1088 public int getDataNetworkType() { 1089 return rilRadioTechnologyToNetworkType(mRilDataRadioTechnology); 1090 } 1091 1092 /** @hide */ getVoiceNetworkType()1093 public int getVoiceNetworkType() { 1094 return rilRadioTechnologyToNetworkType(mRilVoiceRadioTechnology); 1095 } 1096 1097 /** @hide */ getCssIndicator()1098 public int getCssIndicator() { 1099 return this.mCssIndicator ? 1 : 0; 1100 } 1101 1102 /** @hide */ getNetworkId()1103 public int getNetworkId() { 1104 return this.mNetworkId; 1105 } 1106 1107 /** @hide */ getSystemId()1108 public int getSystemId() { 1109 return this.mSystemId; 1110 } 1111 1112 /** @hide */ isGsm(int radioTechnology)1113 public static boolean isGsm(int radioTechnology) { 1114 return radioTechnology == RIL_RADIO_TECHNOLOGY_GPRS 1115 || radioTechnology == RIL_RADIO_TECHNOLOGY_EDGE 1116 || radioTechnology == RIL_RADIO_TECHNOLOGY_UMTS 1117 || radioTechnology == RIL_RADIO_TECHNOLOGY_HSDPA 1118 || radioTechnology == RIL_RADIO_TECHNOLOGY_HSUPA 1119 || radioTechnology == RIL_RADIO_TECHNOLOGY_HSPA 1120 || radioTechnology == RIL_RADIO_TECHNOLOGY_LTE 1121 || radioTechnology == RIL_RADIO_TECHNOLOGY_HSPAP 1122 || radioTechnology == RIL_RADIO_TECHNOLOGY_GSM 1123 || radioTechnology == RIL_RADIO_TECHNOLOGY_TD_SCDMA 1124 || radioTechnology == RIL_RADIO_TECHNOLOGY_IWLAN; 1125 } 1126 1127 /** @hide */ isCdma(int radioTechnology)1128 public static boolean isCdma(int radioTechnology) { 1129 return radioTechnology == RIL_RADIO_TECHNOLOGY_IS95A 1130 || radioTechnology == RIL_RADIO_TECHNOLOGY_IS95B 1131 || radioTechnology == RIL_RADIO_TECHNOLOGY_1xRTT 1132 || radioTechnology == RIL_RADIO_TECHNOLOGY_EVDO_0 1133 || radioTechnology == RIL_RADIO_TECHNOLOGY_EVDO_A 1134 || radioTechnology == RIL_RADIO_TECHNOLOGY_EVDO_B 1135 || radioTechnology == RIL_RADIO_TECHNOLOGY_EHRPD; 1136 } 1137 1138 /** @hide */ hasCdma(int radioTechnologyBitmask)1139 public static boolean hasCdma(int radioTechnologyBitmask) { 1140 int cdmaBitmask = (RIL_RADIO_TECHNOLOGY_IS95A 1141 | RIL_RADIO_TECHNOLOGY_IS95B 1142 | RIL_RADIO_TECHNOLOGY_1xRTT 1143 | RIL_RADIO_TECHNOLOGY_EVDO_0 1144 | RIL_RADIO_TECHNOLOGY_EVDO_A 1145 | RIL_RADIO_TECHNOLOGY_EVDO_B 1146 | RIL_RADIO_TECHNOLOGY_EHRPD); 1147 1148 return ((radioTechnologyBitmask & cdmaBitmask) != 0); 1149 } 1150 1151 /** @hide */ bitmaskHasTech(int bearerBitmask, int radioTech)1152 public static boolean bitmaskHasTech(int bearerBitmask, int radioTech) { 1153 if (bearerBitmask == 0) { 1154 return true; 1155 } else if (radioTech >= 1) { 1156 return ((bearerBitmask & (1 << (radioTech - 1))) != 0); 1157 } 1158 return false; 1159 } 1160 1161 /** @hide */ getBitmaskForTech(int radioTech)1162 public static int getBitmaskForTech(int radioTech) { 1163 if (radioTech >= 1) { 1164 return (1 << (radioTech - 1)); 1165 } 1166 return 0; 1167 } 1168 1169 /** @hide */ getBitmaskFromString(String bearerList)1170 public static int getBitmaskFromString(String bearerList) { 1171 String[] bearers = bearerList.split("\\|"); 1172 int bearerBitmask = 0; 1173 for (String bearer : bearers) { 1174 int bearerInt = 0; 1175 try { 1176 bearerInt = Integer.parseInt(bearer.trim()); 1177 } catch (NumberFormatException nfe) { 1178 return 0; 1179 } 1180 1181 if (bearerInt == 0) { 1182 return 0; 1183 } 1184 1185 bearerBitmask |= getBitmaskForTech(bearerInt); 1186 } 1187 return bearerBitmask; 1188 } 1189 1190 /** 1191 * Returns a merged ServiceState consisting of the base SS with voice settings from the 1192 * voice SS. The voice SS is only used if it is IN_SERVICE (otherwise the base SS is returned). 1193 * @hide 1194 * */ mergeServiceStates(ServiceState baseSs, ServiceState voiceSs)1195 public static ServiceState mergeServiceStates(ServiceState baseSs, ServiceState voiceSs) { 1196 if (voiceSs.mVoiceRegState != STATE_IN_SERVICE) { 1197 return baseSs; 1198 } 1199 1200 ServiceState newSs = new ServiceState(baseSs); 1201 1202 // voice overrides 1203 newSs.mVoiceRegState = voiceSs.mVoiceRegState; 1204 newSs.mIsEmergencyOnly = false; // only get here if voice is IN_SERVICE 1205 1206 return newSs; 1207 } 1208 } 1209