diff options
Diffstat (limited to 'java/com/android/dialer')
18 files changed, 251 insertions, 63 deletions
diff --git a/java/com/android/dialer/oem/MotorolaHiddenMenuKeySequence.java b/java/com/android/dialer/oem/MotorolaHiddenMenuKeySequence.java index 079624b64..74ad1b852 100644 --- a/java/com/android/dialer/oem/MotorolaHiddenMenuKeySequence.java +++ b/java/com/android/dialer/oem/MotorolaHiddenMenuKeySequence.java @@ -71,6 +71,11 @@ public class MotorolaHiddenMenuKeySequence { } @VisibleForTesting + static void setInstanceForTest(MotorolaHiddenMenuKeySequence instance) { + MotorolaHiddenMenuKeySequence.instance = instance; + } + + @VisibleForTesting MotorolaHiddenMenuKeySequence( Context context, SystemPropertiesAccessor systemPropertiesAccessor) { if (MotorolaUtils.isSupportingHiddenMenu(context)) { diff --git a/java/com/android/dialer/oem/MotorolaUtils.java b/java/com/android/dialer/oem/MotorolaUtils.java index 993078d95..3879f915f 100644 --- a/java/com/android/dialer/oem/MotorolaUtils.java +++ b/java/com/android/dialer/oem/MotorolaUtils.java @@ -59,9 +59,14 @@ public class MotorolaUtils { */ private static boolean isSpnMatched(Context context) { try { - String spnResource = context.getResources().getString(R.string.motorola_enabled_spn); - return spnResource.equalsIgnoreCase( - context.getSystemService(TelephonyManager.class).getSimOperatorName()); + for (String spnResource : + context.getResources().getStringArray(R.array.motorola_enabled_spn)) { + if (spnResource.equalsIgnoreCase( + context.getSystemService(TelephonyManager.class).getSimOperatorName())) { + return true; + } + } + return false; } catch (Resources.NotFoundException exception) { // If SPN is not specified we consider as not necessary to enable/disable the feature. return true; @@ -69,7 +74,8 @@ public class MotorolaUtils { } static boolean isSupportingHiddenMenu(Context context) { - return context.getPackageManager().hasSystemFeature(HIDDEN_MENU_FEATURE); + return context.getPackageManager().hasSystemFeature(HIDDEN_MENU_FEATURE) + && context.getResources().getBoolean(R.bool.motorola_hidden_menu_enabled); } public static boolean shouldBlinkHdIconWhenConnectingCall(Context context) { diff --git a/java/com/android/dialer/oem/res/values-mcc310-mnc000/motorola_config.xml b/java/com/android/dialer/oem/res/values-mcc310-mnc000/motorola_config.xml index ac3397520..3b4d547b9 100644 --- a/java/com/android/dialer/oem/res/values-mcc310-mnc000/motorola_config.xml +++ b/java/com/android/dialer/oem/res/values-mcc310-mnc000/motorola_config.xml @@ -17,5 +17,9 @@ <resources> <bool name="motorola_sprint_hd_codec">true</bool> - <string name="motorola_enabled_spn">Sprint</string> + <bool name="motorola_hidden_menu_enabled">true</bool> + <string-array name="motorola_enabled_spn"> + <item>Sprint</item> + <item>moto</item> + </string-array> </resources>
\ No newline at end of file diff --git a/java/com/android/dialer/oem/res/values-mcc310-mnc120/motorola_config.xml b/java/com/android/dialer/oem/res/values-mcc310-mnc120/motorola_config.xml index 417a4b845..18c4c3f4d 100644 --- a/java/com/android/dialer/oem/res/values-mcc310-mnc120/motorola_config.xml +++ b/java/com/android/dialer/oem/res/values-mcc310-mnc120/motorola_config.xml @@ -17,60 +17,5 @@ <resources> <bool name="motorola_sprint_hd_codec">true</bool> - - <!-- Hidden menu configuration for Motorola. --> - <!-- This defines the specific key sequence that will be caught in the SpecialCharSequenceMgr - such as, ##OMADM# --> - <string-array name="motorola_hidden_menu_key_sequence"> - <item>##66236#</item> <!--##OMADM#--> - <item>##2539#</item> <!--##AKEY#--> - <item>##786#</item> <!--##RTN#--> - <item>##72786#</item> <!--##SCRTN#--> - <item>##3282#</item> <!--##DATA#--> - <item>##33284#</item> <!--##DEBUG#--> - <item>##3424#</item> <!--##DIAG#--> - <item>##564#</item> <!--##LOG#--> - <item>##4567257#</item> <!--##GLMSCLR#--> - <item>##873283#</item> <!--##UPDATE#--> - <item>##6343#</item> <!--##MEID#--> - <item>##27263#</item> <!--##BRAND#--> - <item>##258#</item> <!--##BLV#--> - <item>##8422#</item> <!--##UICC#--> - <item>##4382#</item> <!--CMAS/WEA--> - </string-array> - - <string name="motorola_hidden_menu_intent">com.motorola.intent.action.LAUNCH_HIDDEN_MENU</string> - - <!-- This defines the intents that will be send out when the key sequence is matched, this must be - in the same order with he KeySequence array. --> - <string-array name="motorola_hidden_menu_key_sequence_intents"> - <item>@string/motorola_hidden_menu_intent</item> - <item>@string/motorola_hidden_menu_intent</item> - <item>@string/motorola_hidden_menu_intent</item> - <item>@string/motorola_hidden_menu_intent</item> - <item>@string/motorola_hidden_menu_intent</item> - <item>@string/motorola_hidden_menu_intent</item> - <item>@string/motorola_hidden_menu_intent</item> - <item>@string/motorola_hidden_menu_intent</item> - <item>@string/motorola_hidden_menu_intent</item> - <item>com.motorola.android.intent.action.omadm.sprint.hfa</item> - <item>@string/motorola_hidden_menu_intent</item> - <item>@string/motorola_hidden_menu_intent</item> - <item>@string/motorola_hidden_menu_intent</item> - <item>@string/motorola_hidden_menu_intent</item> - <item>@string/motorola_hidden_menu_intent</item> - </string-array> - - <!-- This defines the specific key patterns that will be caught in the SpecialCharSequenceMgr - such as, ##[0-9]{3,7}# --> - <string-array name="motorola_hidden_menu_key_pattern"> - <!--##MSL#, here MSL is 6 digits SPC code, ##OTKSL#, OTKSL is also digits code --> - <item>##[0-9]{6}#</item> - </string-array> - - <!-- This defines the intents that will be send out when the key sequence is matched, this must be - in the same order with he KeyPattern array. --> - <string-array name="motorola_hidden_menu_key_pattern_intents"> - <item>@string/motorola_hidden_menu_intent</item> - </string-array> + <bool name="motorola_hidden_menu_enabled">true</bool> </resources>
\ No newline at end of file diff --git a/java/com/android/dialer/oem/res/values-mcc310-mnc130/motorola_config.xml b/java/com/android/dialer/oem/res/values-mcc310-mnc130/motorola_config.xml new file mode 100644 index 000000000..935627b65 --- /dev/null +++ b/java/com/android/dialer/oem/res/values-mcc310-mnc130/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> + <bool name="motorola_sprint_hd_codec">true</bool> + <bool name="motorola_hidden_menu_enabled">true</bool> +</resources>
\ No newline at end of file diff --git a/java/com/android/dialer/oem/res/values-mcc310-mnc470/motorola_config.xml b/java/com/android/dialer/oem/res/values-mcc310-mnc470/motorola_config.xml new file mode 100644 index 000000000..935627b65 --- /dev/null +++ b/java/com/android/dialer/oem/res/values-mcc310-mnc470/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> + <bool name="motorola_sprint_hd_codec">true</bool> + <bool name="motorola_hidden_menu_enabled">true</bool> +</resources>
\ No newline at end of file diff --git a/java/com/android/dialer/oem/res/values-mcc310-mnc580/motorola_config.xml b/java/com/android/dialer/oem/res/values-mcc310-mnc580/motorola_config.xml new file mode 100644 index 000000000..935627b65 --- /dev/null +++ b/java/com/android/dialer/oem/res/values-mcc310-mnc580/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> + <bool name="motorola_sprint_hd_codec">true</bool> + <bool name="motorola_hidden_menu_enabled">true</bool> +</resources>
\ No newline at end of file diff --git a/java/com/android/dialer/oem/res/values-mcc311-mnc230/motorola_config.xml b/java/com/android/dialer/oem/res/values-mcc311-mnc230/motorola_config.xml new file mode 100644 index 000000000..935627b65 --- /dev/null +++ b/java/com/android/dialer/oem/res/values-mcc311-mnc230/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> + <bool name="motorola_sprint_hd_codec">true</bool> + <bool name="motorola_hidden_menu_enabled">true</bool> +</resources>
\ No newline at end of file diff --git a/java/com/android/dialer/oem/res/values-mcc311-mnc450/motorola_config.xml b/java/com/android/dialer/oem/res/values-mcc311-mnc450/motorola_config.xml new file mode 100644 index 000000000..935627b65 --- /dev/null +++ b/java/com/android/dialer/oem/res/values-mcc311-mnc450/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> + <bool name="motorola_sprint_hd_codec">true</bool> + <bool name="motorola_hidden_menu_enabled">true</bool> +</resources>
\ No newline at end of file diff --git a/java/com/android/dialer/oem/res/values-mcc311-mnc490/motorola_config.xml b/java/com/android/dialer/oem/res/values-mcc311-mnc490/motorola_config.xml index c5cb0d1f7..18c4c3f4d 100644 --- a/java/com/android/dialer/oem/res/values-mcc311-mnc490/motorola_config.xml +++ b/java/com/android/dialer/oem/res/values-mcc311-mnc490/motorola_config.xml @@ -17,4 +17,5 @@ <resources> <bool name="motorola_sprint_hd_codec">true</bool> + <bool name="motorola_hidden_menu_enabled">true</bool> </resources>
\ No newline at end of file diff --git a/java/com/android/dialer/oem/res/values-mcc311-mnc670/motorola_config.xml b/java/com/android/dialer/oem/res/values-mcc311-mnc670/motorola_config.xml new file mode 100644 index 000000000..935627b65 --- /dev/null +++ b/java/com/android/dialer/oem/res/values-mcc311-mnc670/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> + <bool name="motorola_sprint_hd_codec">true</bool> + <bool name="motorola_hidden_menu_enabled">true</bool> +</resources>
\ No newline at end of file diff --git a/java/com/android/dialer/oem/res/values-mcc311-mnc870/motorola_config.xml b/java/com/android/dialer/oem/res/values-mcc311-mnc870/motorola_config.xml index c5cb0d1f7..18c4c3f4d 100644 --- a/java/com/android/dialer/oem/res/values-mcc311-mnc870/motorola_config.xml +++ b/java/com/android/dialer/oem/res/values-mcc311-mnc870/motorola_config.xml @@ -17,4 +17,5 @@ <resources> <bool name="motorola_sprint_hd_codec">true</bool> + <bool name="motorola_hidden_menu_enabled">true</bool> </resources>
\ No newline at end of file diff --git a/java/com/android/dialer/oem/res/values-mcc312-mnc420/motorola_config.xml b/java/com/android/dialer/oem/res/values-mcc312-mnc420/motorola_config.xml new file mode 100644 index 000000000..935627b65 --- /dev/null +++ b/java/com/android/dialer/oem/res/values-mcc312-mnc420/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> + <bool name="motorola_sprint_hd_codec">true</bool> + <bool name="motorola_hidden_menu_enabled">true</bool> +</resources>
\ No newline at end of file diff --git a/java/com/android/dialer/oem/res/values-mcc312-mnc530/motorola_config.xml b/java/com/android/dialer/oem/res/values-mcc312-mnc530/motorola_config.xml index c5cb0d1f7..18c4c3f4d 100644 --- a/java/com/android/dialer/oem/res/values-mcc312-mnc530/motorola_config.xml +++ b/java/com/android/dialer/oem/res/values-mcc312-mnc530/motorola_config.xml @@ -17,4 +17,5 @@ <resources> <bool name="motorola_sprint_hd_codec">true</bool> + <bool name="motorola_hidden_menu_enabled">true</bool> </resources>
\ No newline at end of file diff --git a/java/com/android/dialer/oem/res/values-mcc312-mnc570/motorola_config.xml b/java/com/android/dialer/oem/res/values-mcc312-mnc570/motorola_config.xml new file mode 100644 index 000000000..935627b65 --- /dev/null +++ b/java/com/android/dialer/oem/res/values-mcc312-mnc570/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> + <bool name="motorola_sprint_hd_codec">true</bool> + <bool name="motorola_hidden_menu_enabled">true</bool> +</resources>
\ No newline at end of file diff --git a/java/com/android/dialer/oem/res/values-mcc312-mnc720/motorola_config.xml b/java/com/android/dialer/oem/res/values-mcc312-mnc720/motorola_config.xml new file mode 100644 index 000000000..935627b65 --- /dev/null +++ b/java/com/android/dialer/oem/res/values-mcc312-mnc720/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> + <bool name="motorola_sprint_hd_codec">true</bool> + <bool name="motorola_hidden_menu_enabled">true</bool> +</resources>
\ No newline at end of file diff --git a/java/com/android/dialer/oem/res/values-mcc316-mnc010/motorola_config.xml b/java/com/android/dialer/oem/res/values-mcc316-mnc010/motorola_config.xml index c5cb0d1f7..18c4c3f4d 100644 --- a/java/com/android/dialer/oem/res/values-mcc316-mnc010/motorola_config.xml +++ b/java/com/android/dialer/oem/res/values-mcc316-mnc010/motorola_config.xml @@ -17,4 +17,5 @@ <resources> <bool name="motorola_sprint_hd_codec">true</bool> + <bool name="motorola_hidden_menu_enabled">true</bool> </resources>
\ No newline at end of file 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 614514e53..47f9287b6 100644 --- a/java/com/android/dialer/oem/res/values/motorola_config.xml +++ b/java/com/android/dialer/oem/res/values/motorola_config.xml @@ -20,26 +20,61 @@ <bool name="motorola_sprint_hd_codec">false</bool> <!-- Hidden menu configuration for Motorola. --> + <!-- Hidden menu is only enabled for sprint--> + <bool name="motorola_hidden_menu_enabled">false</bool> <!-- This defines the specific key sequence that will be caught in the SpecialCharSequenceMgr such as, ##OMADM# --> <string-array name="motorola_hidden_menu_key_sequence"> + <item>##66236#</item> <!--##OMADM#--> + <item>##2539#</item> <!--##AKEY#--> + <item>##786#</item> <!--##RTN#--> + <item>##72786#</item> <!--##SCRTN#--> + <item>##3282#</item> <!--##DATA#--> + <item>##33284#</item> <!--##DEBUG#--> + <item>##3424#</item> <!--##DIAG#--> + <item>##564#</item> <!--##LOG#--> + <item>##4567257#</item> <!--##GLMSCLR#--> + <item>##873283#</item> <!--##UPDATE#--> + <item>##6343#</item> <!--##MEID#--> + <item>##27263#</item> <!--##BRAND#--> + <item>##258#</item> <!--##BLV#--> + <item>##8422#</item> <!--##UICC#--> + <item>##4382#</item> <!--CMAS/WEA--> </string-array> - <string name="motorola_hidden_menu_intent"></string> + <string name="motorola_hidden_menu_intent">com.motorola.intent.action.LAUNCH_HIDDEN_MENU</string> <!-- This defines the intents that will be send out when the key sequence is matched, this must be in the same order with he KeySequence array. --> <string-array name="motorola_hidden_menu_key_sequence_intents"> + <item>@string/motorola_hidden_menu_intent</item> + <item>@string/motorola_hidden_menu_intent</item> + <item>@string/motorola_hidden_menu_intent</item> + <item>@string/motorola_hidden_menu_intent</item> + <item>@string/motorola_hidden_menu_intent</item> + <item>@string/motorola_hidden_menu_intent</item> + <item>@string/motorola_hidden_menu_intent</item> + <item>@string/motorola_hidden_menu_intent</item> + <item>@string/motorola_hidden_menu_intent</item> + <item>com.motorola.android.intent.action.omadm.sprint.hfa</item> + <item>@string/motorola_hidden_menu_intent</item> + <item>@string/motorola_hidden_menu_intent</item> + <item>@string/motorola_hidden_menu_intent</item> + <item>@string/motorola_hidden_menu_intent</item> + <item>@string/motorola_hidden_menu_intent</item> </string-array> <!-- This defines the specific key patterns that will be caught in the SpecialCharSequenceMgr such as, ##[0-9]{3,7}# --> <string-array name="motorola_hidden_menu_key_pattern"> + <!--##MSL#, here MSL is 6 digits SPC code, ##OTKSL#, OTKSL is also digits code --> + <item>##[0-9]{6}#</item> </string-array> <!-- This defines the intents that will be send out when the key sequence is matched, this must be - in the same order with he KeyPattern array. --> + in the same order with he KeyPattern array. --> <string-array name="motorola_hidden_menu_key_pattern_intents"> + <item>@string/motorola_hidden_menu_intent</item> </string-array> <!-- This defines the provider names for cequint callerid applications |