InputDispatcher: Rename transferTouch APIs
Rename the old 'transferTouchFocus' API to 'transferTouchGesture' to
avoid confusion with window focus. The old 'transferTouch' method is
deprecated, and is named 'transferTouchOnDisplay'.
Bug: 324265767
Test: build
Change-Id: I97b3cbf4522cc66c3b277f516e8aab296167d23d
diff --git a/services/inputflinger/dispatcher/InputDispatcher.cpp b/services/inputflinger/dispatcher/InputDispatcher.cpp
index 3a18f25..8d43f3b 100644
--- a/services/inputflinger/dispatcher/InputDispatcher.cpp
+++ b/services/inputflinger/dispatcher/InputDispatcher.cpp
@@ -5562,8 +5562,8 @@
return std::make_tuple(nullptr, nullptr, ADISPLAY_ID_DEFAULT);
}
-bool InputDispatcher::transferTouchFocus(const sp<IBinder>& fromToken, const sp<IBinder>& toToken,
- bool isDragDrop) {
+bool InputDispatcher::transferTouchGesture(const sp<IBinder>& fromToken, const sp<IBinder>& toToken,
+ bool isDragDrop) {
if (fromToken == toToken) {
if (DEBUG_FOCUS) {
ALOGD("Trivial transfer to same window.");
@@ -5597,7 +5597,7 @@
}
if (DEBUG_FOCUS) {
- ALOGD("transferTouchFocus: fromWindowHandle=%s, toWindowHandle=%s",
+ ALOGD("%s: fromWindowHandle=%s, toWindowHandle=%s", __func__,
touchedWindow->windowHandle->getName().c_str(),
toWindowHandle->getName().c_str());
}
@@ -5683,7 +5683,8 @@
}
// Binder call
-bool InputDispatcher::transferTouch(const sp<IBinder>& destChannelToken, int32_t displayId) {
+bool InputDispatcher::transferTouchOnDisplay(const sp<IBinder>& destChannelToken,
+ int32_t displayId) {
sp<IBinder> fromToken;
{ // acquire lock
std::scoped_lock _l(mLock);
@@ -5703,7 +5704,7 @@
fromToken = from->getToken();
} // release lock
- return transferTouchFocus(fromToken, destChannelToken);
+ return transferTouchGesture(fromToken, destChannelToken);
}
void InputDispatcher::resetAndDropEverythingLocked(const char* reason) {
diff --git a/services/inputflinger/dispatcher/InputDispatcher.h b/services/inputflinger/dispatcher/InputDispatcher.h
index f2fd0ca..269bfdd 100644
--- a/services/inputflinger/dispatcher/InputDispatcher.h
+++ b/services/inputflinger/dispatcher/InputDispatcher.h
@@ -124,9 +124,9 @@
int32_t displayId) override;
void setMaximumObscuringOpacityForTouch(float opacity) override;
- bool transferTouchFocus(const sp<IBinder>& fromToken, const sp<IBinder>& toToken,
- bool isDragDrop = false) override;
- bool transferTouch(const sp<IBinder>& destChannelToken, int32_t displayId) override;
+ bool transferTouchGesture(const sp<IBinder>& fromToken, const sp<IBinder>& toToken,
+ bool isDragDrop = false) override;
+ bool transferTouchOnDisplay(const sp<IBinder>& destChannelToken, int32_t displayId) override;
base::Result<std::unique_ptr<InputChannel>> createInputChannel(
const std::string& name) override;
diff --git a/services/inputflinger/dispatcher/include/InputDispatcherInterface.h b/services/inputflinger/dispatcher/include/InputDispatcherInterface.h
index 36cebcc..7c440e8 100644
--- a/services/inputflinger/dispatcher/include/InputDispatcherInterface.h
+++ b/services/inputflinger/dispatcher/include/InputDispatcherInterface.h
@@ -141,21 +141,22 @@
virtual void setMaximumObscuringOpacityForTouch(float opacity) = 0;
/**
- * Transfers touch focus from one window to another window. Transferring touch focus will not
+ * Transfers a touch gesture from one window to another window. Transferring touch will not
* have any effect on the focused window.
*
- * Returns true on success. False if the window did not actually have touch focus.
+ * Returns true on success. False if the window did not actually have an active touch gesture.
*/
- virtual bool transferTouchFocus(const sp<IBinder>& fromToken, const sp<IBinder>& toToken,
- bool isDragDrop) = 0;
+ virtual bool transferTouchGesture(const sp<IBinder>& fromToken, const sp<IBinder>& toToken,
+ bool isDragDrop) = 0;
/**
- * Transfer touch focus to the provided channel, no matter where the current touch is.
- * Transferring touch focus will not have any effect on the focused window.
+ * Transfer a touch gesture to the provided channel, no matter where the current touch is.
+ * Transferring touch will not have any effect on the focused window.
*
- * Return true on success, false if there was no on-going touch.
+ * Returns true on success, false if there was no on-going touch on the display.
+ * @deprecated
*/
- virtual bool transferTouch(const sp<IBinder>& destChannelToken, int32_t displayId) = 0;
+ virtual bool transferTouchOnDisplay(const sp<IBinder>& destChannelToken, int32_t displayId) = 0;
/**
* Sets focus on the specified window.