Merge "Change Linkify to use defaultCountry if simCountryIso is empty." am: 9a35062714 am: f8e6dae80b am: a9b0f72e10
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2606688 Change-Id: Ieff08a51203ae55de149344f1f9a471d8a74998f Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
committed by
Automerger Merge Worker
commit
c00d937202
@@ -31,6 +31,7 @@ import android.text.Spanned;
|
||||
import android.text.method.LinkMovementMethod;
|
||||
import android.text.method.MovementMethod;
|
||||
import android.text.style.URLSpan;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.util.Patterns;
|
||||
import android.webkit.WebView;
|
||||
@@ -672,8 +673,15 @@ public class Linkify {
|
||||
@Nullable Context context) {
|
||||
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();
|
||||
String regionCode = Locale.getDefault().getCountry();
|
||||
if (ctx != null) {
|
||||
String simCountryIso = ctx.getSystemService(TelephonyManager.class).getSimCountryIso();
|
||||
if (!TextUtils.isEmpty(simCountryIso)) {
|
||||
// Assign simCountryIso if it is available
|
||||
regionCode = simCountryIso.toUpperCase(Locale.US);
|
||||
}
|
||||
}
|
||||
|
||||
Iterable<PhoneNumberMatch> matches = phoneUtil.findNumbers(s.toString(),
|
||||
regionCode, Leniency.POSSIBLE, Long.MAX_VALUE);
|
||||
for (PhoneNumberMatch match : matches) {
|
||||
|
||||
Reference in New Issue
Block a user