Skip to content

Commit

Permalink
[Cleanup] Remove OptimizeLayoutForSwipeRefresh
Browse files Browse the repository at this point in the history
Experiment ramped to 50% before expiring (due to holiday freeze).
Set it as the default and roll out with the binary

Bug: 1385901, 1335416
Change-Id: I1e1a96601d70f065519242ca391d2e03c9c713bb
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4111874
Reviewed-by: Ted Choc <tedchoc@chromium.org>
Commit-Queue: Yaron Friedman <yfriedman@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1084019}
  • Loading branch information
yfriedman authored and Chromium LUCI CQ committed Dec 15, 2022
1 parent 7a86a2b commit d9bdfa5
Show file tree
Hide file tree
Showing 9 changed files with 6 additions and 44 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import org.chromium.base.metrics.RecordUserAction;
import org.chromium.base.task.PostTask;
import org.chromium.chrome.R;
import org.chromium.chrome.browser.flags.ChromeFeatureList;
import org.chromium.chrome.browser.gesturenav.HistoryNavigationCoordinator;
import org.chromium.chrome.browser.tab.EmptyTabObserver;
import org.chromium.chrome.browser.tab.Tab;
Expand Down Expand Up @@ -196,8 +195,7 @@ public boolean start(
if (type == OverscrollAction.PULL_TO_REFRESH) {
if (mSwipeRefreshLayout == null) initSwipeRefreshLayout(mTab.getContext());
attachSwipeRefreshLayoutIfNecessary();
return mSwipeRefreshLayout.start(ChromeFeatureList.isEnabled(
ChromeFeatureList.OPTIMIZE_LAYOUTS_FOR_PULL_REFRESH));
return mSwipeRefreshLayout.start();
} else if (type == OverscrollAction.HISTORY_NAVIGATION) {
if (mNavigationCoordinator != null) {
mNavigationCoordinator.startGesture();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -276,8 +276,7 @@ public boolean onInterceptTouchEvent(MotionEvent event) {
final float yDiff = y - mLastMotionY;
if (yDiff > mTouchSlop && !mIsBeingDragged) {
mIsBeingDragged = true;
// TODO(1335416): Update this to |true| if experiment is successful
start(false);
start();
}
break;
}
Expand Down
5 changes: 0 additions & 5 deletions chrome/browser/flags/android/chrome_feature_list.cc
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,6 @@ const base::Feature* const kFeaturesExposedToJava[] = {
&kOmniboxModernizeVisualUpdate,
&kOpaqueOriginForIncomingIntents,
&kOptimizeGeolocationHeaderGeneration,
&kOptimizeLayoutsForPullRefresh,
&kPostTaskFocusTab,
&kProbabilisticCryptidRenderer,
&kReachedCodeProfiler,
Expand Down Expand Up @@ -842,10 +841,6 @@ BASE_FEATURE(kOptimizeGeolocationHeaderGeneration,
"OptimizeGeolocationHeaderGeneration",
base::FEATURE_ENABLED_BY_DEFAULT);

BASE_FEATURE(kOptimizeLayoutsForPullRefresh,
"OptimizeLayoutsForPullRefresh",
base::FEATURE_DISABLED_BY_DEFAULT);

BASE_FEATURE(kPostTaskFocusTab,
"PostTaskFocusTab",
base::FEATURE_ENABLED_BY_DEFAULT);
Expand Down
1 change: 0 additions & 1 deletion chrome/browser/flags/android/chrome_feature_list.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ BASE_DECLARE_FEATURE(kBookmarksImprovedSaveFlow);
BASE_DECLARE_FEATURE(kBookmarksRefresh);
BASE_DECLARE_FEATURE(kBackGestureRefactorAndroid);
BASE_DECLARE_FEATURE(kOpaqueOriginForIncomingIntents);
BASE_DECLARE_FEATURE(kOptimizeLayoutsForPullRefresh);
BASE_DECLARE_FEATURE(kPostTaskFocusTab);
BASE_DECLARE_FEATURE(kProbabilisticCryptidRenderer);
BASE_DECLARE_FEATURE(kReachedCodeProfiler);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,6 @@ public static boolean getFieldTrialParamByFeatureAsBoolean(
"OptimizationGuidePushNotifications";
public static final String OPTIMIZE_GEOLOCATION_HEADER_GENERATION =
"OptimizeGeolocationHeaderGeneration";
public static final String OPTIMIZE_LAYOUTS_FOR_PULL_REFRESH = "OptimizeLayoutsForPullRefresh";
public static final String OSK_RESIZES_VISUAL_VIEWPORT = "OSKResizesVisualViewportByDefault";
public static final String OVERLAY_NEW_LAYOUT = "OverlayNewLayout";
public static final String PAGE_ANNOTATIONS_SERVICE = "PageAnnotationsService";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,7 @@ public View getView() {

@Override
public boolean start() {
// TODO(1335416): Update this to |true| if experiment is successful
return mSwipeRefreshLayout.start(false);
return mSwipeRefreshLayout.start();
}

@Override
Expand Down
15 changes: 0 additions & 15 deletions testing/variations/fieldtrial_testing_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -7782,21 +7782,6 @@
]
}
],
"OptimizeLayoutsForPullRefresh": [
{
"platforms": [
"android"
],
"experiments": [
{
"name": "Enabled",
"enable_features": [
"OptimizeLayoutsForPullRefresh"
]
}
]
}
],
"OptimizeNetworkBuffers": [
{
"platforms": [
Expand Down
3 changes: 1 addition & 2 deletions third_party/android_swipe_refresh/README.chromium
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,4 @@ SwipeRefreshLayout
* All ViewCompat and MotionEventCompat dependencies removed.
* Added OnResetListener interface to notify SwipeRefreshHandler to detach
this view.
* Add a flag to minimze the number of z-order changes, thereby minimizing
relayouts of the UI.
* Optimization to minimize number of relayouts of the UI.
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,12 @@
import android.content.res.TypedArray;
import android.util.AttributeSet;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewConfiguration;
import android.view.ViewGroup;
import android.view.animation.Animation;
import android.view.animation.Animation.AnimationListener;
import android.view.animation.DecelerateInterpolator;
import android.view.animation.Transformation;
import android.widget.AbsListView;

/**
* The SwipeRefreshLayout should be used whenever the user can refresh the
Expand Down Expand Up @@ -136,12 +132,6 @@ public class SwipeRefreshLayout extends ViewGroup {

private boolean mNotify;

/**
* Flag used during duration of pull-refresh animation to reduce the number of calls to
* |bringToFront|, and therefore requested layouts. crbug/1335416
*/
private boolean mOptimizeLayouts;

private int mCircleWidth;

private int mCircleHeight;
Expand Down Expand Up @@ -570,11 +560,10 @@ public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
* is currently active, the request will be ignored.
* @return whether a new pull sequence has started.
*/
public boolean start(boolean optimizeLayouts) {
public boolean start() {
if (!isEnabled()) return false;
if (mRefreshing) return false;
mCircleView.clearAnimation();
mOptimizeLayouts = optimizeLayouts;
mProgress.stop();
// See ACTION_DOWN handling in {@link #onTouchEvent(...)}.
setTargetOffsetTopAndBottom(mOriginalOffsetTop - mCircleView.getTop(), true);
Expand Down Expand Up @@ -645,7 +634,7 @@ public void pull(float delta) {

@Override
public void bringChildToFront(View child) {
if (mOptimizeLayouts && indexOfChild(child) == getChildCount() - 1) return;
if (indexOfChild(child) == getChildCount() - 1) return;
super.bringChildToFront(child);
}

Expand Down

0 comments on commit d9bdfa5

Please sign in to comment.