Compose gesture integrated fully into Launcher

- Support dismissing Compose via the reverse gesture from the appear
gesture
- Use Tony Wickham's ag/10204761 with some glue code to enable the
app below Compose panning in the same direction as the gesture as
Compose peeks in
- Add feature flag to use Compose hosted in a window (permits underlying
app panning)
- Use InterpolatingVelocityTracker to fix OtherActivityInputConsumer
processing swipes in the wrong direction ~20% of the time due to a bug
in VelocityTracker (see go/quirky-bubbles)

Change-Id: I3adbaee1763f21557fb628b60d03b0a03e7079ab
This commit is contained in:
James O'Leary
2020-05-12 12:06:55 -04:00
parent 144f638fa3
commit 74a2746b35
6 changed files with 136 additions and 90 deletions

View File

@@ -15,6 +15,8 @@
*/
package com.android.systemui.plugins;
import android.view.MotionEvent;
import com.android.systemui.plugins.annotations.ProvidesInterface;
/**
@@ -28,7 +30,7 @@ import com.android.systemui.plugins.annotations.ProvidesInterface;
public interface OverscrollPlugin extends Plugin {
String ACTION = "com.android.systemui.action.PLUGIN_LAUNCHER_OVERSCROLL";
int VERSION = 3;
int VERSION = 4;
String DEVICE_STATE_LOCKED = "Locked";
String DEVICE_STATE_LAUNCHER = "Launcher";
@@ -41,33 +43,33 @@ public interface OverscrollPlugin extends Plugin {
boolean isActive();
/**
* Called when a touch is down and has been recognized as an overscroll gesture.
* A call of this method will always result in `onTouchUp` being called, and possibly
* `onFling` as well.
*
* Called when a touch has been recognized as an overscroll gesture.
* @param horizontalDistancePx Horizontal distance from the last finger location to the finger
* location when it first touched the screen.
* @param verticalDistancePx Horizontal distance from the last finger location to the finger
* location when it first touched the screen.
* @param thresholdPx Minimum distance for gesture.
* @param flingDistanceThresholdPx Minimum distance for gesture by fling.
* @param flingVelocityThresholdPx Minimum velocity for gesture by fling.
* @param deviceState String representing the current device state
* @param underlyingActivity String representing the currently active Activity
*/
void onTouchStart(String deviceState, String underlyingActivity);
void onTouchEvent(MotionEvent event,
int horizontalDistancePx,
int verticalDistancePx,
int thresholdPx,
int flingDistanceThresholdPx,
int flingVelocityThresholdPx,
String deviceState,
String underlyingActivity);
/**
* Called when a touch that was previously recognized has moved.
*
* @param px distance between the position of touch on this update and the position of the
* touch when it was initially recognized.
* @return `true` if overscroll gesture handling should override all other gestures.
*/
void onTouchTraveled(int px);
boolean blockOtherGestures();
/**
* Called when a touch that was previously recognized has ended.
*
* @param px distance between the position of touch on this update and the position of the
* touch when it was initially recognized.
* @return `true` if the overscroll gesture can pan the underlying app.
*/
void onTouchEnd(int px);
/**
* Called when the user starts Compose with a fling. `onTouchUp` will also be called.
*/
void onFling(float velocity);
boolean allowsUnderlyingActivityOverscroll();
}