Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ae1cbabd authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Made findCountriesByMcc use delegate like findNetworkByMccMnc" into main

parents 325e3eb0 c8064f32
Loading
Loading
Loading
Loading
+68 −0
Original line number Original line Diff line number Diff line
/*
 * Copyright (C) 2025 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.timezone;

import android.annotation.NonNull;

import java.util.Objects;
import java.util.Set;

/**
 * Information about a telephony network.
 *
 * @hide
 */
public final class MobileCountries {

    @NonNull
    private final com.android.i18n.timezone.MobileCountries mDelegate;

    MobileCountries(@NonNull com.android.i18n.timezone.MobileCountries delegate) {
        mDelegate = Objects.requireNonNull(delegate);
    }

    /**
     * Returns the Mobile Country Code of the network.
     */
    @NonNull
    public String getMcc() {
        return mDelegate.getMcc();
    }

    /**
     * Returns the Mobile Country Code of the network.
     */
    @NonNull
    public Set<String> getCountryIsoCodes() {
        return mDelegate.getCountryIsoCodes();
    }

    /**
     * Returns the country in which the network operates as an ISO 3166 alpha-2 (lower case).
     */
    @NonNull
    public String getDefaultCountryIsoCode() {
        return mDelegate.getDefaultCountryIsoCode();
    }

    @Override
    public String toString() {
        return "MobileCountries{"
                + "mDelegate=" + mDelegate
                + '}';
    }
}
+5 −4
Original line number Original line Diff line number Diff line
@@ -19,7 +19,6 @@ package android.timezone;
import android.annotation.NonNull;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.Nullable;


import com.android.i18n.timezone.MobileCountries;
import com.android.icu.Flags;
import com.android.icu.Flags;


import java.util.Objects;
import java.util.Objects;
@@ -59,11 +58,13 @@ public final class TelephonyNetworkFinder {
     */
     */
    @Nullable
    @Nullable
    public MobileCountries findCountriesByMcc(@NonNull String mcc) {
    public MobileCountries findCountriesByMcc(@NonNull String mcc) {
        Objects.requireNonNull(mcc);

        if (!Flags.telephonyLookupMccExtension()) {
        if (!Flags.telephonyLookupMccExtension()) {
            return null;
            return null;
        }
        }
        return mDelegate.findCountriesByMcc(mcc);
        Objects.requireNonNull(mcc);

        com.android.i18n.timezone.MobileCountries countriesByMcc =
                mDelegate.findCountriesByMcc(mcc);
        return countriesByMcc != null ? new MobileCountries(countriesByMcc) : null;
    }
    }
}
}