Loading api/system-current.txt +1 −0 Original line number Original line Diff line number Diff line Loading @@ -8567,6 +8567,7 @@ 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 @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(); method @Nullable @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public String getIsimDomain(); method @Nullable @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public String getIsimDomain(); core/java/android/text/util/Linkify.java +1 −4 Original line number Original line Diff line number Diff line Loading @@ -663,11 +663,8 @@ 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 TelephonyManager tm = (context == null) ? TelephonyManager.getDefault() : TelephonyManager.from(context); Iterable<PhoneNumberMatch> matches = phoneUtil.findNumbers(s.toString(), Iterable<PhoneNumberMatch> matches = phoneUtil.findNumbers(s.toString(), tm.getSimCountryIso().toUpperCase(Locale.US), TelephonyManager.getDefaultSimCountryIso().toUpperCase(Locale.US), 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(); Loading telephony/java/android/telephony/TelephonyManager.java +25 −2 Original line number Original line Diff line number Diff line Loading @@ -3573,6 +3573,29 @@ 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. * * Loading @@ -3580,7 +3603,7 @@ public class TelephonyManager { * @hide * @hide */ */ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P) @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P) public String getSimCountryIso(int subId) { public static String getSimCountryIso(int subId) { int phoneId = SubscriptionManager.getPhoneId(subId); int phoneId = SubscriptionManager.getPhoneId(subId); return getSimCountryIsoForPhone(phoneId); return getSimCountryIsoForPhone(phoneId); } } Loading @@ -3591,7 +3614,7 @@ public class TelephonyManager { * @hide * @hide */ */ @UnsupportedAppUsage @UnsupportedAppUsage public String getSimCountryIsoForPhone(int phoneId) { public static String getSimCountryIsoForPhone(int phoneId) { return getTelephonyProperty(phoneId, TelephonyProperties.icc_operator_iso_country(), ""); return getTelephonyProperty(phoneId, TelephonyProperties.icc_operator_iso_country(), ""); } } Loading Loading
api/system-current.txt +1 −0 Original line number Original line Diff line number Diff line Loading @@ -8567,6 +8567,7 @@ 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 @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(); method @Nullable @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public String getIsimDomain(); method @Nullable @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public String getIsimDomain();
core/java/android/text/util/Linkify.java +1 −4 Original line number Original line Diff line number Diff line Loading @@ -663,11 +663,8 @@ 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 TelephonyManager tm = (context == null) ? TelephonyManager.getDefault() : TelephonyManager.from(context); Iterable<PhoneNumberMatch> matches = phoneUtil.findNumbers(s.toString(), Iterable<PhoneNumberMatch> matches = phoneUtil.findNumbers(s.toString(), tm.getSimCountryIso().toUpperCase(Locale.US), TelephonyManager.getDefaultSimCountryIso().toUpperCase(Locale.US), 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(); Loading
telephony/java/android/telephony/TelephonyManager.java +25 −2 Original line number Original line Diff line number Diff line Loading @@ -3573,6 +3573,29 @@ 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. * * Loading @@ -3580,7 +3603,7 @@ public class TelephonyManager { * @hide * @hide */ */ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P) @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P) public String getSimCountryIso(int subId) { public static String getSimCountryIso(int subId) { int phoneId = SubscriptionManager.getPhoneId(subId); int phoneId = SubscriptionManager.getPhoneId(subId); return getSimCountryIsoForPhone(phoneId); return getSimCountryIsoForPhone(phoneId); } } Loading @@ -3591,7 +3614,7 @@ public class TelephonyManager { * @hide * @hide */ */ @UnsupportedAppUsage @UnsupportedAppUsage public String getSimCountryIsoForPhone(int phoneId) { public static String getSimCountryIsoForPhone(int phoneId) { return getTelephonyProperty(phoneId, TelephonyProperties.icc_operator_iso_country(), ""); return getTelephonyProperty(phoneId, TelephonyProperties.icc_operator_iso_country(), ""); } } Loading