Skip to content

Commit 2b94087

Browse files
author
Arpit Singh
committed
[1/n CD Cursor] Pass topology to InputDispatcher
Pass the display topology to InputDispatcher. Bug: 367661487 Test: atest inputflinger_tests Flag: com.android.input.flags.connected_displays_cursor Change-Id: Ie4dfa53d232a5d2b47b431eed4c307e61235c0cf
1 parent 3595275 commit 2b94087

3 files changed

Lines changed: 26 additions & 0 deletions

File tree

services/inputflinger/dispatcher/InputDispatcher.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7267,6 +7267,12 @@ void InputDispatcher::setInputMethodConnectionIsActive(bool isActive) {
72677267
}
72687268
}
72697269

7270+
void InputDispatcher::setDisplayTopology(
7271+
const android::DisplayTopologyGraph& displayTopologyGraph) {
7272+
std::scoped_lock _l(mLock);
7273+
mWindowInfos.setDisplayTopology(displayTopologyGraph);
7274+
}
7275+
72707276
InputDispatcher::ConnectionManager::ConnectionManager(const sp<android::Looper>& looper)
72717277
: mLooper(looper) {}
72727278

@@ -7402,6 +7408,11 @@ void InputDispatcher::DispatcherWindowInfo::setMaximumObscuringOpacityForTouch(f
74027408
mMaximumObscuringOpacityForTouch = opacity;
74037409
}
74047410

7411+
void InputDispatcher::DispatcherWindowInfo::setDisplayTopology(
7412+
const DisplayTopologyGraph& displayTopologyGraph) {
7413+
mTopology = displayTopologyGraph;
7414+
}
7415+
74057416
ftl::Flags<InputTarget::Flags> InputDispatcher::DispatcherTouchState::getTargetFlags(
74067417
const sp<WindowInfoHandle>& targetWindow, vec2 targetPosition, bool isSplit,
74077418
const DispatcherWindowInfo& windowInfos) {

services/inputflinger/dispatcher/InputDispatcher.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,8 @@ class InputDispatcher : public android::InputDispatcherInterface {
164164

165165
void setInputMethodConnectionIsActive(bool isActive) override;
166166

167+
void setDisplayTopology(const DisplayTopologyGraph& displayTopologyGraph) override;
168+
167169
private:
168170
enum class DropReason {
169171
NOT_DROPPED,
@@ -291,6 +293,8 @@ class InputDispatcher : public android::InputDispatcherInterface {
291293

292294
void setMaximumObscuringOpacityForTouch(float opacity);
293295

296+
void setDisplayTopology(const DisplayTopologyGraph& displayTopologyGraph);
297+
294298
// Get a reference to window handles by display, return an empty vector if not found.
295299
const std::vector<sp<android::gui::WindowInfoHandle>>& getWindowHandlesForDisplay(
296300
ui::LogicalDisplayId displayId) const;
@@ -341,6 +345,11 @@ class InputDispatcher : public android::InputDispatcherInterface {
341345
std::unordered_map<ui::LogicalDisplayId /*displayId*/, android::gui::DisplayInfo>
342346
mDisplayInfos;
343347
float mMaximumObscuringOpacityForTouch{1.0f};
348+
349+
// Topology is initialized with default-constructed value, which is an empty topology until
350+
// we receive setDisplayTopology call. Meanwhile we will treat every display as an
351+
// independent display.
352+
DisplayTopologyGraph mTopology;
344353
};
345354

346355
DispatcherWindowInfo mWindowInfos GUARDED_BY(mLock);

services/inputflinger/dispatcher/include/InputDispatcherInterface.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include <android/os/InputEventInjectionSync.h>
2525
#include <gui/InputApplication.h>
2626
#include <gui/WindowInfo.h>
27+
#include <input/DisplayTopologyGraph.h>
2728
#include <input/InputDevice.h>
2829
#include <input/InputTransport.h>
2930
#include <unordered_map>
@@ -243,6 +244,11 @@ class InputDispatcherInterface : public InputListenerInterface {
243244
* Notify the dispatcher that the state of the input method connection changed.
244245
*/
245246
virtual void setInputMethodConnectionIsActive(bool isActive) = 0;
247+
248+
/*
249+
* Notify the dispatcher of the latest DisplayTopology.
250+
*/
251+
virtual void setDisplayTopology(const DisplayTopologyGraph& displayTopologyGraph) = 0;
246252
};
247253

248254
} // namespace android

0 commit comments

Comments
 (0)