summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Ady Abraham <adyabr@google.com> 2019-03-28 11:38:31 -0700
committer Ady Abraham <adyabr@google.com> 2019-03-28 11:39:22 -0700
commitaf0ec27efb9890e5d7272220c069bb0f6b365bc8 (patch)
treefd582652ee1abb99b41dc4aed72de5fb4e3a0768
parentdc705b9eafeb07326155a580e722c7dca8d61892 (diff)
SurfaceFlinger: fix invalid PhysicalDisplayId in onConfigChanged event
A conversion error (uint64_t -> uint32_t) was causing a trunction of displayId value which lead to invalid displayId in onConfigChanged. Test: adb shell /data/nativetest64/libsurfaceflinger_unittest/libsurfaceflinger_unittest Bug: 129159940 Change-Id: I9d24cac0b9e74c7b20421d2b7d9fd65c16cca9e1
-rw-r--r--services/surfaceflinger/Scheduler/EventThread.cpp2
-rw-r--r--services/surfaceflinger/tests/unittests/EventThreadTest.cpp6
2 files changed, 7 insertions, 1 deletions
diff --git a/services/surfaceflinger/Scheduler/EventThread.cpp b/services/surfaceflinger/Scheduler/EventThread.cpp
index 78bf7c5c49..a760079069 100644
--- a/services/surfaceflinger/Scheduler/EventThread.cpp
+++ b/services/surfaceflinger/Scheduler/EventThread.cpp
@@ -97,7 +97,7 @@ DisplayEventReceiver::Event makeVSync(PhysicalDisplayId displayId, nsecs_t times
return event;
}
-DisplayEventReceiver::Event makeConfigChanged(uint32_t displayId, int32_t configId) {
+DisplayEventReceiver::Event makeConfigChanged(PhysicalDisplayId displayId, int32_t configId) {
DisplayEventReceiver::Event event;
event.header = {DisplayEventReceiver::DISPLAY_EVENT_CONFIG_CHANGED, displayId, systemTime()};
event.config.configId = configId;
diff --git a/services/surfaceflinger/tests/unittests/EventThreadTest.cpp b/services/surfaceflinger/tests/unittests/EventThreadTest.cpp
index 406ec81ce4..249c78f09c 100644
--- a/services/surfaceflinger/tests/unittests/EventThreadTest.cpp
+++ b/services/surfaceflinger/tests/unittests/EventThreadTest.cpp
@@ -38,6 +38,7 @@ namespace {
constexpr PhysicalDisplayId INTERNAL_DISPLAY_ID = 111;
constexpr PhysicalDisplayId EXTERNAL_DISPLAY_ID = 222;
+constexpr PhysicalDisplayId DISPLAY_ID_64BIT = 0xabcd12349876fedcULL;
class MockVSyncSource : public VSyncSource {
public:
@@ -470,5 +471,10 @@ TEST_F(EventThreadTest, postConfigChangedExternal) {
expectConfigChangedEventReceivedByConnection(EXTERNAL_DISPLAY_ID, 5);
}
+TEST_F(EventThreadTest, postConfigChangedPrimary64bit) {
+ mThread->onConfigChanged(DISPLAY_ID_64BIT, 7);
+ expectConfigChangedEventReceivedByConnection(DISPLAY_ID_64BIT, 7);
+}
+
} // namespace
} // namespace android