| Index: chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchFieldTrial.java
|
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchFieldTrial.java b/chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchFieldTrial.java
|
| index c68b61ec5156bc14daf1333f85b56c121191d616..1d275bab68b080e5cc2bc4104b723239f5cef92d 100644
|
| --- a/chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchFieldTrial.java
|
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchFieldTrial.java
|
| @@ -34,7 +34,10 @@ public class ContextualSearchFieldTrial {
|
| private static final String DISABLE_SEARCH_TERM_RESOLUTION = "disable_search_term_resolution";
|
| private static final String WAIT_AFTER_TAP_DELAY_MS = "wait_after_tap_delay_ms";
|
|
|
| - // Translation. All these members are private, except for usage by testing.
|
| + // ------------
|
| + // Translation.
|
| + // ------------
|
| + // All these members are private, except for usage by testing.
|
| // Master switch, needed to disable all translate code for Contextual Search in case of an
|
| // emergency.
|
| @VisibleForTesting
|
| @@ -44,6 +47,9 @@ public class ContextualSearchFieldTrial {
|
| static final String ENABLE_ENGLISH_TARGET_TRANSLATION =
|
| "enable_english_target_translation";
|
|
|
| + // ---------------------------------------------
|
| + // Features for suppression or machine learning.
|
| + // ---------------------------------------------
|
| // TODO(donnd): remove all supporting code once short-lived data collection is done.
|
| private static final String SCREEN_TOP_SUPPRESSION_DPS = "screen_top_suppression_dps";
|
| private static final String ENABLE_BAR_OVERLAP_COLLECTION = "enable_bar_overlap_collection";
|
| @@ -54,20 +60,25 @@ public class ContextualSearchFieldTrial {
|
| "enable_not_long_word_suppression";
|
| @VisibleForTesting
|
| static final String NOT_AN_ENTITY_SUPPRESSION_ENABLED = "enable_not_an_entity_suppression";
|
| + // The threshold for tap suppression based on duration.
|
| + private static final String TAP_DURATION_THRESHOLD_MS = "tap_duration_threshold_ms";
|
|
|
| private static final String MINIMUM_SELECTION_LENGTH = "minimum_selection_length";
|
|
|
| + // -----------------
|
| + // Disable switches.
|
| + // -----------------
|
| // Safety switch for disabling online-detection. Also used to disable detection when running
|
| // tests.
|
| @VisibleForTesting
|
| static final String ONLINE_DETECTION_DISABLED = "disable_online_detection";
|
| -
|
| private static final String DISABLE_AMP_AS_SEPARATE_TAB = "disable_amp_as_separate_tab";
|
| -
|
| - // Machine Learning
|
| + // Disable logging for Machine Learning
|
| private static final String DISABLE_RANKER_LOGGING = "disable_ranker_logging";
|
|
|
| - // Privacy-related flags
|
| + // ----------------------
|
| + // Privacy-related flags.
|
| + // ----------------------
|
| private static final String DISABLE_SEND_HOME_COUNTRY = "disable_send_home_country";
|
| private static final String DISABLE_PAGE_CONTENT_NOTIFICATION =
|
| "disable_page_content_notification";
|
| @@ -98,6 +109,7 @@ public class ContextualSearchFieldTrial {
|
| private static Boolean sContextualSearchUrlActionsEnabled;
|
| private static Boolean sIsRankerLoggingDisabled;
|
| private static Integer sWaitAfterTapDelayMs;
|
| + private static Integer sTapDurationThresholdMs;
|
|
|
| /**
|
| * Don't instantiate.
|
| @@ -375,6 +387,18 @@ public class ContextualSearchFieldTrial {
|
| return sWaitAfterTapDelayMs.intValue();
|
| }
|
|
|
| + /**
|
| + * Gets a threshold for the duration of a tap gesture for categorization as brief or lengthy.
|
| + * @return The maximum amount of time in milliseconds for a tap gesture that's still considered
|
| + * a very brief duration tap.
|
| + */
|
| + static int getTapDurationThresholdMs() {
|
| + if (sTapDurationThresholdMs == null) {
|
| + sTapDurationThresholdMs = getIntParamValueOrDefault(TAP_DURATION_THRESHOLD_MS, 0);
|
| + }
|
| + return sTapDurationThresholdMs.intValue();
|
| + }
|
| +
|
| // ---------------------------
|
| // Feature-controlled Switches
|
| // ---------------------------
|
|
|