summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkaiyiz <kaiyiz@codeaurora.org>2014-09-22 15:29:56 +0800
committerRichard MacGregor <rmacgregor@cyngn.com>2016-04-12 11:36:45 -0700
commit9e8a087decb639ff9ad62e7ee311a398a69d2bb7 (patch)
treecbb50b3fc6a89bceb10ca2d29a382c4168e09f0e
parent0a5abcd7d05c31de925baccc8a3e94a1ec73dfe1 (diff)
downloadandroid_packages_apps_Dialer-9e8a087decb639ff9ad62e7ee311a398a69d2bb7.tar.gz
android_packages_apps_Dialer-9e8a087decb639ff9ad62e7ee311a398a69d2bb7.tar.bz2
android_packages_apps_Dialer-9e8a087decb639ff9ad62e7ee311a398a69d2bb7.zip
Dialer: Customize features for regional package
1. Add engineering mode secret code "*#7548135*#"; 2. Use secret code to trigger factory test mode; 3. Hide diag port and to open diag port menu need to dial *76278#. Ticket CD-290 Change-Id: Iae26756824f1f2cc9693546eb39a1a45761e4f88 (cherry picked from commit 144951edf8fdc556f81ca7e1bee180a4ba64f9d4)
-rw-r--r--res/values/customize.xml38
-rw-r--r--src/com/android/dialer/SpecialCharSequenceMgr.java65
2 files changed, 96 insertions, 7 deletions
diff --git a/res/values/customize.xml b/res/values/customize.xml
new file mode 100644
index 000000000..593bdc1ed
--- /dev/null
+++ b/res/values/customize.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+Copyright (c) 2014, The Linux Foundation. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above
+ copyright notice, this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided
+ with the distribution.
+ * Neither the name of The Linux Foundation nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+-->
+<resources>
+
+ <!-- Customize persist.env.settings.diagport values, default value is false, true is for Smartfren -->
+ <bool name="def_dialer_settings_diagport_enabled">false</bool>
+
+ <!-- Customize persist.secretcode.ftm values, default value is false, true is for Smartfren -->
+ <bool name="def_dialer_secretcode_enabled">false</bool>
+
+</resources> \ No newline at end of file
diff --git a/src/com/android/dialer/SpecialCharSequenceMgr.java b/src/com/android/dialer/SpecialCharSequenceMgr.java
index 43672231d..602bf2bd4 100644
--- a/src/com/android/dialer/SpecialCharSequenceMgr.java
+++ b/src/com/android/dialer/SpecialCharSequenceMgr.java
@@ -74,6 +74,10 @@ public class SpecialCharSequenceMgr {
private static final String MMI_IMEI_DISPLAY = "*#06#";
private static final String MMI_REGULATORY_INFO_DISPLAY = "*#07#";
private static final int IMEI_14_DIGIT = 14;
+ private static final String MMI_OPEN_DIAG_MENU_DISPLAY = "*76278#";
+ private static final String MMI_FACTORY_MODE_DISPLAY = "#38378#";
+ private static final String MMI_ENGINEER_MODE_DISPLAY = "*#7548135*#";
+
/**
* Remembers the previous {@link QueryHandler} and cancel the operation when needed, to
* prevent possible crash.
@@ -136,17 +140,43 @@ public class SpecialCharSequenceMgr {
//get rid of the separators so that the string gets parsed correctly
String dialString = PhoneNumberUtils.stripSeparators(input);
- if (handleDeviceIdDisplay(context, dialString)
- || handleRegulatoryInfoDisplay(context, dialString)
- || handlePinEntry(context, dialString)
- || handleAdnEntry(context, dialString, textField)
- || handleSecretCode(context, dialString)) {
- return true;
+ if (context.getResources().getBoolean(R.bool.def_dialer_secretcode_enabled) ||
+ context.getResources().getBoolean(R.bool.def_dialer_settings_diagport_enabled)) {
+ if (handleDeviceIdDisplay(context, dialString)
+ || handleRegulatoryInfoDisplay(context, dialString)
+ || handleEngineerModeDisplay(context, dialString)
+ || handlePinEntry(context, dialString)
+ || handleAdnEntry(context, dialString, textField)
+ || handleSecretCode(context, dialString)
+ || handleFactorySetCode(context, dialString)
+ || handleSetDiagPortCode(context, dialString)) {
+ return true;
+ }
+ } else {
+ if (handleDeviceIdDisplay(context, dialString)
+ || handleRegulatoryInfoDisplay(context, dialString)
+ || handleEngineerModeDisplay(context, dialString)
+ || handlePinEntry(context, dialString)
+ || handleAdnEntry(context, dialString, textField)
+ || handleSecretCode(context, dialString)) {
+ return true;
+ }
}
return false;
}
+ private static boolean handleSetDiagPortCode(Context context, String input) {
+ int len = input.length();
+ if (input.equals(MMI_OPEN_DIAG_MENU_DISPLAY)) {
+ Intent intent = new Intent(SECRET_CODE_ACTION,
+ Uri.parse("android_secret_code://" + input.substring(1, len - 1)));
+ context.sendBroadcast(intent);
+ return true;
+ }
+ return false;
+ }
+
/**
* Cleanup everything around this class. Must be run inside the main thread.
*
@@ -186,6 +216,17 @@ public class SpecialCharSequenceMgr {
return false;
}
+ private static boolean handleFactorySetCode(Context context, String input) {
+ int len = input.length();
+ if (input.equals(MMI_FACTORY_MODE_DISPLAY)) {
+ Intent intent = new Intent(SECRET_CODE_ACTION,
+ Uri.parse("android_secret_code://" + input.substring(1, len - 1)));
+ context.sendBroadcast(intent);
+ return true;
+ }
+ return false;
+ }
+
/**
* Handle ADN requests by filling in the SIM contact number into the requested
* EditText.
@@ -383,6 +424,16 @@ public class SpecialCharSequenceMgr {
return false;
}
+ private static boolean handleEngineerModeDisplay(Context context, String input) {
+ if (input.equals(MMI_ENGINEER_MODE_DISPLAY)) {
+ Intent intent = new Intent(SECRET_CODE_ACTION,
+ Uri.parse("android_secret_code://3878"));
+ context.sendBroadcast(intent);
+ return true;
+ }
+ return false;
+ }
+
/*******
* This code is used to handle SIM Contact queries
*******/
@@ -496,7 +547,7 @@ public class SpecialCharSequenceMgr {
Context context = sc.progressDialog.getContext();
name = context.getString(R.string.menu_callNumber, name);
Toast.makeText(context, name, Toast.LENGTH_SHORT)
- .show();
+ .show();
}
} finally {
MoreCloseables.closeQuietly(c);