From 24d31d4b6e21155a2ca2608f7acf803e6e14c5a1 Mon Sep 17 00:00:00 2001 From: vadimt Date: Thu, 9 May 2019 14:12:18 -0700 Subject: [PATCH] Disabling updating All Apps during a long-press recognition This is supposed to eliminate test flakes in the lab. When an app gets updated while all apps is opened, all-apps will be re-laid-out. If the layout happens while we are recognizing a long-press on an app icon in all Apps, the long-press won't be recognized. In the lab, this happened so frequently that it caused considerable flakiness. Even after we started running tests in airplane mode, this still keeps happening. The bug refers an example with airplane mode on. The fix will be also mildly beneficial for users. Bug: 132177321 Change-Id: Ie7c7473fe94b8af83f04cd719286bae69e2d9de0 --- .../launcher3/allapps/AllAppsContainerView.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/com/android/launcher3/allapps/AllAppsContainerView.java b/src/com/android/launcher3/allapps/AllAppsContainerView.java index e2a5160af9..41252aab54 100644 --- a/src/com/android/launcher3/allapps/AllAppsContainerView.java +++ b/src/com/android/launcher3/allapps/AllAppsContainerView.java @@ -604,4 +604,18 @@ public class AllAppsContainerView extends SpringRelativeLayout implements DragSo return super.performAccessibilityAction(action, arguments); } + + @Override + public boolean dispatchTouchEvent(MotionEvent ev) { + switch (ev.getActionMasked()) { + case MotionEvent.ACTION_DOWN: + mAllAppsStore.setDeferUpdates(true); + break; + case MotionEvent.ACTION_UP: + case MotionEvent.ACTION_CANCEL: + mAllAppsStore.setDeferUpdates(false); + break; + } + return super.dispatchTouchEvent(ev); + } }