1 /* 2 * Copyright (C) 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.IntDef; 20 import android.annotation.NonNull; 21 import android.annotation.Nullable; 22 import android.annotation.SystemApi; 23 import android.annotation.TestApi; 24 import android.os.Parcel; 25 import android.os.Parcelable; 26 27 import java.lang.annotation.Retention; 28 import java.lang.annotation.RetentionPolicy; 29 import java.util.Objects; 30 31 /** 32 * Class stores information related to LTE network VoPS support 33 * @hide 34 */ 35 @SystemApi 36 @TestApi 37 public final class LteVopsSupportInfo implements Parcelable { 38 39 /**@hide*/ 40 @Retention(RetentionPolicy.SOURCE) 41 @IntDef( 42 value = {LTE_STATUS_NOT_AVAILABLE, LTE_STATUS_SUPPORTED, 43 LTE_STATUS_NOT_SUPPORTED}, prefix = "LTE_STATUS_") 44 public @interface LteVopsStatus {} 45 /** 46 * Indicates information not available from modem. 47 */ 48 public static final int LTE_STATUS_NOT_AVAILABLE = 1; 49 50 /** 51 * Indicates network support the feature. 52 */ 53 public static final int LTE_STATUS_SUPPORTED = 2; 54 55 /** 56 * Indicates network does not support the feature. 57 */ 58 public static final int LTE_STATUS_NOT_SUPPORTED = 3; 59 60 @LteVopsStatus 61 private final int mVopsSupport; 62 @LteVopsStatus 63 private final int mEmcBearerSupport; 64 LteVopsSupportInfo(@teVopsStatus int vops, @LteVopsStatus int emergency)65 public LteVopsSupportInfo(@LteVopsStatus int vops, @LteVopsStatus int emergency) { 66 mVopsSupport = vops; 67 mEmcBearerSupport = emergency; 68 } 69 70 /** 71 * Provides the LTE VoPS support capability as described in: 72 * 3GPP 24.301 EPS network feature support -> IMS VoPS 73 */ getVopsSupport()74 public @LteVopsStatus int getVopsSupport() { 75 return mVopsSupport; 76 } 77 78 /** 79 * Provides the LTE Emergency bearer support capability as described in: 80 * 3GPP 24.301 EPS network feature support -> EMC BS 81 * 25.331 LTE RRC SIB1 : ims-EmergencySupport-r9 82 */ getEmcBearerSupport()83 public @LteVopsStatus int getEmcBearerSupport() { 84 return mEmcBearerSupport; 85 } 86 87 @Override describeContents()88 public int describeContents() { 89 return 0; 90 } 91 92 @Override writeToParcel(Parcel out, int flags)93 public void writeToParcel(Parcel out, int flags) { 94 out.writeInt(mVopsSupport); 95 out.writeInt(mEmcBearerSupport); 96 } 97 98 @Override equals(@ullable Object o)99 public boolean equals(@Nullable Object o) { 100 if (o == null || !(o instanceof LteVopsSupportInfo)) { 101 return false; 102 } 103 if (this == o) return true; 104 LteVopsSupportInfo other = (LteVopsSupportInfo) o; 105 return mVopsSupport == other.mVopsSupport 106 && mEmcBearerSupport == other.mEmcBearerSupport; 107 } 108 109 @Override hashCode()110 public int hashCode() { 111 return Objects.hash(mVopsSupport, mEmcBearerSupport); 112 } 113 114 /** 115 * @return string representation. 116 */ 117 @NonNull 118 @Override toString()119 public String toString() { 120 return ("LteVopsSupportInfo : " 121 + " mVopsSupport = " + mVopsSupport 122 + " mEmcBearerSupport = " + mEmcBearerSupport); 123 } 124 125 public static final @android.annotation.NonNull Creator<LteVopsSupportInfo> CREATOR = 126 new Creator<LteVopsSupportInfo>() { 127 @Override 128 public LteVopsSupportInfo createFromParcel(Parcel in) { 129 return new LteVopsSupportInfo(in); 130 } 131 132 @Override 133 public LteVopsSupportInfo[] newArray(int size) { 134 return new LteVopsSupportInfo[size]; 135 } 136 }; 137 LteVopsSupportInfo(Parcel in)138 private LteVopsSupportInfo(Parcel in) { 139 mVopsSupport = in.readInt(); 140 mEmcBearerSupport = in.readInt(); 141 } 142 } 143