Compose overscroll gesture updates

Two changes for the latest Compose prototype:
1. Pass the identity of the underlying app to the Overscroll plugin.
2. Enable the Compose gesture over an app when there's a Recents extra
card plugin active (otherwise the current app won't count as the
rightmost one).

Some changes to the gesture:
- Angle decreased from 35° to 25° to remove overlap with
Assistant gesture
- Distance increased from 8 to 110 dp. 110 dp is 2x the Assistant
gesture and roughly the same as scrubbing into an app from Home.
- Fling detection added; uses same distance threshold, 110 dp.
- If a touch was recognized as another gesture, the touch will not be
reinterpreted as a Compose gesture, no matter what touch movement occurs
- Fixes issue where Assistant + Compose could both be triggered
- Fixes issue where scrubbing apps to the left, then back to the right,
would bring in Compose. i.e. if a touch down + touch movement starts
bringing in Assistant UI elements, then, the user moves their touch
below the Assistant angle, the Compose gesture will not start
being recognized
- Gesture length required for fling lowered from 110 dp to 40 dp, per
tuning with PM.

Bug: b/146508473
Change-Id: I414573d1a92684d1d992837a5f1df522346ec211
This commit is contained in:
James O'Leary
2019-12-20 14:24:10 -05:00
parent c7d601e923
commit a9156a05c4
7 changed files with 122 additions and 15 deletions

View File

@@ -24,11 +24,11 @@ import com.android.systemui.plugins.annotations.ProvidesInterface;
* the user to a more recent app).
*/
@ProvidesInterface(action = com.android.systemui.plugins.OverscrollPlugin.ACTION,
version = com.android.systemui.plugins.OverlayPlugin.VERSION)
version = com.android.systemui.plugins.OverscrollPlugin.VERSION)
public interface OverscrollPlugin extends Plugin {
String ACTION = "com.android.systemui.action.PLUGIN_LAUNCHER_OVERSCROLL";
int VERSION = 1;
int VERSION = 3;
String DEVICE_STATE_LOCKED = "Locked";
String DEVICE_STATE_LAUNCHER = "Launcher";
@@ -36,9 +36,38 @@ public interface OverscrollPlugin extends Plugin {
String DEVICE_STATE_UNKNOWN = "Unknown";
/**
* Called when the user completed a right to left swipe in the gesture area.
*
* @param deviceState One of the DEVICE_STATE_* constants.
* @return true if the plugin is active and will accept overscroll gestures
*/
void onOverscroll(String deviceState);
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.
*
* @param deviceState String representing the current device state
* @param underlyingActivity String representing the currently active Activity
*/
void onTouchStart(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.
*/
void onTouchTraveled(int px);
/**
* 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.
*/
void onTouchEnd(int px);
/**
* Called when the user starts Compose with a fling. `onTouchUp` will also be called.
*/
void onFling(float velocity);
}