summaryrefslogtreecommitdiff
path: root/services/inputflinger/InputReaderBase.cpp
diff options
context:
space:
mode:
author Xin Li <delphij@google.com> 2021-10-06 22:53:36 +0000
committer Xin Li <delphij@google.com> 2021-10-06 22:53:36 +0000
commit097d2a50873100486d65a69cb1cbabf37fb3b188 (patch)
treec2f19f92e4503b2de0afeebdd9bf7aeb1bb2e9c1 /services/inputflinger/InputReaderBase.cpp
parentcbfb18e134845deeace954bbba818acda48cb80f (diff)
parentadcb6a2733c1baf66e5ad72365965ab504f5f959 (diff)
Merge Android 12
Bug: 202323961 Merged-In: Ifb27b3eb12454fa96f07e6797745c697b4f831c4 Change-Id: I2a7f5931477fddb51564c2eabcdc96ce58888ce8
Diffstat (limited to 'services/inputflinger/InputReaderBase.cpp')
-rw-r--r--services/inputflinger/InputReaderBase.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/services/inputflinger/InputReaderBase.cpp b/services/inputflinger/InputReaderBase.cpp
index b2dadf8460..9cc777d450 100644
--- a/services/inputflinger/InputReaderBase.cpp
+++ b/services/inputflinger/InputReaderBase.cpp
@@ -19,6 +19,9 @@
//#define LOG_NDEBUG 0
#include "InputReaderBase.h"
+#include "input/DisplayViewport.h"
+#include "input/Input.h"
+#include "input/NamedEnum.h"
#include <android/log.h>
#include <android-base/stringprintf.h>
@@ -99,17 +102,19 @@ std::optional<DisplayViewport> InputReaderConfiguration::getDisplayViewportByTyp
size_t count = 0;
std::optional<DisplayViewport> result = std::nullopt;
for (const DisplayViewport& currentViewport : mDisplays) {
- // Return the first match
+ // Return the first match, or the default display if we're looking for the internal viewport
if (currentViewport.type == type) {
- if (!result) {
+ if (!result ||
+ (type == ViewportType::INTERNAL &&
+ currentViewport.displayId == ADISPLAY_ID_DEFAULT)) {
result = std::make_optional(currentViewport);
}
count++;
}
}
if (count > 1) {
- ALOGE("Found %zu viewports with type %s, but expected 1 at most",
- count, viewportTypeToString(type));
+ ALOGW("Found %zu viewports with type %s, but expected 1 at most", count,
+ NamedEnum::string(type).c_str());
}
return result;
}