Merge "Simplifying/fixing logic for ignoring touches in quick scrub" into ub-launcher3-master
diff --git a/quickstep/src/com/android/launcher3/uioverrides/IgnoreTouchesInQuickScrub.java b/quickstep/src/com/android/launcher3/uioverrides/IgnoreTouchesInQuickScrub.java
index 92aa1fd..2d5eb5a 100644
--- a/quickstep/src/com/android/launcher3/uioverrides/IgnoreTouchesInQuickScrub.java
+++ b/quickstep/src/com/android/launcher3/uioverrides/IgnoreTouchesInQuickScrub.java
@@ -18,20 +18,15 @@
import android.view.MotionEvent;
-import com.android.launcher3.Launcher;
import com.android.launcher3.util.TouchController;
-import com.android.quickstep.QuickScrubController;
-import com.android.quickstep.RecentsView;
+import com.android.quickstep.TouchInteractionService;
/**
* Consumes touches when quick scrub is enabled.
*/
public class IgnoreTouchesInQuickScrub implements TouchController {
- private QuickScrubController mQuickScrubController;
-
- public IgnoreTouchesInQuickScrub(Launcher l) {
- mQuickScrubController = ((RecentsView) l.getOverviewPanel()).getQuickScrubController();
+ public IgnoreTouchesInQuickScrub() {
}
@Override
@@ -41,6 +36,6 @@
@Override
public boolean onControllerInterceptTouchEvent(MotionEvent ev) {
- return mQuickScrubController.isQuickScrubEnabled();
+ return TouchInteractionService.isQuickScrubEnabled();
}
}
diff --git a/quickstep/src/com/android/launcher3/uioverrides/UiFactory.java b/quickstep/src/com/android/launcher3/uioverrides/UiFactory.java
index 1c92f2c..a004dac 100644
--- a/quickstep/src/com/android/launcher3/uioverrides/UiFactory.java
+++ b/quickstep/src/com/android/launcher3/uioverrides/UiFactory.java
@@ -43,13 +43,13 @@
public static TouchController[] createTouchControllers(Launcher launcher) {
if (FeatureFlags.ENABLE_TWO_SWIPE_TARGETS) {
return new TouchController[] {
- new IgnoreTouchesInQuickScrub(launcher),
+ new IgnoreTouchesInQuickScrub(),
new EdgeSwipeController(launcher),
new TwoStepSwipeController(launcher),
new OverviewSwipeController(launcher)};
} else {
return new TouchController[] {
- new IgnoreTouchesInQuickScrub(launcher),
+ new IgnoreTouchesInQuickScrub(),
new TwoStepSwipeController(launcher),
new OverviewSwipeController(launcher)};
}
diff --git a/quickstep/src/com/android/quickstep/QuickScrubController.java b/quickstep/src/com/android/quickstep/QuickScrubController.java
index d656f8a..3e65ffe 100644
--- a/quickstep/src/com/android/quickstep/QuickScrubController.java
+++ b/quickstep/src/com/android/quickstep/QuickScrubController.java
@@ -40,7 +40,6 @@
private int mQuickScrubSection;
private int mStartPage;
- private boolean mQuickScrubEnabled;
public QuickScrubController(Launcher launcher) {
mLauncher = launcher;
@@ -52,13 +51,11 @@
mRecentsView = mLauncher.getOverviewPanel();
mStartPage = startingFromHome ? 0 : mRecentsView.getFirstTaskIndex();
mQuickScrubSection = 0;
- mQuickScrubEnabled = true;
}
public void onQuickScrubEnd() {
mAutoAdvanceAlarm.cancelAlarm();
if (mRecentsView == null) {
- mQuickScrubEnabled = false;
} else {
int page = mRecentsView.getNextPage();
// Settle on the page then launch it.
@@ -71,15 +68,10 @@
} else {
((TaskView) mRecentsView.getPageAt(page)).launchTask(true);
}
- mQuickScrubEnabled = false;
}, snapDuration);
}
}
- public boolean isQuickScrubEnabled() {
- return mQuickScrubEnabled;
- }
-
public void onQuickScrubProgress(float progress) {
int quickScrubSection = Math.round(progress * NUM_QUICK_SCRUB_SECTIONS);
if (quickScrubSection != mQuickScrubSection) {
diff --git a/quickstep/src/com/android/quickstep/TouchInteractionService.java b/quickstep/src/com/android/quickstep/TouchInteractionService.java
index 9b31c14..fe18703 100644
--- a/quickstep/src/com/android/quickstep/TouchInteractionService.java
+++ b/quickstep/src/com/android/quickstep/TouchInteractionService.java
@@ -106,6 +106,7 @@
@Override
public void onQuickScrubStart() {
startTouchTracking(INTERACTION_QUICK_SCRUB);
+ sQuickScrubEnabled = true;
}
@Override
@@ -114,6 +115,7 @@
mInteractionHandler.onQuickScrubEnd();
mInteractionHandler = null;
}
+ sQuickScrubEnabled = false;
}
@Override
@@ -129,11 +131,16 @@
private final Consumer<MotionEvent> mNoOpTouchConsumer = (ev) -> {};
private static boolean sConnected = false;
+ private static boolean sQuickScrubEnabled = false;
public static boolean isConnected() {
return sConnected;
}
+ public static boolean isQuickScrubEnabled() {
+ return sQuickScrubEnabled;
+ }
+
private ActivityManagerWrapper mAM;
private RunningTaskInfo mRunningTask;
private RecentsModel mRecentsModel;