summaryrefslogtreecommitdiff
path: root/services/inputflinger/InputReaderBase.cpp
diff options
context:
space:
mode:
author Garfield Tan <xutan@google.com> 2020-01-09 11:39:16 -0800
committer Garfield Tan <xutan@google.com> 2020-05-28 12:01:35 -0700
commit0a080c3666e39fef15fa8049e206c78225fcc6e3 (patch)
tree5a8e3d297310827cf6337f65a1211169c90a1dab /services/inputflinger/InputReaderBase.cpp
parentb0412cfa69e23444be62e2374674c8cf74ff90b7 (diff)
Let InputReader set mouse cursor's display.
InputReader was already responsible to bind device/event and display. It makes sense to further extend it to control the display where mouse cursor is shown. Bug: 146385350 Test: Mouse cursor shows up at expected display. Test: atest inputflinger_tests Change-Id: Ie7a9546550b70c8834462b06de929472196fe713 Merged-In: Ie7a9546550b70c8834462b06de929472196fe713
Diffstat (limited to 'services/inputflinger/InputReaderBase.cpp')
-rw-r--r--services/inputflinger/InputReaderBase.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/services/inputflinger/InputReaderBase.cpp b/services/inputflinger/InputReaderBase.cpp
index f48a64551e..0e2a2e7f9e 100644
--- a/services/inputflinger/InputReaderBase.cpp
+++ b/services/inputflinger/InputReaderBase.cpp
@@ -99,6 +99,16 @@ std::optional<DisplayViewport> InputReaderConfiguration::getDisplayViewportByPor
return std::nullopt;
}
+std::optional<DisplayViewport> InputReaderConfiguration::getDisplayViewportById(
+ int32_t displayId) const {
+ for (const DisplayViewport& currentViewport : mDisplays) {
+ if (currentViewport.displayId == displayId) {
+ return std::make_optional(currentViewport);
+ }
+ }
+ return std::nullopt;
+}
+
void InputReaderConfiguration::setDisplayViewports(const std::vector<DisplayViewport>& viewports) {
mDisplays = viewports;
}
@@ -125,4 +135,4 @@ void TouchAffineTransformation::applyTo(float& x, float& y) const {
y = newY;
}
-} // namespace android \ No newline at end of file
+} // namespace android