use telephony API to sent secret dial code
Telephony provides an API to send secret code broadcast in a
bgcheck compliant way.
Bug:33753947
Test: Manual
Change-Id: Ibe0968a193c026f8a234af88ad5e72beebaa83f4
diff --git a/src/com/android/phone/SpecialCharSequenceMgr.java b/src/com/android/phone/SpecialCharSequenceMgr.java
index 4e2120e..2aa1043 100644
--- a/src/com/android/phone/SpecialCharSequenceMgr.java
+++ b/src/com/android/phone/SpecialCharSequenceMgr.java
@@ -108,7 +108,7 @@
|| handleRegulatoryInfoDisplay(context, dialString)
|| handlePinEntry(context, dialString, pukInputActivity)
|| handleAdnEntry(context, dialString)
- || handleSecretCode(context, dialString)) {
+ || handleSecretCode(dialString)) {
return true;
}
@@ -143,25 +143,16 @@
}
/**
- * Handles secret codes to launch arbitrary activities in the form of *#*#<code>#*#*.
- * If a secret code is encountered an Intent is started with the android_secret_code://<code>
- * URI.
+ * Handles secret codes to launch arbitrary receivers in the form of *#*#<code>#*#*.
+ * If a secret code is encountered, an broadcast intent is sent with the
+ * android_secret_code://<code> URI.
*
- * @param context the context to use
* @param input the text to check for a secret code in
- * @return true if a secret code was encountered
+ * @return true if a secret code was encountered and intent is sent out
*/
- static private boolean handleSecretCode(Context context, String input) {
- // Secret codes are in the form *#*#<code>#*#*
- int len = input.length();
- if (len > 8 && input.startsWith("*#*#") && input.endsWith("#*#*")) {
- Intent intent = new Intent(TelephonyIntents.SECRET_CODE_ACTION,
- Uri.parse("android_secret_code://" + input.substring(4, len - 4)));
- context.sendBroadcast(intent);
- return true;
- }
-
- return false;
+ static private boolean handleSecretCode(String input) {
+ Phone phone = PhoneGlobals.getPhone();
+ return phone.sendDialerCode(input);
}
static private boolean handleAdnEntry(Context context, String input) {