summaryrefslogtreecommitdiff
path: root/services/inputflinger/InputManager.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'services/inputflinger/InputManager.cpp')
-rw-r--r--services/inputflinger/InputManager.cpp36
1 files changed, 36 insertions, 0 deletions
diff --git a/services/inputflinger/InputManager.cpp b/services/inputflinger/InputManager.cpp
index 519faa6b5c..40ca6a7d6d 100644
--- a/services/inputflinger/InputManager.cpp
+++ b/services/inputflinger/InputManager.cpp
@@ -21,6 +21,7 @@
#include "InputManager.h"
#include <log/log.h>
+#include <unordered_map>
namespace android {
@@ -90,4 +91,39 @@ sp<InputDispatcherInterface> InputManager::getDispatcher() {
return mDispatcher;
}
+class BinderApplicationHandle : public InputApplicationHandle {
+public:
+ BinderApplicationHandle() = default;
+
+ bool updateInfo() override {
+ return true;
+ }
+};
+
+class BinderWindowHandle : public InputWindowHandle {
+public:
+ BinderWindowHandle(const InputWindowInfo& info) :
+ InputWindowHandle(new BinderApplicationHandle()) {
+
+ mInfo = info;
+ }
+
+ bool updateInfo() override {
+ return true;
+ }
+};
+
+void InputManager::setInputWindows(const Vector<InputWindowInfo>& infos) {
+ std::unordered_map<int32_t, Vector<sp<InputWindowHandle>>> handlesPerDisplay;
+
+ Vector<sp<InputWindowHandle>> handles;
+ for (const auto& info : infos) {
+ handlesPerDisplay.emplace(info.displayId, Vector<sp<InputWindowHandle>>());
+ handlesPerDisplay[info.displayId].add(new BinderWindowHandle(info));
+ }
+ for (auto const& i : handlesPerDisplay) {
+ mDispatcher->setInputWindows(i.second, i.first);
+ }
+}
+
} // namespace android