1 /* 2 * Copyright (C) 2019 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.timezone; 18 19 import android.annotation.NonNull; 20 21 import java.util.Objects; 22 23 /** 24 * Information about a telephony network. 25 * 26 * @hide 27 */ 28 public final class TelephonyNetwork { 29 30 @NonNull 31 private final com.android.i18n.timezone.TelephonyNetwork mDelegate; 32 TelephonyNetwork(@onNull com.android.i18n.timezone.TelephonyNetwork delegate)33 TelephonyNetwork(@NonNull com.android.i18n.timezone.TelephonyNetwork delegate) { 34 mDelegate = Objects.requireNonNull(delegate); 35 } 36 37 /** 38 * Returns the Mobile Country Code of the network. 39 */ 40 @NonNull getMcc()41 public String getMcc() { 42 return mDelegate.getMcc(); 43 } 44 45 /** 46 * Returns the Mobile Network Code of the network. 47 */ 48 @NonNull getMnc()49 public String getMnc() { 50 return mDelegate.getMnc(); 51 } 52 53 /** 54 * Returns the country in which the network operates as an ISO 3166 alpha-2 (lower case). 55 */ 56 @NonNull getCountryIsoCode()57 public String getCountryIsoCode() { 58 return mDelegate.getCountryIsoCode(); 59 } 60 61 @Override equals(Object o)62 public boolean equals(Object o) { 63 if (this == o) { 64 return true; 65 } 66 if (o == null || getClass() != o.getClass()) { 67 return false; 68 } 69 TelephonyNetwork that = (TelephonyNetwork) o; 70 return mDelegate.equals(that.mDelegate); 71 } 72 73 @Override hashCode()74 public int hashCode() { 75 return Objects.hash(mDelegate); 76 } 77 78 @Override toString()79 public String toString() { 80 return "TelephonyNetwork{" 81 + "mDelegate=" + mDelegate 82 + '}'; 83 } 84 } 85