diff options
author | Chen Xu <fionaxu@google.com> | 2017-01-28 17:00:54 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2017-01-28 17:00:55 +0000 |
commit | c746ef9dc084cf419d3cda7b6ad9c116eb20fd82 (patch) | |
tree | 8caebfda067883cb896a1cc63e783bb03ccae171 /src/com/android | |
parent | f5ee8ae7ebf8c5e6492b7861ce27c47a0a7e0bc7 (diff) | |
parent | fa589dacb2968a09206232bd13fc5ec800838f45 (diff) |
Merge "use telephony API to sent secret dial code"
Diffstat (limited to 'src/com/android')
-rw-r--r-- | src/com/android/dialer/SpecialCharSequenceMgr.java | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/src/com/android/dialer/SpecialCharSequenceMgr.java b/src/com/android/dialer/SpecialCharSequenceMgr.java index 4303f3e1f..fe2163f17 100644 --- a/src/com/android/dialer/SpecialCharSequenceMgr.java +++ b/src/com/android/dialer/SpecialCharSequenceMgr.java @@ -166,23 +166,19 @@ public class SpecialCharSequenceMgr { /** * 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> + * If a secret code is encountered, an Intent is started 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 boolean handleSecretCode(Context context, String input) { - // Secret codes are in the form *#*#<code>#*#* - int len = input.length(); - if (len > 8 && input.startsWith("*#*#") && input.endsWith("#*#*")) { - final Intent intent = new Intent(SECRET_CODE_ACTION, - Uri.parse("android_secret_code://" + input.substring(4, len - 4))); - context.sendBroadcast(intent); - return true; + final TelephonyManager telephonyManager = + (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); + if (telephonyManager != null) { + return telephonyManager.sendDialerCode(input); } - return false; } |