1 /* 2 * Copyright 2018 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.annotation.NonNull; 20 import android.os.Parcel; 21 import android.os.Parcelable; 22 23 import java.util.Objects; 24 25 26 /** 27 * Class that stores information specific to voice network registration. 28 * @hide 29 */ 30 public class VoiceSpecificRegistrationInfo implements Parcelable{ 31 /** 32 * oncurrent services support indicator. if 33 * registered on a CDMA system. 34 * false - Concurrent services not supported, 35 * true - Concurrent services supported 36 */ 37 public final boolean cssSupported; 38 39 /** 40 * TSB-58 Roaming Indicator if registered 41 * on a CDMA or EVDO system or -1 if not. 42 * Valid values are 0-255. 43 */ 44 public final int roamingIndicator; 45 46 /** 47 * indicates whether the current system is in the 48 * PRL if registered on a CDMA or EVDO system or -1 if 49 * not. 0=not in the PRL, 1=in the PRL 50 */ 51 public final int systemIsInPrl; 52 53 /** 54 * default Roaming Indicator from the PRL, 55 * if registered on a CDMA or EVDO system or -1 if not. 56 * Valid values are 0-255. 57 */ 58 public final int defaultRoamingIndicator; 59 VoiceSpecificRegistrationInfo(boolean cssSupported, int roamingIndicator, int systemIsInPrl, int defaultRoamingIndicator)60 VoiceSpecificRegistrationInfo(boolean cssSupported, int roamingIndicator, int systemIsInPrl, 61 int defaultRoamingIndicator) { 62 this.cssSupported = cssSupported; 63 this.roamingIndicator = roamingIndicator; 64 this.systemIsInPrl = systemIsInPrl; 65 this.defaultRoamingIndicator = defaultRoamingIndicator; 66 } 67 68 /** 69 * Constructor from another voice specific registration info 70 * 71 * @param vsri another voice specific registration info 72 * @hide 73 */ VoiceSpecificRegistrationInfo(VoiceSpecificRegistrationInfo vsri)74 VoiceSpecificRegistrationInfo(VoiceSpecificRegistrationInfo vsri) { 75 cssSupported = vsri.cssSupported; 76 roamingIndicator = vsri.roamingIndicator; 77 systemIsInPrl = vsri.systemIsInPrl; 78 defaultRoamingIndicator = vsri.defaultRoamingIndicator; 79 } 80 VoiceSpecificRegistrationInfo(Parcel source)81 private VoiceSpecificRegistrationInfo(Parcel source) { 82 this.cssSupported = source.readBoolean(); 83 this.roamingIndicator = source.readInt(); 84 this.systemIsInPrl = source.readInt(); 85 this.defaultRoamingIndicator = source.readInt(); 86 } 87 88 @Override writeToParcel(Parcel dest, int flags)89 public void writeToParcel(Parcel dest, int flags) { 90 dest.writeBoolean(cssSupported); 91 dest.writeInt(roamingIndicator); 92 dest.writeInt(systemIsInPrl); 93 dest.writeInt(defaultRoamingIndicator); 94 } 95 96 @Override describeContents()97 public int describeContents() { 98 return 0; 99 } 100 101 @Override toString()102 public String toString() { 103 return "VoiceSpecificRegistrationInfo {" 104 + " mCssSupported=" + cssSupported 105 + " mRoamingIndicator=" + roamingIndicator 106 + " mSystemIsInPrl=" + systemIsInPrl 107 + " mDefaultRoamingIndicator=" + defaultRoamingIndicator + "}"; 108 } 109 110 @Override hashCode()111 public int hashCode() { 112 return Objects.hash(cssSupported, roamingIndicator, systemIsInPrl, 113 defaultRoamingIndicator); 114 } 115 116 @Override equals(Object o)117 public boolean equals(Object o) { 118 if (this == o) return true; 119 120 if (o == null || !(o instanceof VoiceSpecificRegistrationInfo)) { 121 return false; 122 } 123 124 VoiceSpecificRegistrationInfo other = (VoiceSpecificRegistrationInfo) o; 125 return this.cssSupported == other.cssSupported 126 && this.roamingIndicator == other.roamingIndicator 127 && this.systemIsInPrl == other.systemIsInPrl 128 && this.defaultRoamingIndicator == other.defaultRoamingIndicator; 129 } 130 131 132 public static final @NonNull Parcelable.Creator<VoiceSpecificRegistrationInfo> CREATOR = 133 new Parcelable.Creator<VoiceSpecificRegistrationInfo>() { 134 @Override 135 public VoiceSpecificRegistrationInfo createFromParcel(Parcel source) { 136 return new VoiceSpecificRegistrationInfo(source); 137 } 138 139 @Override 140 public VoiceSpecificRegistrationInfo[] newArray(int size) { 141 return new VoiceSpecificRegistrationInfo[size]; 142 } 143 }; 144 } 145