Call pilfer pointers when second pointer goes down during D&D
We added new functionality to pilferPointers API in ag/18234604.
Using it we can extend the functionality of drag and drop to
allow user to interact with the UI while using 1 pointer/finger
to drag. Pilfering pointers allows gesture monitors to restart
gesture detection with new pointers that down.
Avoid pilfering right after transferTouch on D&D to prevent
security bug: Apps can misuse startDragAndDrop() API to keep
pilfering pointers for gesture monitors and user can get stuck
in an app. Instead we will pilfer when a second pointer goes down
indicating user want to interact while using D&D.
DD: go/global_drag_and_drop
Bug: 220109830
Test: atest inputflinger_tests
Change-Id: I956f040ff307021bb2f74a06228c6addb90e2168
diff --git a/services/inputflinger/dispatcher/InputDispatcher.h b/services/inputflinger/dispatcher/InputDispatcher.h
index 44a6dc3..50124a6 100644
--- a/services/inputflinger/dispatcher/InputDispatcher.h
+++ b/services/inputflinger/dispatcher/InputDispatcher.h
@@ -255,6 +255,8 @@
void removeConnectionLocked(const sp<Connection>& connection) REQUIRES(mLock);
+ status_t pilferPointersLocked(const sp<IBinder>& token) REQUIRES(mLock);
+
template <typename T>
struct StrongPointerHash {
std::size_t operator()(const sp<T>& b) const { return std::hash<T*>{}(b.get()); }