blob: a81a516c4b33b7a0c34ab3a30d254471d67e3a83 [file] [log] [blame]
Neil Fullerf7346ec2019-08-30 18:02:47 +01001/*
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
17package android.timezone;
18
19import android.annotation.NonNull;
20import android.annotation.Nullable;
21import android.annotation.SystemApi;
22
23import java.util.Objects;
24
25/**
26 * A class that can find telephony networks loaded via {@link TelephonyLookup}.
27 *
28 * @hide
29 */
30@SystemApi(client = SystemApi.Client.MODULE_LIBRARIES)
31public class TelephonyNetworkFinder {
32
33 @NonNull
34 private final libcore.timezone.TelephonyNetworkFinder mDelegate;
35
36 TelephonyNetworkFinder(libcore.timezone.TelephonyNetworkFinder delegate) {
37 mDelegate = Objects.requireNonNull(delegate);
38 }
39
40 /**
41 * Returns information held about a specific MCC + MNC combination. It is expected for this
42 * method to return {@code null}. Only known, unusual networks will typically have information
43 * returned, e.g. if they operate in countries other than the one suggested by their MCC.
44 */
45 @Nullable
46 public TelephonyNetwork findNetworkByMccMnc(@NonNull String mcc, @NonNull String mnc) {
47 Objects.requireNonNull(mcc);
48 Objects.requireNonNull(mnc);
49
50 libcore.timezone.TelephonyNetwork telephonyNetworkDelegate =
51 mDelegate.findNetworkByMccMnc(mcc, mnc);
52 return telephonyNetworkDelegate != null
53 ? new TelephonyNetwork(telephonyNetworkDelegate) : null;
54 }
55}