From 6200bef5a981d92c80278f399f0c7d81238b7e7e Mon Sep 17 00:00:00 2001 From: linyuh Date: Mon, 5 Mar 2018 10:49:37 -0800 Subject: Disable phone number formatting for LATAM MCCs. Bug: 73718977 Test: MotorolaUtilsTest & PhoneNumberHelperTest PiperOrigin-RevId: 187889473 Change-Id: I00d58071ba18ddce5a09c07de9edd2d0956d6478 --- .../android/dialer/dialpadview/DialpadFragment.java | 4 +++- java/com/android/dialer/oem/MotorolaUtils.java | 19 +++++++++++++++++++ .../oem/res/values-mcc334/motorola_config.xml | 21 +++++++++++++++++++++ .../oem/res/values-mcc338/motorola_config.xml | 21 +++++++++++++++++++++ .../oem/res/values-mcc340/motorola_config.xml | 21 +++++++++++++++++++++ .../oem/res/values-mcc342/motorola_config.xml | 21 +++++++++++++++++++++ .../oem/res/values-mcc344/motorola_config.xml | 21 +++++++++++++++++++++ .../oem/res/values-mcc352/motorola_config.xml | 21 +++++++++++++++++++++ .../oem/res/values-mcc356/motorola_config.xml | 21 +++++++++++++++++++++ .../oem/res/values-mcc358/motorola_config.xml | 21 +++++++++++++++++++++ .../oem/res/values-mcc360/motorola_config.xml | 21 +++++++++++++++++++++ .../oem/res/values-mcc364/motorola_config.xml | 21 +++++++++++++++++++++ .../oem/res/values-mcc366/motorola_config.xml | 21 +++++++++++++++++++++ .../oem/res/values-mcc370/motorola_config.xml | 21 +++++++++++++++++++++ .../oem/res/values-mcc372/motorola_config.xml | 21 +++++++++++++++++++++ .../oem/res/values-mcc374/motorola_config.xml | 21 +++++++++++++++++++++ .../oem/res/values-mcc702/motorola_config.xml | 21 +++++++++++++++++++++ .../oem/res/values-mcc704/motorola_config.xml | 21 +++++++++++++++++++++ .../oem/res/values-mcc706/motorola_config.xml | 21 +++++++++++++++++++++ .../oem/res/values-mcc708/motorola_config.xml | 21 +++++++++++++++++++++ .../oem/res/values-mcc710/motorola_config.xml | 21 +++++++++++++++++++++ .../oem/res/values-mcc712/motorola_config.xml | 21 +++++++++++++++++++++ .../oem/res/values-mcc714/motorola_config.xml | 21 +++++++++++++++++++++ .../oem/res/values-mcc716/motorola_config.xml | 21 +++++++++++++++++++++ .../oem/res/values-mcc722/motorola_config.xml | 21 +++++++++++++++++++++ .../oem/res/values-mcc724/motorola_config.xml | 21 +++++++++++++++++++++ .../oem/res/values-mcc730/motorola_config.xml | 21 +++++++++++++++++++++ .../oem/res/values-mcc732/motorola_config.xml | 21 +++++++++++++++++++++ .../oem/res/values-mcc734/motorola_config.xml | 21 +++++++++++++++++++++ .../oem/res/values-mcc736/motorola_config.xml | 21 +++++++++++++++++++++ .../oem/res/values-mcc738/motorola_config.xml | 21 +++++++++++++++++++++ .../oem/res/values-mcc740/motorola_config.xml | 21 +++++++++++++++++++++ .../oem/res/values-mcc744/motorola_config.xml | 21 +++++++++++++++++++++ .../oem/res/values-mcc746/motorola_config.xml | 21 +++++++++++++++++++++ .../oem/res/values-mcc748/motorola_config.xml | 21 +++++++++++++++++++++ .../dialer/oem/res/values/motorola_config.xml | 3 +++ .../dialer/phonenumberutil/PhoneNumberHelper.java | 12 ++---------- 37 files changed, 720 insertions(+), 11 deletions(-) create mode 100644 java/com/android/dialer/oem/res/values-mcc334/motorola_config.xml create mode 100644 java/com/android/dialer/oem/res/values-mcc338/motorola_config.xml create mode 100644 java/com/android/dialer/oem/res/values-mcc340/motorola_config.xml create mode 100644 java/com/android/dialer/oem/res/values-mcc342/motorola_config.xml create mode 100644 java/com/android/dialer/oem/res/values-mcc344/motorola_config.xml create mode 100644 java/com/android/dialer/oem/res/values-mcc352/motorola_config.xml create mode 100644 java/com/android/dialer/oem/res/values-mcc356/motorola_config.xml create mode 100644 java/com/android/dialer/oem/res/values-mcc358/motorola_config.xml create mode 100644 java/com/android/dialer/oem/res/values-mcc360/motorola_config.xml create mode 100644 java/com/android/dialer/oem/res/values-mcc364/motorola_config.xml create mode 100644 java/com/android/dialer/oem/res/values-mcc366/motorola_config.xml create mode 100644 java/com/android/dialer/oem/res/values-mcc370/motorola_config.xml create mode 100644 java/com/android/dialer/oem/res/values-mcc372/motorola_config.xml create mode 100644 java/com/android/dialer/oem/res/values-mcc374/motorola_config.xml create mode 100644 java/com/android/dialer/oem/res/values-mcc702/motorola_config.xml create mode 100644 java/com/android/dialer/oem/res/values-mcc704/motorola_config.xml create mode 100644 java/com/android/dialer/oem/res/values-mcc706/motorola_config.xml create mode 100644 java/com/android/dialer/oem/res/values-mcc708/motorola_config.xml create mode 100644 java/com/android/dialer/oem/res/values-mcc710/motorola_config.xml create mode 100644 java/com/android/dialer/oem/res/values-mcc712/motorola_config.xml create mode 100644 java/com/android/dialer/oem/res/values-mcc714/motorola_config.xml create mode 100644 java/com/android/dialer/oem/res/values-mcc716/motorola_config.xml create mode 100644 java/com/android/dialer/oem/res/values-mcc722/motorola_config.xml create mode 100644 java/com/android/dialer/oem/res/values-mcc724/motorola_config.xml create mode 100644 java/com/android/dialer/oem/res/values-mcc730/motorola_config.xml create mode 100644 java/com/android/dialer/oem/res/values-mcc732/motorola_config.xml create mode 100644 java/com/android/dialer/oem/res/values-mcc734/motorola_config.xml create mode 100644 java/com/android/dialer/oem/res/values-mcc736/motorola_config.xml create mode 100644 java/com/android/dialer/oem/res/values-mcc738/motorola_config.xml create mode 100644 java/com/android/dialer/oem/res/values-mcc740/motorola_config.xml create mode 100644 java/com/android/dialer/oem/res/values-mcc744/motorola_config.xml create mode 100644 java/com/android/dialer/oem/res/values-mcc746/motorola_config.xml create mode 100644 java/com/android/dialer/oem/res/values-mcc748/motorola_config.xml (limited to 'java/com/android') diff --git a/java/com/android/dialer/dialpadview/DialpadFragment.java b/java/com/android/dialer/dialpadview/DialpadFragment.java index eeab6c428..5bb5139e1 100644 --- a/java/com/android/dialer/dialpadview/DialpadFragment.java +++ b/java/com/android/dialer/dialpadview/DialpadFragment.java @@ -393,7 +393,9 @@ public class DialpadFragment extends Fragment digits.addTextChangedListener(this); digits.setElegantTextHeight(false); - initPhoneNumberFormattingTextWatcherExecutor.executeSerial(getCurrentCountryIso()); + if (!MotorolaUtils.shouldDisablePhoneNumberFormatting(getContext())) { + initPhoneNumberFormattingTextWatcherExecutor.executeSerial(getCurrentCountryIso()); + } // Check for the presence of the keypad View oneButton = fragmentView.findViewById(R.id.one); diff --git a/java/com/android/dialer/oem/MotorolaUtils.java b/java/com/android/dialer/oem/MotorolaUtils.java index 1446a0219..993078d95 100644 --- a/java/com/android/dialer/oem/MotorolaUtils.java +++ b/java/com/android/dialer/oem/MotorolaUtils.java @@ -36,6 +36,9 @@ public class MotorolaUtils { private static final String CONFIG_WIFI_CALL_SHOW_ICON_IN_CALL_LOG_ENABLED = "wifi_call_show_icon_in_call_log_enabled"; + @VisibleForTesting + static final String CONFIG_DISABLE_PHONE_NUMBER_FORMATTING = "disable_phone_number_formatting"; + // This is used to check if a Motorola device supports HD voice call feature, which comes from // system feature setting. private static final String HD_CALL_FEATRURE = "com.motorola.software.sprint.hd_call"; @@ -46,6 +49,7 @@ public class MotorolaUtils { @VisibleForTesting static final String HIDDEN_MENU_FEATURE = "com.motorola.software.sprint.hidden_menu"; + private static Boolean disablePhoneNumberFormattingForTest = null; private static boolean hasCheckedSprintWifiCall; private static boolean supportSprintWifiCall; @@ -87,6 +91,16 @@ public class MotorolaUtils { && isSupportingSprintWifiCall(context); } + public static boolean shouldDisablePhoneNumberFormatting(Context context) { + if (disablePhoneNumberFormattingForTest != null) { + return disablePhoneNumberFormattingForTest; + } + + return ConfigProviderBindings.get(context) + .getBoolean(CONFIG_DISABLE_PHONE_NUMBER_FORMATTING, true) + && context.getResources().getBoolean(R.bool.motorola_disable_phone_number_formatting); + } + /** * Handle special char sequence entered in dialpad. This may launch special intent based on input. * @@ -129,6 +143,11 @@ public class MotorolaUtils { return supportSprintWifiCall; } + @VisibleForTesting(otherwise = VisibleForTesting.NONE) + public static void setDisablePhoneNumberFormattingForTest(boolean disablePhoneNumberFormatting) { + disablePhoneNumberFormattingForTest = disablePhoneNumberFormatting; + } + @VisibleForTesting public static void resetForTest() { hasCheckedSprintWifiCall = false; diff --git a/java/com/android/dialer/oem/res/values-mcc334/motorola_config.xml b/java/com/android/dialer/oem/res/values-mcc334/motorola_config.xml new file mode 100644 index 000000000..bfe0cb767 --- /dev/null +++ b/java/com/android/dialer/oem/res/values-mcc334/motorola_config.xml @@ -0,0 +1,21 @@ + + + + + + true + diff --git a/java/com/android/dialer/oem/res/values-mcc338/motorola_config.xml b/java/com/android/dialer/oem/res/values-mcc338/motorola_config.xml new file mode 100644 index 000000000..bfe0cb767 --- /dev/null +++ b/java/com/android/dialer/oem/res/values-mcc338/motorola_config.xml @@ -0,0 +1,21 @@ + + + + + + true + diff --git a/java/com/android/dialer/oem/res/values-mcc340/motorola_config.xml b/java/com/android/dialer/oem/res/values-mcc340/motorola_config.xml new file mode 100644 index 000000000..bfe0cb767 --- /dev/null +++ b/java/com/android/dialer/oem/res/values-mcc340/motorola_config.xml @@ -0,0 +1,21 @@ + + + + + + true + diff --git a/java/com/android/dialer/oem/res/values-mcc342/motorola_config.xml b/java/com/android/dialer/oem/res/values-mcc342/motorola_config.xml new file mode 100644 index 000000000..bfe0cb767 --- /dev/null +++ b/java/com/android/dialer/oem/res/values-mcc342/motorola_config.xml @@ -0,0 +1,21 @@ + + + + + + true + diff --git a/java/com/android/dialer/oem/res/values-mcc344/motorola_config.xml b/java/com/android/dialer/oem/res/values-mcc344/motorola_config.xml new file mode 100644 index 000000000..bfe0cb767 --- /dev/null +++ b/java/com/android/dialer/oem/res/values-mcc344/motorola_config.xml @@ -0,0 +1,21 @@ + + + + + + true + diff --git a/java/com/android/dialer/oem/res/values-mcc352/motorola_config.xml b/java/com/android/dialer/oem/res/values-mcc352/motorola_config.xml new file mode 100644 index 000000000..bfe0cb767 --- /dev/null +++ b/java/com/android/dialer/oem/res/values-mcc352/motorola_config.xml @@ -0,0 +1,21 @@ + + + + + + true + diff --git a/java/com/android/dialer/oem/res/values-mcc356/motorola_config.xml b/java/com/android/dialer/oem/res/values-mcc356/motorola_config.xml new file mode 100644 index 000000000..bfe0cb767 --- /dev/null +++ b/java/com/android/dialer/oem/res/values-mcc356/motorola_config.xml @@ -0,0 +1,21 @@ + + + + + + true + diff --git a/java/com/android/dialer/oem/res/values-mcc358/motorola_config.xml b/java/com/android/dialer/oem/res/values-mcc358/motorola_config.xml new file mode 100644 index 000000000..bfe0cb767 --- /dev/null +++ b/java/com/android/dialer/oem/res/values-mcc358/motorola_config.xml @@ -0,0 +1,21 @@ + + + + + + true + diff --git a/java/com/android/dialer/oem/res/values-mcc360/motorola_config.xml b/java/com/android/dialer/oem/res/values-mcc360/motorola_config.xml new file mode 100644 index 000000000..bfe0cb767 --- /dev/null +++ b/java/com/android/dialer/oem/res/values-mcc360/motorola_config.xml @@ -0,0 +1,21 @@ + + + + + + true + diff --git a/java/com/android/dialer/oem/res/values-mcc364/motorola_config.xml b/java/com/android/dialer/oem/res/values-mcc364/motorola_config.xml new file mode 100644 index 000000000..bfe0cb767 --- /dev/null +++ b/java/com/android/dialer/oem/res/values-mcc364/motorola_config.xml @@ -0,0 +1,21 @@ + + + + + + true + diff --git a/java/com/android/dialer/oem/res/values-mcc366/motorola_config.xml b/java/com/android/dialer/oem/res/values-mcc366/motorola_config.xml new file mode 100644 index 000000000..bfe0cb767 --- /dev/null +++ b/java/com/android/dialer/oem/res/values-mcc366/motorola_config.xml @@ -0,0 +1,21 @@ + + + + + + true + diff --git a/java/com/android/dialer/oem/res/values-mcc370/motorola_config.xml b/java/com/android/dialer/oem/res/values-mcc370/motorola_config.xml new file mode 100644 index 000000000..bfe0cb767 --- /dev/null +++ b/java/com/android/dialer/oem/res/values-mcc370/motorola_config.xml @@ -0,0 +1,21 @@ + + + + + + true + diff --git a/java/com/android/dialer/oem/res/values-mcc372/motorola_config.xml b/java/com/android/dialer/oem/res/values-mcc372/motorola_config.xml new file mode 100644 index 000000000..bfe0cb767 --- /dev/null +++ b/java/com/android/dialer/oem/res/values-mcc372/motorola_config.xml @@ -0,0 +1,21 @@ + + + + + + true + diff --git a/java/com/android/dialer/oem/res/values-mcc374/motorola_config.xml b/java/com/android/dialer/oem/res/values-mcc374/motorola_config.xml new file mode 100644 index 000000000..bfe0cb767 --- /dev/null +++ b/java/com/android/dialer/oem/res/values-mcc374/motorola_config.xml @@ -0,0 +1,21 @@ + + + + + + true + diff --git a/java/com/android/dialer/oem/res/values-mcc702/motorola_config.xml b/java/com/android/dialer/oem/res/values-mcc702/motorola_config.xml new file mode 100644 index 000000000..bfe0cb767 --- /dev/null +++ b/java/com/android/dialer/oem/res/values-mcc702/motorola_config.xml @@ -0,0 +1,21 @@ + + + + + + true + diff --git a/java/com/android/dialer/oem/res/values-mcc704/motorola_config.xml b/java/com/android/dialer/oem/res/values-mcc704/motorola_config.xml new file mode 100644 index 000000000..bfe0cb767 --- /dev/null +++ b/java/com/android/dialer/oem/res/values-mcc704/motorola_config.xml @@ -0,0 +1,21 @@ + + + + + + true + diff --git a/java/com/android/dialer/oem/res/values-mcc706/motorola_config.xml b/java/com/android/dialer/oem/res/values-mcc706/motorola_config.xml new file mode 100644 index 000000000..bfe0cb767 --- /dev/null +++ b/java/com/android/dialer/oem/res/values-mcc706/motorola_config.xml @@ -0,0 +1,21 @@ + + + + + + true + diff --git a/java/com/android/dialer/oem/res/values-mcc708/motorola_config.xml b/java/com/android/dialer/oem/res/values-mcc708/motorola_config.xml new file mode 100644 index 000000000..bfe0cb767 --- /dev/null +++ b/java/com/android/dialer/oem/res/values-mcc708/motorola_config.xml @@ -0,0 +1,21 @@ + + + + + + true + diff --git a/java/com/android/dialer/oem/res/values-mcc710/motorola_config.xml b/java/com/android/dialer/oem/res/values-mcc710/motorola_config.xml new file mode 100644 index 000000000..bfe0cb767 --- /dev/null +++ b/java/com/android/dialer/oem/res/values-mcc710/motorola_config.xml @@ -0,0 +1,21 @@ + + + + + + true + diff --git a/java/com/android/dialer/oem/res/values-mcc712/motorola_config.xml b/java/com/android/dialer/oem/res/values-mcc712/motorola_config.xml new file mode 100644 index 000000000..bfe0cb767 --- /dev/null +++ b/java/com/android/dialer/oem/res/values-mcc712/motorola_config.xml @@ -0,0 +1,21 @@ + + + + + + true + diff --git a/java/com/android/dialer/oem/res/values-mcc714/motorola_config.xml b/java/com/android/dialer/oem/res/values-mcc714/motorola_config.xml new file mode 100644 index 000000000..bfe0cb767 --- /dev/null +++ b/java/com/android/dialer/oem/res/values-mcc714/motorola_config.xml @@ -0,0 +1,21 @@ + + + + + + true + diff --git a/java/com/android/dialer/oem/res/values-mcc716/motorola_config.xml b/java/com/android/dialer/oem/res/values-mcc716/motorola_config.xml new file mode 100644 index 000000000..bfe0cb767 --- /dev/null +++ b/java/com/android/dialer/oem/res/values-mcc716/motorola_config.xml @@ -0,0 +1,21 @@ + + + + + + true + diff --git a/java/com/android/dialer/oem/res/values-mcc722/motorola_config.xml b/java/com/android/dialer/oem/res/values-mcc722/motorola_config.xml new file mode 100644 index 000000000..bfe0cb767 --- /dev/null +++ b/java/com/android/dialer/oem/res/values-mcc722/motorola_config.xml @@ -0,0 +1,21 @@ + + + + + + true + diff --git a/java/com/android/dialer/oem/res/values-mcc724/motorola_config.xml b/java/com/android/dialer/oem/res/values-mcc724/motorola_config.xml new file mode 100644 index 000000000..bfe0cb767 --- /dev/null +++ b/java/com/android/dialer/oem/res/values-mcc724/motorola_config.xml @@ -0,0 +1,21 @@ + + + + + + true + diff --git a/java/com/android/dialer/oem/res/values-mcc730/motorola_config.xml b/java/com/android/dialer/oem/res/values-mcc730/motorola_config.xml new file mode 100644 index 000000000..bfe0cb767 --- /dev/null +++ b/java/com/android/dialer/oem/res/values-mcc730/motorola_config.xml @@ -0,0 +1,21 @@ + + + + + + true + diff --git a/java/com/android/dialer/oem/res/values-mcc732/motorola_config.xml b/java/com/android/dialer/oem/res/values-mcc732/motorola_config.xml new file mode 100644 index 000000000..bfe0cb767 --- /dev/null +++ b/java/com/android/dialer/oem/res/values-mcc732/motorola_config.xml @@ -0,0 +1,21 @@ + + + + + + true + diff --git a/java/com/android/dialer/oem/res/values-mcc734/motorola_config.xml b/java/com/android/dialer/oem/res/values-mcc734/motorola_config.xml new file mode 100644 index 000000000..bfe0cb767 --- /dev/null +++ b/java/com/android/dialer/oem/res/values-mcc734/motorola_config.xml @@ -0,0 +1,21 @@ + + + + + + true + diff --git a/java/com/android/dialer/oem/res/values-mcc736/motorola_config.xml b/java/com/android/dialer/oem/res/values-mcc736/motorola_config.xml new file mode 100644 index 000000000..bfe0cb767 --- /dev/null +++ b/java/com/android/dialer/oem/res/values-mcc736/motorola_config.xml @@ -0,0 +1,21 @@ + + + + + + true + diff --git a/java/com/android/dialer/oem/res/values-mcc738/motorola_config.xml b/java/com/android/dialer/oem/res/values-mcc738/motorola_config.xml new file mode 100644 index 000000000..bfe0cb767 --- /dev/null +++ b/java/com/android/dialer/oem/res/values-mcc738/motorola_config.xml @@ -0,0 +1,21 @@ + + + + + + true + diff --git a/java/com/android/dialer/oem/res/values-mcc740/motorola_config.xml b/java/com/android/dialer/oem/res/values-mcc740/motorola_config.xml new file mode 100644 index 000000000..bfe0cb767 --- /dev/null +++ b/java/com/android/dialer/oem/res/values-mcc740/motorola_config.xml @@ -0,0 +1,21 @@ + + + + + + true + diff --git a/java/com/android/dialer/oem/res/values-mcc744/motorola_config.xml b/java/com/android/dialer/oem/res/values-mcc744/motorola_config.xml new file mode 100644 index 000000000..bfe0cb767 --- /dev/null +++ b/java/com/android/dialer/oem/res/values-mcc744/motorola_config.xml @@ -0,0 +1,21 @@ + + + + + + true + diff --git a/java/com/android/dialer/oem/res/values-mcc746/motorola_config.xml b/java/com/android/dialer/oem/res/values-mcc746/motorola_config.xml new file mode 100644 index 000000000..bfe0cb767 --- /dev/null +++ b/java/com/android/dialer/oem/res/values-mcc746/motorola_config.xml @@ -0,0 +1,21 @@ + + + + + + true + diff --git a/java/com/android/dialer/oem/res/values-mcc748/motorola_config.xml b/java/com/android/dialer/oem/res/values-mcc748/motorola_config.xml new file mode 100644 index 000000000..bfe0cb767 --- /dev/null +++ b/java/com/android/dialer/oem/res/values-mcc748/motorola_config.xml @@ -0,0 +1,21 @@ + + + + + + true + diff --git a/java/com/android/dialer/oem/res/values/motorola_config.xml b/java/com/android/dialer/oem/res/values/motorola_config.xml index fd9cee0a9..614514e53 100644 --- a/java/com/android/dialer/oem/res/values/motorola_config.xml +++ b/java/com/android/dialer/oem/res/values/motorola_config.xml @@ -47,4 +47,7 @@ com.cequint.ecid + + + false diff --git a/java/com/android/dialer/phonenumberutil/PhoneNumberHelper.java b/java/com/android/dialer/phonenumberutil/PhoneNumberHelper.java index f5e634670..e1051951e 100644 --- a/java/com/android/dialer/phonenumberutil/PhoneNumberHelper.java +++ b/java/com/android/dialer/phonenumberutil/PhoneNumberHelper.java @@ -33,16 +33,15 @@ import com.android.dialer.common.Assert; import com.android.dialer.common.LogUtil; import com.android.dialer.compat.CompatUtils; import com.android.dialer.compat.telephony.TelephonyManagerCompat; +import com.android.dialer.oem.MotorolaUtils; import com.android.dialer.phonenumbergeoutil.PhoneNumberGeoUtilComponent; import com.android.dialer.telecom.TelecomUtil; -import com.google.common.base.Ascii; import java.util.Arrays; import java.util.HashSet; import java.util.Set; public class PhoneNumberHelper { - private static final String TAG = "PhoneNumberUtil"; private static final Set LEGACY_UNKNOWN_NUMBERS = new HashSet<>(Arrays.asList("-1", "-2", "-3")); @@ -239,14 +238,7 @@ public class PhoneNumberHelper { return null; } - // Argentina phone number formats are complex and PhoneNumberUtils doesn't format all Argentina - // numbers correctly. - // To ensure consistent user experience, we disable phone number formatting for all numbers - // (not just Argentinian ones) for devices with Argentinian SIMs. - TelephonyManager telephonyManager = - (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); - if (telephonyManager != null - && "AR".equals(Ascii.toUpperCase(telephonyManager.getSimCountryIso()))) { + if (MotorolaUtils.shouldDisablePhoneNumberFormatting(context)) { return number; } -- cgit v1.2.3