diff options
author | fionaxu <fionaxu@google.com> | 2017-01-24 22:22:17 -0800 |
---|---|---|
committer | fionaxu <fionaxu@google.com> | 2017-01-27 18:34:45 -0800 |
commit | fa589dacb2968a09206232bd13fc5ec800838f45 (patch) | |
tree | 07e569f5919e9420a17f7ba83fd9ec342cb3672e | |
parent | 61187038b7b0bab59d83ab85550186649f54aa39 (diff) |
use telephony API to sent secret dial code
Telephony provides an API to send secret code broadcast in a
bgcheck-compliant way. The dialer app moves to this new API to
pass O bg-restriction check.
Bug:33753947
Test: Manual
Change-Id: Ib2c623d7d87a7581ae5898d6181c100fac3f12f6
-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; } |