SF: Fix two display identification bugs
1) getDisplayIdentificationData() was called on hotplug disconnect and
not just on hotplug connect. The DisplayTransactionTest had a
warning, and I've fixed the issue and made the test explicitly expect
zero calls so it will fail instead.
2) One of the tests in DisplayIdentificationTest had a use after free,
detected by enabling the address sanitizer on the unit test executable.
Bug: None
Test: Test passes with no errors or warnings
Change-Id: Iceda0d499d692991adfcbf5c772da736bd4a843f
diff --git a/services/surfaceflinger/tests/unittests/DisplayIdentificationTest.cpp b/services/surfaceflinger/tests/unittests/DisplayIdentificationTest.cpp
index 9113171..4f1c99e 100644
--- a/services/surfaceflinger/tests/unittests/DisplayIdentificationTest.cpp
+++ b/services/surfaceflinger/tests/unittests/DisplayIdentificationTest.cpp
@@ -77,20 +77,23 @@
}
TEST(DisplayIdentificationTest, parseEdid) {
- auto edid = parseEdid(asDisplayIdentificationData(kInternalEdid));
+ auto data = asDisplayIdentificationData(kInternalEdid);
+ auto edid = parseEdid(data);
ASSERT_TRUE(edid);
EXPECT_EQ(0x4ca3u, edid->manufacturerId);
EXPECT_STREQ("SEC", edid->pnpId.data());
// ASCII text should be used as fallback if display name and serial number are missing.
EXPECT_EQ("121AT11-801", edid->displayName);
- edid = parseEdid(asDisplayIdentificationData(kExternalEdid));
+ data = asDisplayIdentificationData(kExternalEdid);
+ edid = parseEdid(data);
ASSERT_TRUE(edid);
EXPECT_EQ(0x22f0u, edid->manufacturerId);
EXPECT_STREQ("HWP", edid->pnpId.data());
EXPECT_EQ("HP ZR30w", edid->displayName);
- edid = parseEdid(asDisplayIdentificationData(kExternalEedid));
+ data = asDisplayIdentificationData(kExternalEedid);
+ edid = parseEdid(data);
ASSERT_TRUE(edid);
EXPECT_EQ(0x4c2du, edid->manufacturerId);
EXPECT_STREQ("SAM", edid->pnpId.data());