diff options
author | Treehugger Robot <treehugger-gerrit@google.com> | 2018-03-05 20:56:18 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2018-03-05 20:56:18 +0000 |
commit | 74b03c70e149d91c527245849fe663ce3e03ae7a (patch) | |
tree | 7ac1a8eb295940661b3499c0c0246eae3423e1ee | |
parent | 1efd9579502d164bac214006d582ca26e2bc123e (diff) | |
parent | 6200bef5a981d92c80278f399f0c7d81238b7e7e (diff) |
Merge changes I00d58071,I98cea86b
* changes:
Disable phone number formatting for LATAM MCCs.
Check if the activity is still alive before refreshing unread tab counts.
38 files changed, 721 insertions, 12 deletions
diff --git a/java/com/android/dialer/app/calllog/CallLogFragment.java b/java/com/android/dialer/app/calllog/CallLogFragment.java index 7e49cc965..816801437 100644 --- a/java/com/android/dialer/app/calllog/CallLogFragment.java +++ b/java/com/android/dialer/app/calllog/CallLogFragment.java @@ -489,7 +489,7 @@ public class CallLogFragment extends Fragment @Override public void fetchCalls() { callLogQueryHandler.fetchCalls(callTypeFilter, dateLimit); - if (!isCallLogActivity) { + if (!isCallLogActivity && getActivity() != null && !getActivity().isFinishing()) { FragmentUtils.getParentUnsafe(this, CallLogFragmentListener.class).updateTabUnreadCounts(); } } 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 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + ~ Copyright (C) 2018 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 + --> + +<resources> + <!-- Flag to control whether to disable phone number formatting --> + <bool name="motorola_disable_phone_number_formatting">true</bool> +</resources> 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 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + ~ Copyright (C) 2018 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 + --> + +<resources> + <!-- Flag to control whether to disable phone number formatting --> + <bool name="motorola_disable_phone_number_formatting">true</bool> +</resources> 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 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + ~ Copyright (C) 2018 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 + --> + +<resources> + <!-- Flag to control whether to disable phone number formatting --> + <bool name="motorola_disable_phone_number_formatting">true</bool> +</resources> 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 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + ~ Copyright (C) 2018 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 + --> + +<resources> + <!-- Flag to control whether to disable phone number formatting --> + <bool name="motorola_disable_phone_number_formatting">true</bool> +</resources> 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 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + ~ Copyright (C) 2018 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 + --> + +<resources> + <!-- Flag to control whether to disable phone number formatting --> + <bool name="motorola_disable_phone_number_formatting">true</bool> +</resources> 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 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + ~ Copyright (C) 2018 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 + --> + +<resources> + <!-- Flag to control whether to disable phone number formatting --> + <bool name="motorola_disable_phone_number_formatting">true</bool> +</resources> 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 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + ~ Copyright (C) 2018 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 + --> + +<resources> + <!-- Flag to control whether to disable phone number formatting --> + <bool name="motorola_disable_phone_number_formatting">true</bool> +</resources> 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 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + ~ Copyright (C) 2018 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 + --> + +<resources> + <!-- Flag to control whether to disable phone number formatting --> + <bool name="motorola_disable_phone_number_formatting">true</bool> +</resources> 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 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + ~ Copyright (C) 2018 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 + --> + +<resources> + <!-- Flag to control whether to disable phone number formatting --> + <bool name="motorola_disable_phone_number_formatting">true</bool> +</resources> 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 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + ~ Copyright (C) 2018 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 + --> + +<resources> + <!-- Flag to control whether to disable phone number formatting --> + <bool name="motorola_disable_phone_number_formatting">true</bool> +</resources> 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 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + ~ Copyright (C) 2018 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 + --> + +<resources> + <!-- Flag to control whether to disable phone number formatting --> + <bool name="motorola_disable_phone_number_formatting">true</bool> +</resources> 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 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + ~ Copyright (C) 2018 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 + --> + +<resources> + <!-- Flag to control whether to disable phone number formatting --> + <bool name="motorola_disable_phone_number_formatting">true</bool> +</resources> 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 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + ~ Copyright (C) 2018 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 + --> + +<resources> + <!-- Flag to control whether to disable phone number formatting --> + <bool name="motorola_disable_phone_number_formatting">true</bool> +</resources> 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 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + ~ Copyright (C) 2018 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 + --> + +<resources> + <!-- Flag to control whether to disable phone number formatting --> + <bool name="motorola_disable_phone_number_formatting">true</bool> +</resources> 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 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + ~ Copyright (C) 2018 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 + --> + +<resources> + <!-- Flag to control whether to disable phone number formatting --> + <bool name="motorola_disable_phone_number_formatting">true</bool> +</resources> 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 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + ~ Copyright (C) 2018 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 + --> + +<resources> + <!-- Flag to control whether to disable phone number formatting --> + <bool name="motorola_disable_phone_number_formatting">true</bool> +</resources> 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 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + ~ Copyright (C) 2018 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 + --> + +<resources> + <!-- Flag to control whether to disable phone number formatting --> + <bool name="motorola_disable_phone_number_formatting">true</bool> +</resources> 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 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + ~ Copyright (C) 2018 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 + --> + +<resources> + <!-- Flag to control whether to disable phone number formatting --> + <bool name="motorola_disable_phone_number_formatting">true</bool> +</resources> 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 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + ~ Copyright (C) 2018 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 + --> + +<resources> + <!-- Flag to control whether to disable phone number formatting --> + <bool name="motorola_disable_phone_number_formatting">true</bool> +</resources> 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 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + ~ Copyright (C) 2018 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 + --> + +<resources> + <!-- Flag to control whether to disable phone number formatting --> + <bool name="motorola_disable_phone_number_formatting">true</bool> +</resources> 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 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + ~ Copyright (C) 2018 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 + --> + +<resources> + <!-- Flag to control whether to disable phone number formatting --> + <bool name="motorola_disable_phone_number_formatting">true</bool> +</resources> 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 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + ~ Copyright (C) 2018 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 + --> + +<resources> + <!-- Flag to control whether to disable phone number formatting --> + <bool name="motorola_disable_phone_number_formatting">true</bool> +</resources> 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 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + ~ Copyright (C) 2018 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 + --> + +<resources> + <!-- Flag to control whether to disable phone number formatting --> + <bool name="motorola_disable_phone_number_formatting">true</bool> +</resources> 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 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + ~ Copyright (C) 2018 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 + --> + +<resources> + <!-- Flag to control whether to disable phone number formatting --> + <bool name="motorola_disable_phone_number_formatting">true</bool> +</resources> 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 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + ~ Copyright (C) 2018 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 + --> + +<resources> + <!-- Flag to control whether to disable phone number formatting --> + <bool name="motorola_disable_phone_number_formatting">true</bool> +</resources> 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 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + ~ Copyright (C) 2018 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 + --> + +<resources> + <!-- Flag to control whether to disable phone number formatting --> + <bool name="motorola_disable_phone_number_formatting">true</bool> +</resources> 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 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + ~ Copyright (C) 2018 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 + --> + +<resources> + <!-- Flag to control whether to disable phone number formatting --> + <bool name="motorola_disable_phone_number_formatting">true</bool> +</resources> 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 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + ~ Copyright (C) 2018 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 + --> + +<resources> + <!-- Flag to control whether to disable phone number formatting --> + <bool name="motorola_disable_phone_number_formatting">true</bool> +</resources> 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 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + ~ Copyright (C) 2018 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 + --> + +<resources> + <!-- Flag to control whether to disable phone number formatting --> + <bool name="motorola_disable_phone_number_formatting">true</bool> +</resources> 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 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + ~ Copyright (C) 2018 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 + --> + +<resources> + <!-- Flag to control whether to disable phone number formatting --> + <bool name="motorola_disable_phone_number_formatting">true</bool> +</resources> 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 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + ~ Copyright (C) 2018 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 + --> + +<resources> + <!-- Flag to control whether to disable phone number formatting --> + <bool name="motorola_disable_phone_number_formatting">true</bool> +</resources> 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 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + ~ Copyright (C) 2018 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 + --> + +<resources> + <!-- Flag to control whether to disable phone number formatting --> + <bool name="motorola_disable_phone_number_formatting">true</bool> +</resources> 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 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + ~ Copyright (C) 2018 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 + --> + +<resources> + <!-- Flag to control whether to disable phone number formatting --> + <bool name="motorola_disable_phone_number_formatting">true</bool> +</resources> 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 @@ <string-array name="cequint_providers"> <item>com.cequint.ecid</item> </string-array> + + <!-- Flag to control whether to disable phone number formatting --> + <bool name="motorola_disable_phone_number_formatting">false</bool> </resources> 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<String> 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; } |