Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit af0ec27e authored by Ady Abraham's avatar Ady Abraham
Browse files

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
parent dc705b9e
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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;
+6 −0
Original line number Diff line number Diff line
@@ -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