summaryrefslogtreecommitdiffstats
path: root/src
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 /src
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)
Diffstat (limited to 'src')
-rw-r--r--src/com/android/dialer/SpecialCharSequenceMgr.java65
1 files changed, 58 insertions, 7 deletions
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);