1 /* 2 * Copyright (C) 2022 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.mockmodem; 18 19 import android.annotation.NonNull; 20 import android.telephony.AccessNetworkConstants; 21 import android.telephony.NetworkRegistrationInfo; 22 23 /** 24 * Contains attributes required to determine the domain for a telephony service 25 * @hide 26 */ 27 public final class MockEmergencyRegResult { 28 29 /** 30 * Indicates the cellular network type of the acquired system. 31 */ 32 private @AccessNetworkConstants.RadioAccessNetworkType int mAccessNetworkType; 33 34 /** 35 * Registration state of the acquired system. 36 */ 37 private @NetworkRegistrationInfo.RegistrationState int mRegState; 38 39 /** 40 * EMC domain indicates the current domain of the acquired system. 41 */ 42 private @NetworkRegistrationInfo.Domain int mDomain; 43 44 /** 45 * Indicates whether the network supports voice over PS network. 46 */ 47 private boolean mIsVopsSupported; 48 49 /** 50 * This indicates if camped network supports VoLTE emergency bearers. 51 * This should only be set if the UE is in LTE mode. 52 */ 53 private boolean mIsEmcBearerSupported; 54 55 /** 56 * The value of the network provided EMC in 5G Registration ACCEPT. 57 * This should be set only if the UE is in 5G mode. 58 */ 59 private int mNwProvidedEmc; 60 61 /** 62 * The value of the network provided EMF(EPS Fallback) in 5G Registration ACCEPT. 63 * This should be set only if the UE is in 5G mode. 64 */ 65 private int mNwProvidedEmf; 66 67 /** 3-digit Mobile Country Code, 000..999, empty string if unknown. */ 68 private @NonNull String mMcc; 69 70 /** 2 or 3-digit Mobile Network Code, 00..999, empty string if unknown. */ 71 private @NonNull String mMnc; 72 73 /** 74 * Constructor 75 * @param accessNetwork Indicates the network type of the acquired system. 76 * @param regState Indicates the registration state of the acquired system. 77 * @param domain Indicates the current domain of the acquired system. 78 * @param isVopsSupported Indicates whether the network supports voice over PS network. 79 * @param isEmcBearerSupported Indicates if camped network supports VoLTE emergency bearers. 80 * @param emc The value of the network provided EMC in 5G Registration ACCEPT. 81 * @param emf The value of the network provided EMF(EPS Fallback) in 5G Registration ACCEPT. 82 * @param mcc Mobile country code, empty string if unknown. 83 * @param mnc Mobile network code, empty string if unknown. 84 */ MockEmergencyRegResult( @ccessNetworkConstants.RadioAccessNetworkType int accessNetwork, @NetworkRegistrationInfo.RegistrationState int regState, @NetworkRegistrationInfo.Domain int domain, boolean isVopsSupported, boolean isEmcBearerSupported, int emc, int emf, @NonNull String mcc, @NonNull String mnc)85 public MockEmergencyRegResult( 86 @AccessNetworkConstants.RadioAccessNetworkType int accessNetwork, 87 @NetworkRegistrationInfo.RegistrationState int regState, 88 @NetworkRegistrationInfo.Domain int domain, 89 boolean isVopsSupported, boolean isEmcBearerSupported, int emc, int emf, 90 @NonNull String mcc, @NonNull String mnc) { 91 mAccessNetworkType = accessNetwork; 92 mRegState = regState; 93 mDomain = domain; 94 mIsVopsSupported = isVopsSupported; 95 mIsEmcBearerSupported = isEmcBearerSupported; 96 mNwProvidedEmc = emc; 97 mNwProvidedEmf = emf; 98 mMcc = mcc; 99 mMnc = mnc; 100 } 101 102 /** 103 * Returns the cellular access network type of the acquired system. 104 * 105 * @return the cellular network type. 106 */ getAccessNetwork()107 public @AccessNetworkConstants.RadioAccessNetworkType int getAccessNetwork() { 108 return mAccessNetworkType; 109 } 110 111 /** 112 * Returns the registration state of the acquired system. 113 * 114 * @return the registration state. 115 */ getRegState()116 public @NetworkRegistrationInfo.RegistrationState int getRegState() { 117 return mRegState; 118 } 119 120 /** 121 * Returns the current domain of the acquired system. 122 * 123 * @return the current domain. 124 */ getDomain()125 public @NetworkRegistrationInfo.Domain int getDomain() { 126 return mDomain; 127 } 128 129 /** 130 * Returns whether the network supports voice over PS network. 131 * 132 * @return {@code true} if the network supports voice over PS network. 133 */ isVopsSupported()134 public boolean isVopsSupported() { 135 return mIsVopsSupported; 136 } 137 138 /** 139 * Returns whether camped network supports VoLTE emergency bearers. 140 * This is not valid if the UE is not in LTE mode. 141 * 142 * @return {@code true} if the network supports VoLTE emergency bearers. 143 */ isEmcBearerSupported()144 public boolean isEmcBearerSupported() { 145 return mIsEmcBearerSupported; 146 } 147 148 /** 149 * Returns the value of the network provided EMC in 5G Registration ACCEPT. 150 * This is not valid if UE is not in 5G mode. 151 * 152 * @return the value of the network provided EMC. 153 */ getNwProvidedEmc()154 public int getNwProvidedEmc() { 155 return mNwProvidedEmc; 156 } 157 158 /** 159 * Returns the value of the network provided EMF(EPS Fallback) in 5G Registration ACCEPT. 160 * This is not valid if UE is not in 5G mode. 161 * 162 * @return the value of the network provided EMF. 163 */ getNwProvidedEmf()164 public int getNwProvidedEmf() { 165 return mNwProvidedEmf; 166 } 167 168 /** 169 * Returns 3-digit Mobile Country Code. 170 * 171 * @return Mobile Country Code. 172 */ getMcc()173 public @NonNull String getMcc() { 174 return mMcc; 175 } 176 177 /** 178 * Returns 2 or 3-digit Mobile Network Code. 179 * 180 * @return Mobile Network Code. 181 */ getMnc()182 public @NonNull String getMnc() { 183 return mMnc; 184 } 185 } 186