Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 188ccc3e authored by roldenburg's avatar roldenburg Committed by android-build-merger
Browse files

Merge "Limit new special codes" am: a50c9bd7

am: 7a41c153

Change-Id: Ib2d957317cfa0c547b76bc76dd0f80733d043a31
parents a404ed26 7a41c153
Loading
Loading
Loading
Loading
+15 −4
Original line number Diff line number Diff line
@@ -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;