2 * Copyright (C) 2014 The Android Open Source Project
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 package android.telephony;
19 import android.os.Bundle;
20 import android.os.Parcel;
21 import android.os.Parcelable;
22 import android.telephony.Rlog;
25 * Contains LTE network state related information.
29 public final class VoLteServiceState implements Parcelable {
31 private static final String LOG_TAG = "VoLteServiceState";
32 private static final boolean DBG = false;
34 //Use int max, as -1 is a valid value in signal strength
35 public static final int INVALID = 0x7FFFFFFF;
37 public static final int NOT_SUPPORTED = 0;
38 public static final int SUPPORTED = 1;
40 // Single Radio Voice Call Continuity(SRVCC) progress state
41 public static final int HANDOVER_STARTED = 0;
42 public static final int HANDOVER_COMPLETED = 1;
43 public static final int HANDOVER_FAILED = 2;
44 public static final int HANDOVER_CANCELED = 3;
46 private int mSrvccState;
49 * Create a new VoLteServiceState from a intent notifier Bundle
51 * This method is used by PhoneStateIntentReceiver and maybe by
52 * external applications.
54 * @param m Bundle from intent notifier
55 * @return newly created VoLteServiceState
59 public static VoLteServiceState newFromBundle(Bundle m) {
60 VoLteServiceState ret;
61 ret = new VoLteServiceState();
62 ret.setFromNotifierBundle(m);
71 public VoLteServiceState() {
80 public VoLteServiceState(int srvccState) {
83 mSrvccState = srvccState;
89 * @param s Source VoLteServiceState
93 public VoLteServiceState(VoLteServiceState s) {
98 * Initialize values to defaults.
102 private void initialize() {
103 mSrvccState = INVALID;
109 protected void copyFrom(VoLteServiceState s) {
110 mSrvccState = s.mSrvccState;
114 * Construct a VoLteServiceState object from the given parcel.
118 public VoLteServiceState(Parcel in) {
119 if (DBG) log("Size of VoLteServiceState parcel:" + in.dataSize());
121 mSrvccState = in.readInt();
125 * {@link Parcelable#writeToParcel}
127 public void writeToParcel(Parcel out, int flags) {
128 out.writeInt(mSrvccState);
132 * {@link Parcelable#describeContents}
134 public int describeContents() {
139 * {@link Parcelable.Creator}
143 public static final Parcelable.Creator<VoLteServiceState> CREATOR = new Parcelable.Creator() {
144 public VoLteServiceState createFromParcel(Parcel in) {
145 return new VoLteServiceState(in);
148 public VoLteServiceState[] newArray(int size) {
149 return new VoLteServiceState[size];
154 * Validate the individual fields as per the range
156 * Set to invalid any field that is not in the valid range
159 * Valid values for all fields
162 public void validateInput() {
165 public int hashCode() {
167 return ((mSrvccState * primeNum));
171 * @return true if the LTE network states are the same
174 public boolean equals (Object o) {
178 s = (VoLteServiceState) o;
179 } catch (ClassCastException ex) {
187 return (mSrvccState == s.mSrvccState);
191 * @return string representation.
194 public String toString() {
195 return ("VoLteServiceState:"
196 + " " + mSrvccState);
200 * Set VoLteServiceState based on intent notifier map
202 * @param m intent notifier map
205 private void setFromNotifierBundle(Bundle m) {
206 mSrvccState = m.getInt("mSrvccState");
210 * Set intent notifier Bundle based on VoLteServiceState
212 * @param m intent notifier Bundle
215 public void fillInNotifierBundle(Bundle m) {
216 m.putInt("mSrvccState", mSrvccState);
219 public int getSrvccState() {
226 private static void log(String s) {