diff options
| author | 2024-02-22 17:21:22 +0900 | |
|---|---|---|
| committer | 2024-03-13 09:43:01 +0900 | |
| commit | 25040239f17b406e33c714f56bf082d76005d20e (patch) | |
| tree | 05830242aeeecb980e232533e1695b175022c64a /include/input/Input.h | |
| parent | 48d4be6d40c8a60641a9fbb3cdd27a693922f78b (diff) | |
Use input token in PointerCaptureRequest
Instead of sending boolean to indicate the capture state,
InputDispatcher now sends an input window token that requests a
pointer capture, or nullptr otherwise.
This is useful for some InputReader implementations.
Also, this token can be used to verify if a pointer capture changed
event from a reader is valid.
Bug: 259346762
Bug: 301628662
Test: inputflinger_tests
Test: android.view.cts.PointerCaptureTest WindowFocusTests#testPointerCapture
Change-Id: Ie8343db6744dc2080f7f1dcff5a630be5c87fa3e
Diffstat (limited to 'include/input/Input.h')
| -rw-r--r-- | include/input/Input.h | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/include/input/Input.h b/include/input/Input.h index ddc376809e..19f4ab38e8 100644 --- a/include/input/Input.h +++ b/include/input/Input.h @@ -1192,15 +1192,17 @@ public: */ struct PointerCaptureRequest { public: - inline PointerCaptureRequest() : enable(false), seq(0) {} - inline PointerCaptureRequest(bool enable, uint32_t seq) : enable(enable), seq(seq) {} + inline PointerCaptureRequest() : window(), seq(0) {} + inline PointerCaptureRequest(sp<IBinder> window, uint32_t seq) : window(window), seq(seq) {} inline bool operator==(const PointerCaptureRequest& other) const { - return enable == other.enable && seq == other.seq; + return window == other.window && seq == other.seq; } - explicit inline operator bool() const { return enable; } + inline bool isEnable() const { return window != nullptr; } - // True iff this is a request to enable Pointer Capture. - bool enable; + // The requesting window. + // If the request is to enable the capture, this is the input token of the window that requested + // pointer capture. Otherwise, this is nullptr. + sp<IBinder> window; // The sequence number for the request. uint32_t seq; |