Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(140)

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/RecentScrollTapSuppression.java

Issue 2365653007: [Contextual Search] Exclude suppressed taps from aggregate suppression heuristics logging (Closed)
Patch Set: Fix punctuation Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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;
}
}

Powered by Google App Engine
This is Rietveld 408576698