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