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

Commit 8618d62a authored by Automerger Merge Worker's avatar Automerger Merge Worker
Browse files

Merge "Remove API getDefaultSimCountryIso() as per API council feedback" into...

Merge "Remove API getDefaultSimCountryIso() as per API council feedback" into rvc-dev am: dd3768ed am: dd8485a8

Change-Id: I4b4acd6d38d6b431f8fdf672c9f5335b8d0704e6
parents dee3e058 dd8485a8
Loading
Loading
Loading
Loading
+0 −1
Original line number Original line Diff line number Diff line
@@ -11597,7 +11597,6 @@ package android.telephony {
    method @Deprecated public boolean getDataEnabled();
    method @Deprecated public boolean getDataEnabled();
    method @Deprecated public boolean getDataEnabled(int);
    method @Deprecated public boolean getDataEnabled(int);
    method @Nullable public static android.content.ComponentName getDefaultRespondViaMessageApplication(@NonNull android.content.Context, boolean);
    method @Nullable public static android.content.ComponentName getDefaultRespondViaMessageApplication(@NonNull android.content.Context, boolean);
    method @NonNull public static String getDefaultSimCountryIso();
    method @NonNull public java.util.List<android.telephony.data.ApnSetting> getDevicePolicyOverrideApns(@NonNull android.content.Context);
    method @NonNull public java.util.List<android.telephony.data.ApnSetting> getDevicePolicyOverrideApns(@NonNull android.content.Context);
    method @Nullable @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public String getDeviceSoftwareVersion(int);
    method @Nullable @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public String getDeviceSoftwareVersion(int);
    method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public boolean getEmergencyCallbackMode();
    method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public boolean getEmergencyCallbackMode();
+5 −2
Original line number Original line Diff line number Diff line
@@ -19,6 +19,7 @@ package android.text.util;
import android.annotation.IntDef;
import android.annotation.IntDef;
import android.annotation.NonNull;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.Nullable;
import android.app.ActivityThread;
import android.compat.annotation.UnsupportedAppUsage;
import android.compat.annotation.UnsupportedAppUsage;
import android.content.Context;
import android.content.Context;
import android.telephony.PhoneNumberUtils;
import android.telephony.PhoneNumberUtils;
@@ -663,9 +664,11 @@ public class Linkify {
    private static void gatherTelLinks(ArrayList<LinkSpec> links, Spannable s,
    private static void gatherTelLinks(ArrayList<LinkSpec> links, Spannable s,
            @Nullable Context context) {
            @Nullable Context context) {
        PhoneNumberUtil phoneUtil = PhoneNumberUtil.getInstance();
        PhoneNumberUtil phoneUtil = PhoneNumberUtil.getInstance();
        final Context ctx = (context != null) ? context : ActivityThread.currentApplication();
        final String regionCode = (ctx != null) ? ctx.getSystemService(TelephonyManager.class).
                getSimCountryIso().toUpperCase(Locale.US) : Locale.getDefault().getCountry();
        Iterable<PhoneNumberMatch> matches = phoneUtil.findNumbers(s.toString(),
        Iterable<PhoneNumberMatch> matches = phoneUtil.findNumbers(s.toString(),
                TelephonyManager.getDefaultSimCountryIso().toUpperCase(Locale.US),
                regionCode, Leniency.POSSIBLE, Long.MAX_VALUE);
                Leniency.POSSIBLE, Long.MAX_VALUE);
        for (PhoneNumberMatch match : matches) {
        for (PhoneNumberMatch match : matches) {
            LinkSpec spec = new LinkSpec();
            LinkSpec spec = new LinkSpec();
            spec.url = "tel:" + PhoneNumberUtils.normalizeNumber(match.rawString());
            spec.url = "tel:" + PhoneNumberUtils.normalizeNumber(match.rawString());
+0 −23
Original line number Original line Diff line number Diff line
@@ -3762,29 +3762,6 @@ public class TelephonyManager {
        return getSimCountryIsoForPhone(getPhoneId());
        return getSimCountryIsoForPhone(getPhoneId());
    }
    }


    /**
     * Returns the ISO-3166 country code equivalent for the SIM provider's country code
     * of the default subscription
     * <p>
     * The ISO-3166 country code is provided in lowercase 2 character format.
     * @return the lowercase 2 character ISO-3166 country code, or empty string is not available.
     * <p>
     * Note: This API is introduced to unblock mainlining work as the following APIs in
     * Linkify.java invokes getSimCountryIso() without a context. TODO(Bug 144576376): remove
     * this API once the following APIs are redesigned to access telephonymanager with a context.
     *
     * {@link Linkify#addLinks(@NonNull Spannable text, @LinkifyMask int mask)}
     * {@link Linkify#addLinks(@NonNull Spannable text, @LinkifyMask int mask,
               @Nullable Function<String, URLSpan> urlSpanFactory)}
     *
     * @hide
     */
    @SystemApi
    @NonNull
    public static String getDefaultSimCountryIso() {
        return getSimCountryIso(SubscriptionManager.getDefaultSubscriptionId());
    }

    /**
    /**
     * Returns the ISO country code equivalent for the SIM provider's country code.
     * Returns the ISO country code equivalent for the SIM provider's country code.
     *
     *