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

Commit 2c5fce91 authored by linyuh's avatar linyuh Committed by Copybara-Service
Browse files

Remove experiment flag "enable_dual_alphabets_on_t9".

Test: Existing tests
PiperOrigin-RevId: 184574898
Change-Id: I66f8fabacada8a86a0d36b904a47f38f0290867a
parent 5820d091
Loading
Loading
Loading
Loading
+5 −27
Original line number Diff line number Diff line
@@ -18,16 +18,12 @@ package com.android.dialer.dialpadview;

import android.content.Context;
import android.support.annotation.NonNull;
import android.support.annotation.VisibleForTesting;
import android.support.v4.util.SimpleArrayMap;
import com.android.dialer.common.Assert;
import com.android.dialer.compat.CompatUtils;
import com.android.dialer.configprovider.ConfigProviderBindings;

/** A class containing character mappings for the dialpad. */
public class DialpadCharMappings {
  @VisibleForTesting(otherwise = VisibleForTesting.PRIVATE)
  public static final String FLAG_ENABLE_DUAL_ALPHABETS = "enable_dual_alphabets_on_t9";

  /** The character mapping for the Latin alphabet (the default mapping) */
  private static class Latin {
@@ -134,17 +130,10 @@ public class DialpadCharMappings {

  /**
   * Returns the character-key map of the ISO 639-2 language code of the 1st language preference or
   * null if
   *
   * <ul>
   *   <li>no character-key map for the language code is defined, or
   *   <li>the support for dual alphabets is disabled.
   * </ul>
   * null if no character-key map for the language code is defined.
   */
  public static SimpleArrayMap<Character, Character> getCharToKeyMap(@NonNull Context context) {
    return isDualAlphabetsEnabled(context)
        ? CHAR_TO_KEY_MAPS.get(CompatUtils.getLocale(context).getISO3Language())
        : null;
    return CHAR_TO_KEY_MAPS.get(CompatUtils.getLocale(context).getISO3Language());
  }

  /**
@@ -171,17 +160,10 @@ public class DialpadCharMappings {

  /**
   * Returns the key-characters map of the given ISO 639-2 language code of the 1st language
   * preference or null if
   *
   * <ul>
   *   <li>no key-characters map for the language code is defined, or
   *   <li>the support for dual alphabets is disabled.
   * </ul>
   * preference or null if no key-characters map for the language code is defined.
   */
  public static String[] getKeyToCharsMap(@NonNull Context context) {
    return isDualAlphabetsEnabled(context)
        ? KEY_TO_CHAR_MAPS.get(CompatUtils.getLocale(context).getISO3Language())
        : null;
  static String[] getKeyToCharsMap(@NonNull Context context) {
    return KEY_TO_CHAR_MAPS.get(CompatUtils.getLocale(context).getISO3Language());
  }

  /** Returns the default key-characters map (the one that uses the Latin alphabet). */
@@ -189,10 +171,6 @@ public class DialpadCharMappings {
    return Latin.KEY_TO_CHARS;
  }

  private static boolean isDualAlphabetsEnabled(Context context) {
    return ConfigProviderBindings.get(context).getBoolean(FLAG_ENABLE_DUAL_ALPHABETS, false);
  }

  /**
   * Given a array representing a key-characters map, return its reverse map.
   *
+0 −7
Original line number Diff line number Diff line
@@ -20,7 +20,6 @@ import android.content.Context;
import android.support.annotation.VisibleForTesting;
import android.support.v4.util.SimpleArrayMap;
import com.android.dialer.compat.CompatUtils;
import com.android.dialer.configprovider.ConfigProviderBindings;
import com.google.common.base.Optional;

/**
@@ -35,8 +34,6 @@ import com.google.common.base.Optional;
 */
@SuppressWarnings("Guava")
public class CompositeSmartDialMap {
  @VisibleForTesting
  public static final String FLAG_ENABLE_DUAL_ALPHABETS = "enable_dual_alphabets_on_t9";

  private static final SmartDialMap DEFAULT_MAP = LatinSmartDialMap.getInstance();

@@ -160,10 +157,6 @@ public class CompositeSmartDialMap {

  @VisibleForTesting
  static Optional<SmartDialMap> getExtraMap(Context context) {
    if (!ConfigProviderBindings.get(context).getBoolean(FLAG_ENABLE_DUAL_ALPHABETS, false)) {
      return Optional.absent();
    }

    String languageCode = CompatUtils.getLocale(context).getISO3Language();
    return EXTRA_MAPS.containsKey(languageCode)
        ? Optional.of(EXTRA_MAPS.get(languageCode))