summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTony Wickham <twickham@google.com>2019-07-18 14:38:46 -0700
committerTony Wickham <twickham@google.com>2019-07-18 15:10:21 -0700
commitf33b6d4378c6029265742bdc19d805b73b096ffa (patch)
treed0b142088927b79e6a38679ea23279e6cfccea93
parenta160e2bc78d28d9bbe34d9760bbb3c7194f89fcc (diff)
downloadpackages_apps_Trebuchet-f33b6d4378c6029265742bdc19d805b73b096ffa.tar.gz
packages_apps_Trebuchet-f33b6d4378c6029265742bdc19d805b73b096ffa.tar.bz2
packages_apps_Trebuchet-f33b6d4378c6029265742bdc19d805b73b096ffa.zip
Allow TouchControllers to override shouldDisableGestures
Currently only StatusBarTouchController overrides this to always return false, so that you can swipe down for notifications during transition to home screen from an app (in gesture nav). Bug: 137161198 Change-Id: I803c37937d5294810cbe0c1bbffcd5dddcc5ca3b
-rw-r--r--quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/StatusBarTouchController.java6
-rw-r--r--src/com/android/launcher3/util/TouchController.java4
-rw-r--r--src/com/android/launcher3/views/BaseDragLayer.java10
3 files changed, 15 insertions, 5 deletions
diff --git a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/StatusBarTouchController.java b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/StatusBarTouchController.java
index f5ba3725d..18996ddb0 100644
--- a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/StatusBarTouchController.java
+++ b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/StatusBarTouchController.java
@@ -166,4 +166,10 @@ public class StatusBarTouchController implements TouchController {
mSysUiProxy = RecentsModel.INSTANCE.get(mLauncher).getSystemUiProxy();
return mSysUiProxy != null;
}
+
+ @Override
+ public boolean allowWhenGesturesDisabled() {
+ // Always allow intercepting touches for this controller.
+ return true;
+ }
} \ No newline at end of file
diff --git a/src/com/android/launcher3/util/TouchController.java b/src/com/android/launcher3/util/TouchController.java
index fc1d819f7..2cd28bbe8 100644
--- a/src/com/android/launcher3/util/TouchController.java
+++ b/src/com/android/launcher3/util/TouchController.java
@@ -32,5 +32,9 @@ public interface TouchController {
*/
boolean onControllerInterceptTouchEvent(MotionEvent ev);
+ default boolean allowWhenGesturesDisabled() {
+ return false;
+ }
+
default void dump(String prefix, PrintWriter writer) { }
}
diff --git a/src/com/android/launcher3/views/BaseDragLayer.java b/src/com/android/launcher3/views/BaseDragLayer.java
index 8bf33bf05..4fe3d99d1 100644
--- a/src/com/android/launcher3/views/BaseDragLayer.java
+++ b/src/com/android/launcher3/views/BaseDragLayer.java
@@ -21,7 +21,6 @@ import static android.view.MotionEvent.ACTION_DOWN;
import static android.view.MotionEvent.ACTION_UP;
import static com.android.launcher3.Utilities.SINGLE_FRAME_MS;
-import static com.android.launcher3.Utilities.shouldDisableGestures;
import android.annotation.TargetApi;
import android.content.Context;
@@ -30,7 +29,6 @@ import android.graphics.Rect;
import android.graphics.RectF;
import android.os.Build;
import android.util.AttributeSet;
-import android.util.Log;
import android.util.Property;
import android.view.MotionEvent;
import android.view.View;
@@ -152,15 +150,17 @@ public abstract class BaseDragLayer<T extends Context & ActivityContext>
}
private TouchController findControllerToHandleTouch(MotionEvent ev) {
- if (shouldDisableGestures(ev)) return null;
+ boolean gesturesEnabled = !Utilities.shouldDisableGestures(ev);
AbstractFloatingView topView = AbstractFloatingView.getTopOpenView(mActivity);
- if (topView != null && topView.onControllerInterceptTouchEvent(ev)) {
+ if (topView != null && (gesturesEnabled || topView.allowWhenGesturesDisabled())
+ && topView.onControllerInterceptTouchEvent(ev)) {
return topView;
}
for (TouchController controller : mControllers) {
- if (controller.onControllerInterceptTouchEvent(ev)) {
+ if ((gesturesEnabled || controller.allowWhenGesturesDisabled())
+ && controller.onControllerInterceptTouchEvent(ev)) {
return controller;
}
}