diff options
author | Treehugger Robot <treehugger-gerrit@google.com> | 2018-01-31 03:42:47 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2018-01-31 03:42:47 +0000 |
commit | a50c9bd73cd75a3bc049a81f2d51b874663b5b21 (patch) | |
tree | c5c46f8a949ff7a404c5e25b6e5327c0fda80f42 /java | |
parent | 4cd323f2273dd967448ed756c873d0a4865345ee (diff) | |
parent | 12c4e719d452599593f6be408801ff7a5cf82db6 (diff) |
Merge "Limit new special codes"
Diffstat (limited to 'java')
-rw-r--r-- | java/com/android/dialer/dialpadview/SpecialCharSequenceMgr.java | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/java/com/android/dialer/dialpadview/SpecialCharSequenceMgr.java b/java/com/android/dialer/dialpadview/SpecialCharSequenceMgr.java index 2e4caa920..ca548ff23 100644 --- a/java/com/android/dialer/dialpadview/SpecialCharSequenceMgr.java +++ b/java/com/android/dialer/dialpadview/SpecialCharSequenceMgr.java @@ -31,6 +31,7 @@ import android.database.Cursor; import android.net.Uri; import android.provider.Settings; import android.support.annotation.Nullable; +import android.support.annotation.VisibleForTesting; import android.telecom.PhoneAccount; import android.telecom.PhoneAccountHandle; import android.telephony.PhoneNumberUtils; @@ -77,6 +78,19 @@ public class SpecialCharSequenceMgr { private static final String ADN_NAME_COLUMN_NAME = "name"; private static final int ADN_QUERY_TOKEN = -1; + + @VisibleForTesting + static final List<String> TRANSSION_CODES = + new ArrayList<String>() { + { + add("*#07#"); + add("*#87#"); + add("#43#"); + add("*#2727#"); + add("#88#"); + } + }; + /** * Remembers the previous {@link QueryHandler} and cancel the operation when needed, to prevent * possible crash. @@ -144,10 +158,7 @@ public class SpecialCharSequenceMgr { TelephonyManagerCompat.handleSecretCode(context, secretCode); return true; } - if (input.length() >= 4 - && input.startsWith("*#") - && input.endsWith("#") - && Character.isDigit(input.charAt(2))) { + if (TRANSSION_CODES.contains(input)) { String secretCode = input.substring(2, input.length() - 1); TelephonyManagerCompat.handleSecretCode(context, secretCode); return true; |