Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit ff114b1b authored by omarmt's avatar omarmt
Browse files

MultiPointerDraggable velocityTracker should keep track of all events

Inspired by the recent draggable modifier changes in Compose
aosp/3248036, the MultiPointerDraggable velocityTracker should keep
track of all events, even those that occur during touch slop.

We now use our pointerTracker() method to track the velocity of all
events during the initial pass. This change is intended to improve the
responsiveness and accuracy of the velocity tracking.
## How was it tested?
The gesture was performed using the command `adb shell uinput - <
my-recording.evemu`, as described in b/359962905#comment1.

## Test results
### Compose
A **log line** was added in the `onDragEnd` method, right after
`velocityTracker.calculateVelocity(maxVelocity)`.

#### Compose - Previous implementation
```
Fling velocity: (-387.83572, -5217.695) px/sec
Fling velocity: (-121.62777, -2772.1882) px/sec
Fling velocity: (-121.16518, -2712.5664) px/sec
Fling velocity: (-117.05918, -2687.84) px/sec
Fling velocity: (-166.02173, -3007.2937) px/sec
Fling velocity: (-115.61061, -3315.9968) px/sec
Fling velocity: (-160.37592, -2785.0784) px/sec
Fling velocity: (-265.48474, -4178.468) px/sec
```

#### Compose - New implementation
```
Fling velocity: (-725.88043, -7380.7256) px/sec
Fling velocity: (-702.4923, -7150.632) px/sec
Fling velocity: (-651.1258, -7338.5747) px/sec
Fling velocity: (-637.64764, -7095.27) px/sec
Fling velocity: (-689.847, -6968.339) px/sec
Fling velocity: (-625.7267, -7121.101) px/sec
Fling velocity: (-706.514, -7223.7437) px/sec
Fling velocity: (-641.24524, -7241.089) px/sec
```

### Android View

Tested on a `ListView`, with a **breakpoint** set at line 4293 of
`AbsListView.java` using the debugger.

The velocity was then read after fling with methods `velocityTracker
.getXVelocity(mActivePointerId)` and `velocityTracker.getXVelocity
(mActivePointerId)` using the debugger.

```
Fling velocity: (-618.7875, -6606.1953) px/sec
Fling velocity: (-715.31885, -7390.3955) px/sec
Fling velocity: (-715.31885, -7390.3955) px/sec
Fling velocity: (-715.31885, -7390.3955) px/sec
Fling velocity: (-715.31885, -7390.3955) px/sec
Fling velocity: (-715.31885, -7390.3955) px/sec
Fling velocity: (-715.31885, -7390.3955) px/sec
Fling velocity: (-715.31885, -7390.3955) px/sec
```

Test: atest MultiPointerDraggableTest
Bug: 363950493
Flag: com.android.systemui.scene_container
Change-Id: I6b22086dc345becb199a35fae6deb3bb50c95dfc
parent cad79bfe
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment