Add configuration for when we show decimal and barcode device id

Bug: 69063060,71706655
Test: SpecialCharSequenceMgrTest
PiperOrigin-RevId: 185915881
Change-Id: I7d82303979b381d1b0de2a8f30d7d577cccf65d9
diff --git a/java/com/android/dialer/dialpadview/SpecialCharSequenceMgr.java b/java/com/android/dialer/dialpadview/SpecialCharSequenceMgr.java
index c349d22..3321d93 100644
--- a/java/com/android/dialer/dialpadview/SpecialCharSequenceMgr.java
+++ b/java/com/android/dialer/dialpadview/SpecialCharSequenceMgr.java
@@ -341,11 +341,22 @@
         for (int slot = 0; slot < telephonyManager.getPhoneCount(); slot++) {
           String deviceId = telephonyManager.getDeviceId(slot);
           if (!TextUtils.isEmpty(deviceId)) {
-            addDeviceIdRow(holder, deviceId, /* showBarcode */ false);
+            addDeviceIdRow(
+                holder,
+                deviceId,
+                /* showDecimal */
+                context.getResources().getBoolean(R.bool.show_device_id_in_hex_and_decimal),
+                /* showBarcode */ false);
           }
         }
       } else {
-        addDeviceIdRow(holder, telephonyManager.getDeviceId(), /* showBarcode */ true);
+        addDeviceIdRow(
+            holder,
+            telephonyManager.getDeviceId(),
+            /* showDecimal */
+            context.getResources().getBoolean(R.bool.show_device_id_in_hex_and_decimal),
+            /* showBarcode */
+            context.getResources().getBoolean(R.bool.show_device_id_as_barcode));
       }
 
       new AlertDialog.Builder(context)
@@ -361,7 +372,8 @@
     return false;
   }
 
-  private static void addDeviceIdRow(ViewGroup holder, String deviceId, boolean showBarcode) {
+  private static void addDeviceIdRow(
+      ViewGroup holder, String deviceId, boolean showDecimal, boolean showBarcode) {
     if (TextUtils.isEmpty(deviceId)) {
       return;
     }
@@ -378,11 +390,12 @@
 
     // If this is the valid length IMEI or MEID (14 digits), show it in all formats, otherwise fall
     // back to just showing the raw hex
-    if (hex.length() == 14) {
+    if (hex.length() == 14 && showDecimal) {
       ((TextView) row.findViewById(R.id.deviceid_hex)).setText(hex);
       ((TextView) row.findViewById(R.id.deviceid_dec)).setText(getDecimalFromHex(hex));
       row.findViewById(R.id.deviceid_dec_label).setVisibility(View.VISIBLE);
     } else {
+      row.findViewById(R.id.deviceid_hex_label).setVisibility(View.GONE);
       ((TextView) row.findViewById(R.id.deviceid_hex)).setText(deviceId);
     }
 
diff --git a/java/com/android/dialer/dialpadview/res/layout/row_deviceid.xml b/java/com/android/dialer/dialpadview/res/layout/row_deviceid.xml
index 53f3e5d..efeeb5f 100644
--- a/java/com/android/dialer/dialpadview/res/layout/row_deviceid.xml
+++ b/java/com/android/dialer/dialpadview/res/layout/row_deviceid.xml
@@ -19,6 +19,7 @@
     android:layout_marginTop="?dialogPreferredPadding"
     android:orientation="vertical">
   <TextView
+      android:id="@+id/deviceid_hex_label"
       style="@style/DeviceIdBody"
       android:layout_width="wrap_content"
       android:layout_height="wrap_content"
diff --git a/java/com/android/dialer/dialpadview/res/values-mcc310-mnc000-spnsprint/bools.xml b/java/com/android/dialer/dialpadview/res/values-mcc310-mnc000-spnsprint/bools.xml
new file mode 100644
index 0000000..99fa7da
--- /dev/null
+++ b/java/com/android/dialer/dialpadview/res/values-mcc310-mnc000-spnsprint/bools.xml
@@ -0,0 +1,19 @@
+<?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>
+  <bool name="show_device_id_as_barcode">true</bool>
+</resources>
diff --git a/java/com/android/dialer/dialpadview/res/values-mcc310-mnc120/bools.xml b/java/com/android/dialer/dialpadview/res/values-mcc310-mnc120/bools.xml
new file mode 100644
index 0000000..99fa7da
--- /dev/null
+++ b/java/com/android/dialer/dialpadview/res/values-mcc310-mnc120/bools.xml
@@ -0,0 +1,19 @@
+<?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>
+  <bool name="show_device_id_as_barcode">true</bool>
+</resources>
diff --git a/java/com/android/dialer/dialpadview/res/values-mcc311-mnc480/bools.xml b/java/com/android/dialer/dialpadview/res/values-mcc311-mnc480/bools.xml
new file mode 100644
index 0000000..7e549e8
--- /dev/null
+++ b/java/com/android/dialer/dialpadview/res/values-mcc311-mnc480/bools.xml
@@ -0,0 +1,19 @@
+<?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>
+  <bool name="show_device_id_in_hex_and_decimal">true</bool>
+</resources>
diff --git a/java/com/android/dialer/dialpadview/res/values-mcc311-mnc490/bools.xml b/java/com/android/dialer/dialpadview/res/values-mcc311-mnc490/bools.xml
new file mode 100644
index 0000000..99fa7da
--- /dev/null
+++ b/java/com/android/dialer/dialpadview/res/values-mcc311-mnc490/bools.xml
@@ -0,0 +1,19 @@
+<?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>
+  <bool name="show_device_id_as_barcode">true</bool>
+</resources>
diff --git a/java/com/android/dialer/dialpadview/res/values-mcc311-mnc870/bools.xml b/java/com/android/dialer/dialpadview/res/values-mcc311-mnc870/bools.xml
new file mode 100644
index 0000000..99fa7da
--- /dev/null
+++ b/java/com/android/dialer/dialpadview/res/values-mcc311-mnc870/bools.xml
@@ -0,0 +1,19 @@
+<?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>
+  <bool name="show_device_id_as_barcode">true</bool>
+</resources>
diff --git a/java/com/android/dialer/dialpadview/res/values-mcc312-mnc530/bools.xml b/java/com/android/dialer/dialpadview/res/values-mcc312-mnc530/bools.xml
new file mode 100644
index 0000000..99fa7da
--- /dev/null
+++ b/java/com/android/dialer/dialpadview/res/values-mcc312-mnc530/bools.xml
@@ -0,0 +1,19 @@
+<?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>
+  <bool name="show_device_id_as_barcode">true</bool>
+</resources>
diff --git a/java/com/android/dialer/dialpadview/res/values-mcc316-mnc010/bools.xml b/java/com/android/dialer/dialpadview/res/values-mcc316-mnc010/bools.xml
new file mode 100644
index 0000000..99fa7da
--- /dev/null
+++ b/java/com/android/dialer/dialpadview/res/values-mcc316-mnc010/bools.xml
@@ -0,0 +1,19 @@
+<?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>
+  <bool name="show_device_id_as_barcode">true</bool>
+</resources>
diff --git a/java/com/android/dialer/dialpadview/res/values/bools.xml b/java/com/android/dialer/dialpadview/res/values/bools.xml
new file mode 100644
index 0000000..b7fed07
--- /dev/null
+++ b/java/com/android/dialer/dialpadview/res/values/bools.xml
@@ -0,0 +1,20 @@
+<?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>
+  <bool name="show_device_id_in_hex_and_decimal">false</bool>
+  <bool name="show_device_id_as_barcode">false</bool>
+</resources>