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