From 665232be613372d75173a1a61c7f936897b6561d Mon Sep 17 00:00:00 2001 From: vadimt Date: Mon, 20 Jul 2020 12:22:59 -0700 Subject: [PATCH] Removing diags for a fixed flake Bug: 160238801 Change-Id: Ia166eb1f154ddeeb70da5a141c9e985a265ba49a --- .../android/launcher3/BaseRecyclerView.java | 27 ----------- .../compat/AccessibilityManagerCompat.java | 6 --- .../launcher3/testing/TestProtocol.java | 1 - .../launcher3/views/BaseDragLayer.java | 3 -- .../launcher3/widget/WidgetsDiffReporter.java | 6 +-- .../launcher3/widget/WidgetsFullSheet.java | 11 ----- .../launcher3/widget/WidgetsRecyclerView.java | 45 ------------------- .../tapl/LauncherInstrumentation.java | 7 +-- 8 files changed, 3 insertions(+), 103 deletions(-) diff --git a/src/com/android/launcher3/BaseRecyclerView.java b/src/com/android/launcher3/BaseRecyclerView.java index 41eeb78bc7..c55b46b33a 100644 --- a/src/com/android/launcher3/BaseRecyclerView.java +++ b/src/com/android/launcher3/BaseRecyclerView.java @@ -16,11 +16,8 @@ package com.android.launcher3; -import static android.view.accessibility.AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED; - import android.content.Context; import android.util.AttributeSet; -import android.util.Log; import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; @@ -29,8 +26,6 @@ import android.view.accessibility.AccessibilityNodeInfo; import androidx.recyclerview.widget.RecyclerView; import com.android.launcher3.compat.AccessibilityManagerCompat; -import com.android.launcher3.testing.TestProtocol; -import com.android.launcher3.views.ActivityContext; import com.android.launcher3.views.RecyclerViewFastScroller; @@ -183,10 +178,6 @@ public abstract class BaseRecyclerView extends RecyclerView { public void onScrollStateChanged(int state) { super.onScrollStateChanged(state); - if (TestProtocol.sDebugTracing) { - Log.d(TestProtocol.NO_SCROLL_END_WIDGETS, "onScrollStateChanged: " + state); - } - if (state == SCROLL_STATE_IDLE) { AccessibilityManagerCompat.sendScrollFinishedEventToTest(getContext()); } @@ -196,23 +187,5 @@ public abstract class BaseRecyclerView extends RecyclerView { public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) { super.onInitializeAccessibilityNodeInfo(info); if (isLayoutSuppressed()) info.setScrollable(false); - if (Utilities.IS_RUNNING_IN_TEST_HARNESS) { - Log.d(TestProtocol.NO_SCROLL_END_WIDGETS, - "onInitializeAccessibilityNodeInfo, scrollable: " + info.isScrollable()); - } - } - - @Override - public void setLayoutFrozen(boolean frozen) { - final boolean changing = frozen != isLayoutSuppressed(); - super.setLayoutFrozen(frozen); - if (changing) { - if (Utilities.IS_RUNNING_IN_TEST_HARNESS) { - Log.d(TestProtocol.NO_SCROLL_END_WIDGETS, "setLayoutFrozen " + frozen - + " @ " + Log.getStackTraceString(new Throwable())); - ActivityContext.lookupContext(getContext()).getDragLayer() - .sendAccessibilityEvent(TYPE_WINDOW_CONTENT_CHANGED); - } - } } } \ No newline at end of file diff --git a/src/com/android/launcher3/compat/AccessibilityManagerCompat.java b/src/com/android/launcher3/compat/AccessibilityManagerCompat.java index d86bb17698..1d32d1dfa2 100644 --- a/src/com/android/launcher3/compat/AccessibilityManagerCompat.java +++ b/src/com/android/launcher3/compat/AccessibilityManagerCompat.java @@ -75,9 +75,6 @@ public class AccessibilityManagerCompat { } public static void sendScrollFinishedEventToTest(Context context) { - if (TestProtocol.sDebugTracing) { - Log.d(TestProtocol.NO_SCROLL_END_WIDGETS, "sendScrollFinishedEventToTest"); - } final AccessibilityManager accessibilityManager = getAccessibilityManagerForTest(context); if (accessibilityManager == null) return; @@ -97,9 +94,6 @@ public class AccessibilityManagerCompat { AccessibilityEvent.TYPE_ANNOUNCEMENT); e.setClassName(eventTag); e.setParcelableData(data); - if (TestProtocol.sDebugTracing) { - Log.d(TestProtocol.NO_SCROLL_END_WIDGETS, "sendEventToTest " + e); - } accessibilityManager.sendAccessibilityEvent(e); } diff --git a/src/com/android/launcher3/testing/TestProtocol.java b/src/com/android/launcher3/testing/TestProtocol.java index 2644db8f3c..8165627448 100644 --- a/src/com/android/launcher3/testing/TestProtocol.java +++ b/src/com/android/launcher3/testing/TestProtocol.java @@ -107,5 +107,4 @@ public final class TestProtocol { public static final String PAUSE_NOT_DETECTED = "b/139891609"; public static final String OVERIEW_NOT_ALLAPPS = "b/156095088"; public static final String NO_SWIPE_TO_HOME = "b/158017601"; - public static final String NO_SCROLL_END_WIDGETS = "b/160238801"; } diff --git a/src/com/android/launcher3/views/BaseDragLayer.java b/src/com/android/launcher3/views/BaseDragLayer.java index 2c75c74827..b010b4b94b 100644 --- a/src/com/android/launcher3/views/BaseDragLayer.java +++ b/src/com/android/launcher3/views/BaseDragLayer.java @@ -292,9 +292,6 @@ public abstract class BaseDragLayer @Override public boolean dispatchTouchEvent(MotionEvent ev) { - if (Utilities.IS_RUNNING_IN_TEST_HARNESS) { - Log.d(TestProtocol.NO_SCROLL_END_WIDGETS, "BaseDragLayer: " + ev); - } switch (ev.getAction()) { case ACTION_DOWN: { if ((mTouchDispatchState & TOUCH_DISPATCHING_TO_VIEW_IN_PROGRESS) != 0) { diff --git a/src/com/android/launcher3/widget/WidgetsDiffReporter.java b/src/com/android/launcher3/widget/WidgetsDiffReporter.java index c9e80dc848..df6e2c3023 100644 --- a/src/com/android/launcher3/widget/WidgetsDiffReporter.java +++ b/src/com/android/launcher3/widget/WidgetsDiffReporter.java @@ -20,10 +20,8 @@ import android.util.Log; import androidx.recyclerview.widget.RecyclerView; -import com.android.launcher3.Utilities; import com.android.launcher3.icons.IconCache; import com.android.launcher3.model.data.PackageItemInfo; -import com.android.launcher3.testing.TestProtocol; import com.android.launcher3.widget.WidgetsListAdapter.WidgetListRowEntryComparator; import java.util.ArrayList; @@ -34,8 +32,8 @@ import java.util.Iterator; * methods accordingly. */ public class WidgetsDiffReporter { - private static final boolean DEBUG = Utilities.IS_RUNNING_IN_TEST_HARNESS; // b/160238801 - private static final String TAG = TestProtocol.NO_SCROLL_END_WIDGETS; + private static final boolean DEBUG = false; + private static final String TAG = "WidgetsDiffReporter"; private final IconCache mIconCache; private final RecyclerView.Adapter mListener; diff --git a/src/com/android/launcher3/widget/WidgetsFullSheet.java b/src/com/android/launcher3/widget/WidgetsFullSheet.java index ba55f5adee..68a3ec51ee 100644 --- a/src/com/android/launcher3/widget/WidgetsFullSheet.java +++ b/src/com/android/launcher3/widget/WidgetsFullSheet.java @@ -24,7 +24,6 @@ import android.animation.PropertyValuesHolder; import android.content.Context; import android.graphics.Rect; import android.util.AttributeSet; -import android.util.Log; import android.util.Pair; import android.view.LayoutInflater; import android.view.MotionEvent; @@ -39,10 +38,8 @@ import com.android.launcher3.Launcher; import com.android.launcher3.LauncherAppState; import com.android.launcher3.LauncherAppWidgetHost.ProviderChangedListener; import com.android.launcher3.R; -import com.android.launcher3.Utilities; import com.android.launcher3.anim.PendingAnimation; import com.android.launcher3.compat.AccessibilityManagerCompat; -import com.android.launcher3.testing.TestProtocol; import com.android.launcher3.views.RecyclerViewFastScroller; import com.android.launcher3.views.TopRoundedCornerView; @@ -71,14 +68,6 @@ public class WidgetsFullSheet extends BaseWidgetSheet } - @Override - public boolean dispatchTouchEvent(MotionEvent ev) { - if (Utilities.IS_RUNNING_IN_TEST_HARNESS) { - Log.d(TestProtocol.NO_SCROLL_END_WIDGETS, "WidgetsFullSheet: " + ev); - } - return super.dispatchTouchEvent(ev); - } - public WidgetsFullSheet(Context context, AttributeSet attrs) { this(context, attrs, 0); } diff --git a/src/com/android/launcher3/widget/WidgetsRecyclerView.java b/src/com/android/launcher3/widget/WidgetsRecyclerView.java index 8f81977fc2..69de12b9d5 100644 --- a/src/com/android/launcher3/widget/WidgetsRecyclerView.java +++ b/src/com/android/launcher3/widget/WidgetsRecyclerView.java @@ -19,14 +19,11 @@ package com.android.launcher3.widget; import android.content.Context; import android.graphics.Point; import android.util.AttributeSet; -import android.util.Log; import android.view.MotionEvent; import android.view.View; import com.android.launcher3.BaseRecyclerView; import com.android.launcher3.R; -import com.android.launcher3.Utilities; -import com.android.launcher3.testing.TestProtocol; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; @@ -120,9 +117,6 @@ public class WidgetsRecyclerView extends BaseRecyclerView implements OnItemTouch public int getCurrentScrollY() { // Skip early if widgets are not bound. if (isModelNotReady() || getChildCount() == 0) { - if (Utilities.IS_RUNNING_IN_TEST_HARNESS) { - Log.d(TestProtocol.NO_SCROLL_END_WIDGETS, "getCurrentScrollY: -1"); - } return -1; } @@ -131,10 +125,6 @@ public class WidgetsRecyclerView extends BaseRecyclerView implements OnItemTouch int y = (child.getMeasuredHeight() * rowIndex); int offset = getLayoutManager().getDecoratedTop(child); - if (Utilities.IS_RUNNING_IN_TEST_HARNESS) { - Log.d(TestProtocol.NO_SCROLL_END_WIDGETS, - "getCurrentScrollY: " + (getPaddingTop() + y - offset)); - } return getPaddingTop() + y - offset; } @@ -166,22 +156,13 @@ public class WidgetsRecyclerView extends BaseRecyclerView implements OnItemTouch } if (mTouchDownOnScroller) { final boolean result = mScrollbar.handleTouchEvent(e, mFastScrollerOffset); - if (Utilities.IS_RUNNING_IN_TEST_HARNESS) { - Log.d(TestProtocol.NO_SCROLL_END_WIDGETS, "onInterceptTouchEvent 1 " + result); - } return result; } - if (Utilities.IS_RUNNING_IN_TEST_HARNESS) { - Log.d(TestProtocol.NO_SCROLL_END_WIDGETS, "onInterceptTouchEvent 2 false"); - } return false; } @Override public void onTouchEvent(RecyclerView rv, MotionEvent e) { - if (Utilities.IS_RUNNING_IN_TEST_HARNESS) { - Log.d(TestProtocol.NO_SCROLL_END_WIDGETS, "WidgetsRecyclerView.onTouchEvent"); - } if (mTouchDownOnScroller) { mScrollbar.handleTouchEvent(e, mFastScrollerOffset); } @@ -189,31 +170,5 @@ public class WidgetsRecyclerView extends BaseRecyclerView implements OnItemTouch @Override public void onRequestDisallowInterceptTouchEvent(boolean disallowIntercept) { - if (Utilities.IS_RUNNING_IN_TEST_HARNESS) { - Log.d(TestProtocol.NO_SCROLL_END_WIDGETS, "onRequestDisallowInterceptTouchEvent " - + disallowIntercept); - } - } - - @Override - public boolean dispatchTouchEvent(MotionEvent ev) { - final boolean result = super.dispatchTouchEvent(ev); - if (Utilities.IS_RUNNING_IN_TEST_HARNESS) { - Log.d(TestProtocol.NO_SCROLL_END_WIDGETS, "WidgetsRecyclerView: state: " - + getScrollState() - + " can scroll: " + getLayoutManager().canScrollVertically() - + " result: " + result - + " layout suppressed: " + isLayoutSuppressed() - + " event: " + ev); - } - return result; - } - - @Override - public void stopNestedScroll() { - if (Utilities.IS_RUNNING_IN_TEST_HARNESS) { - Log.d(TestProtocol.NO_SCROLL_END_WIDGETS, "stopNestedScroll"); - } - super.stopNestedScroll(); } } \ No newline at end of file diff --git a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java index a32d2f9ba5..e387a607b1 100644 --- a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java +++ b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java @@ -636,11 +636,9 @@ public final class LauncherInstrumentation { Parcelable executeAndWaitForEvent(Runnable command, UiAutomation.AccessibilityEventFilter eventFilter, Supplier message) { try { - Log.d(TestProtocol.NO_SCROLL_END_WIDGETS, "executeAndWaitForEvent: before"); final AccessibilityEvent event = mInstrumentation.getUiAutomation().executeAndWaitForEvent( command, eventFilter, LONG_WAIT_TIME_MS); - Log.d(TestProtocol.NO_SCROLL_END_WIDGETS, "executeAndWaitForEvent: after"); assertNotNull("executeAndWaitForEvent returned null (this can't happen)", event); final Parcelable parcelableData = event.getParcelableData(); event.recycle(); @@ -1097,10 +1095,7 @@ public final class LauncherInstrumentation { executeAndWaitForEvent( () -> linearGesture( startX, startY, endX, endY, steps, slowDown, GestureScope.INSIDE), - event -> { - Log.d(TestProtocol.NO_SCROLL_END_WIDGETS, "scroll: received event: " + event); - return TestProtocol.SCROLL_FINISHED_MESSAGE.equals(event.getClassName()); - }, + event -> TestProtocol.SCROLL_FINISHED_MESSAGE.equals(event.getClassName()), () -> "Didn't receive a scroll end message: " + startX + ", " + startY + ", " + endX + ", " + endY); }