From fcbabb18161829b6ca5cc668f26544a665fa10d1 Mon Sep 17 00:00:00 2001 From: twyen Date: Mon, 26 Mar 2018 13:28:31 -0700 Subject: Add Motorola hidden menu to all Sprint MCCMNCs Before this CL it is only added to 310120. The values are moved to the base values, and the overrides override the enabled flag instead. Multiple SPN matching is also added. Bug: 76405608 Test: TAP PiperOrigin-RevId: 190515244 Change-Id: Ia937f0300ade57dc7a1b36df1433865ee4837a23 --- .../dialer/oem/MotorolaHiddenMenuKeySequence.java | 5 ++ java/com/android/dialer/oem/MotorolaUtils.java | 14 ++++-- .../res/values-mcc310-mnc000/motorola_config.xml | 6 ++- .../res/values-mcc310-mnc120/motorola_config.xml | 57 +--------------------- .../res/values-mcc310-mnc130/motorola_config.xml | 21 ++++++++ .../res/values-mcc310-mnc470/motorola_config.xml | 21 ++++++++ .../res/values-mcc310-mnc580/motorola_config.xml | 21 ++++++++ .../res/values-mcc311-mnc230/motorola_config.xml | 21 ++++++++ .../res/values-mcc311-mnc450/motorola_config.xml | 21 ++++++++ .../res/values-mcc311-mnc490/motorola_config.xml | 1 + .../res/values-mcc311-mnc670/motorola_config.xml | 21 ++++++++ .../res/values-mcc311-mnc870/motorola_config.xml | 1 + .../res/values-mcc312-mnc420/motorola_config.xml | 21 ++++++++ .../res/values-mcc312-mnc530/motorola_config.xml | 1 + .../res/values-mcc312-mnc570/motorola_config.xml | 21 ++++++++ .../res/values-mcc312-mnc720/motorola_config.xml | 21 ++++++++ .../res/values-mcc316-mnc010/motorola_config.xml | 1 + .../dialer/oem/res/values/motorola_config.xml | 39 ++++++++++++++- 18 files changed, 251 insertions(+), 63 deletions(-) create mode 100644 java/com/android/dialer/oem/res/values-mcc310-mnc130/motorola_config.xml create mode 100644 java/com/android/dialer/oem/res/values-mcc310-mnc470/motorola_config.xml create mode 100644 java/com/android/dialer/oem/res/values-mcc310-mnc580/motorola_config.xml create mode 100644 java/com/android/dialer/oem/res/values-mcc311-mnc230/motorola_config.xml create mode 100644 java/com/android/dialer/oem/res/values-mcc311-mnc450/motorola_config.xml create mode 100644 java/com/android/dialer/oem/res/values-mcc311-mnc670/motorola_config.xml create mode 100644 java/com/android/dialer/oem/res/values-mcc312-mnc420/motorola_config.xml create mode 100644 java/com/android/dialer/oem/res/values-mcc312-mnc570/motorola_config.xml create mode 100644 java/com/android/dialer/oem/res/values-mcc312-mnc720/motorola_config.xml (limited to 'java/com/android/dialer/oem') 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 @@ -70,6 +70,11 @@ public class MotorolaHiddenMenuKeySequence { return instance; } + @VisibleForTesting + static void setInstanceForTest(MotorolaHiddenMenuKeySequence instance) { + MotorolaHiddenMenuKeySequence.instance = instance; + } + @VisibleForTesting MotorolaHiddenMenuKeySequence( Context context, SystemPropertiesAccessor systemPropertiesAccessor) { 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 @@ true - Sprint + true + + Sprint + moto + \ 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 @@ true - - - - - ##66236# - ##2539# - ##786# - ##72786# - ##3282# - ##33284# - ##3424# - ##564# - ##4567257# - ##873283# - ##6343# - ##27263# - ##258# - ##8422# - ##4382# - - - com.motorola.intent.action.LAUNCH_HIDDEN_MENU - - - - @string/motorola_hidden_menu_intent - @string/motorola_hidden_menu_intent - @string/motorola_hidden_menu_intent - @string/motorola_hidden_menu_intent - @string/motorola_hidden_menu_intent - @string/motorola_hidden_menu_intent - @string/motorola_hidden_menu_intent - @string/motorola_hidden_menu_intent - @string/motorola_hidden_menu_intent - com.motorola.android.intent.action.omadm.sprint.hfa - @string/motorola_hidden_menu_intent - @string/motorola_hidden_menu_intent - @string/motorola_hidden_menu_intent - @string/motorola_hidden_menu_intent - @string/motorola_hidden_menu_intent - - - - - - ##[0-9]{6}# - - - - - @string/motorola_hidden_menu_intent - + true \ 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 @@ + + + + + true + true + \ 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 @@ + + + + + true + true + \ 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 @@ + + + + + true + true + \ 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 @@ + + + + + true + true + \ 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 @@ + + + + + true + true + \ 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 @@ true + true \ 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 @@ + + + + + true + true + \ 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 @@ true + true \ 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 @@ + + + + + true + true + \ 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 @@ true + true \ 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 @@ + + + + + true + true + \ 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 @@ + + + + + true + true + \ 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 @@ true + true \ 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 @@ false + + false + ##66236# + ##2539# + ##786# + ##72786# + ##3282# + ##33284# + ##3424# + ##564# + ##4567257# + ##873283# + ##6343# + ##27263# + ##258# + ##8422# + ##4382# - + com.motorola.intent.action.LAUNCH_HIDDEN_MENU + @string/motorola_hidden_menu_intent + @string/motorola_hidden_menu_intent + @string/motorola_hidden_menu_intent + @string/motorola_hidden_menu_intent + @string/motorola_hidden_menu_intent + @string/motorola_hidden_menu_intent + @string/motorola_hidden_menu_intent + @string/motorola_hidden_menu_intent + @string/motorola_hidden_menu_intent + com.motorola.android.intent.action.omadm.sprint.hfa + @string/motorola_hidden_menu_intent + @string/motorola_hidden_menu_intent + @string/motorola_hidden_menu_intent + @string/motorola_hidden_menu_intent + @string/motorola_hidden_menu_intent + + ##[0-9]{6}# + in the same order with he KeyPattern array. --> + @string/motorola_hidden_menu_intent