| Index: chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/RecentScrollTapSuppression.java
|
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/RecentScrollTapSuppression.java b/chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/RecentScrollTapSuppression.java
|
| index c82d4086173aa77e1186cd9c74041e2524e32e2f..d78251b15e12573db4a02c36e96c7c4275f0baaf 100644
|
| --- a/chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/RecentScrollTapSuppression.java
|
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/RecentScrollTapSuppression.java
|
| @@ -13,9 +13,10 @@ public class RecentScrollTapSuppression extends ContextualSearchHeuristic {
|
| // once feature is enabled by default.
|
| private static final int DEFAULT_RECENT_SCROLL_SUPPRESSION_DURATION_MS = 300;
|
|
|
| - private final int mExperiementThresholdMs;
|
| + private final int mExperimentThresholdMs;
|
| private final int mDurationSinceRecentScrollMs;
|
| private final boolean mIsConditionSatisfied;
|
| + private final boolean mIsEnabled;
|
|
|
| /**
|
| * Constructs a Tap suppression heuristic that handles a Tap after a recent scroll.
|
| @@ -32,24 +33,26 @@ public class RecentScrollTapSuppression extends ContextualSearchHeuristic {
|
| } else {
|
| mDurationSinceRecentScrollMs = 0;
|
| }
|
| - mExperiementThresholdMs = ContextualSearchFieldTrial.getRecentScrollSuppressionDurationMs();
|
| +
|
| + mExperimentThresholdMs = ContextualSearchFieldTrial.getRecentScrollSuppressionDurationMs();
|
| +
|
| // If the configured threshold is 0, then suppression is not enabled.
|
| - if (mExperiementThresholdMs > 0) {
|
| - mIsConditionSatisfied = mDurationSinceRecentScrollMs > 0
|
| - && mDurationSinceRecentScrollMs < mExperiementThresholdMs;
|
| - } else {
|
| - mIsConditionSatisfied = false;
|
| - }
|
| + mIsEnabled = mExperimentThresholdMs > 0;
|
| +
|
| + int conditionThreshold = mIsEnabled ? mExperimentThresholdMs
|
| + : DEFAULT_RECENT_SCROLL_SUPPRESSION_DURATION_MS;
|
| + mIsConditionSatisfied = mDurationSinceRecentScrollMs > 0
|
| + && mDurationSinceRecentScrollMs < conditionThreshold;
|
| }
|
|
|
| @Override
|
| - protected boolean isConditionSatisfied() {
|
| - return mIsConditionSatisfied;
|
| + protected boolean isConditionSatisfiedAndEnabled() {
|
| + return mIsEnabled && mIsConditionSatisfied;
|
| }
|
|
|
| @Override
|
| protected void logConditionState() {
|
| - if (mExperiementThresholdMs > 0) {
|
| + if (mIsEnabled) {
|
| ContextualSearchUma.logRecentScrollSuppression(mIsConditionSatisfied);
|
| }
|
| }
|
| @@ -65,7 +68,6 @@ public class RecentScrollTapSuppression extends ContextualSearchHeuristic {
|
|
|
| @Override
|
| protected boolean isConditionSatisfiedForAggregateLogging() {
|
| - return mDurationSinceRecentScrollMs > 0
|
| - && mDurationSinceRecentScrollMs < DEFAULT_RECENT_SCROLL_SUPPRESSION_DURATION_MS;
|
| + return !mIsEnabled && mIsConditionSatisfied;
|
| }
|
| }
|
|
|