Fix drag and drop (1/3)
Added ability to send different InputWindowCommands to SurfaceFlinger. Also
added transferTouchFocus function from client so it can be translated to an
InputWindowCommand and passed to SF.
Bug: 120463595
Test: Builds, no uses of new function
Change-Id: I17deaf4a96d5a5bf6b14795d66419acffdb10882
diff --git a/libs/gui/SurfaceComposerClient.cpp b/libs/gui/SurfaceComposerClient.cpp
index 5b004e2..e043762 100644
--- a/libs/gui/SurfaceComposerClient.cpp
+++ b/libs/gui/SurfaceComposerClient.cpp
@@ -166,6 +166,7 @@
mEarlyWakeup(other.mEarlyWakeup) {
mDisplayStates = other.mDisplayStates;
mComposerStates = other.mComposerStates;
+ mInputWindowCommands = other.mInputWindowCommands;
}
SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::merge(Transaction&& other) {
@@ -199,6 +200,8 @@
}
other.mListenerCallbacks.clear();
+ mInputWindowCommands.merge(other.mInputWindowCommands);
+
return *this;
}
@@ -265,8 +268,8 @@
mEarlyWakeup = false;
sp<IBinder> applyToken = IInterface::asBinder(TransactionCompletedListener::getIInstance());
-
- sf->setTransactionState(composerStates, displayStates, flags, applyToken);
+ sf->setTransactionState(composerStates, displayStates, flags, applyToken, mInputWindowCommands);
+ mInputWindowCommands.clear();
mStatus = NO_ERROR;
return NO_ERROR;
}
@@ -804,6 +807,16 @@
s->what |= layer_state_t::eInputInfoChanged;
return *this;
}
+
+SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::transferTouchFocus(
+ const sp<IBinder>& fromToken, const sp<IBinder>& toToken) {
+ InputWindowCommands::TransferTouchFocusCommand transferTouchFocusCommand;
+ transferTouchFocusCommand.fromToken = fromToken;
+ transferTouchFocusCommand.toToken = toToken;
+ mInputWindowCommands.transferTouchFocusCommands.emplace_back(transferTouchFocusCommand);
+ return *this;
+}
+
#endif
SurfaceComposerClient::Transaction& SurfaceComposerClient::Transaction::destroySurface(