SF: Store DeviceProductInfo in DisplayDeviceState
After a hotplug we store DeviceProductInfo in
DisplayDeviceState, so it can be used later without calling
into HardwareComposer and parsing the EDID.
Bug: 149075047
Test: atest libsurfaceflinger_unittest
Test: 1. flash a device
2. boot a device connected to a display
3. Check for sensible DeviceProductInfo:
adb shell dumpsys SurfaceFlinger | grep deviceProductInfo
adb shell dumpsys display | grep deviceProductInfo
4. reboot without a display
5. Check that DeviceProductInfo is empty / null in
adb shell dumpsys SurfaceFlinger | grep deviceProductInfo
adb shell dumpsys display | grep deviceProductInfo
Change-Id: Ide3354c1779c2ced88954c7b50e5500568d8482b
diff --git a/services/surfaceflinger/tests/unittests/DisplayTransactionTest.cpp b/services/surfaceflinger/tests/unittests/DisplayTransactionTest.cpp
index a554b1b..9130b04 100644
--- a/services/surfaceflinger/tests/unittests/DisplayTransactionTest.cpp
+++ b/services/surfaceflinger/tests/unittests/DisplayTransactionTest.cpp
@@ -609,13 +609,12 @@
if (PhysicalDisplay::HAS_IDENTIFICATION_DATA) {
EXPECT_CALL(*test->mComposer, getDisplayIdentificationData(HWC_DISPLAY_ID, _, _))
- .WillRepeatedly(
- DoAll(SetArgPointee<1>(PhysicalDisplay::PORT),
- SetArgPointee<2>(PhysicalDisplay::GET_IDENTIFICATION_DATA()),
- Return(Error::NONE)));
+ .WillOnce(DoAll(SetArgPointee<1>(PhysicalDisplay::PORT),
+ SetArgPointee<2>(PhysicalDisplay::GET_IDENTIFICATION_DATA()),
+ Return(Error::NONE)));
} else {
EXPECT_CALL(*test->mComposer, getDisplayIdentificationData(HWC_DISPLAY_ID, _, _))
- .WillRepeatedly(Return(Error::UNSUPPORTED));
+ .WillOnce(Return(Error::UNSUPPORTED));
}
}
@@ -1822,7 +1821,7 @@
ASSERT_TRUE(displayId);
const auto hwcDisplayId = Case::Display::HWC_DISPLAY_ID_OPT::value;
ASSERT_TRUE(hwcDisplayId);
- state.physical = {*displayId, *connectionType, *hwcDisplayId};
+ state.physical = {.id = *displayId, .type = *connectionType, .hwcDisplayId = *hwcDisplayId};
}
state.isSecure = static_cast<bool>(Case::Display::SECURE);
@@ -1998,7 +1997,9 @@
ASSERT_TRUE(displayId);
const auto hwcDisplayId = Case::Display::HWC_DISPLAY_ID_OPT::value;
ASSERT_TRUE(hwcDisplayId);
- expectedPhysical = {*displayId, *connectionType, *hwcDisplayId};
+ expectedPhysical = {.id = *displayId,
+ .type = *connectionType,
+ .hwcDisplayId = *hwcDisplayId};
}
// The display should have been set up in the current display state