SF: Reject hotplug if display modes failed to load
Do not abort if the repeated attempts to query the display modes and
active mode fail, which could happen if HWC disconnected the display
but the disconnect event has not yet been processed.
Bug: 241286153
Bug: 235488695
Test: HotplugTest.rejectsHotplugIfFailedToLoadDisplayModes
Change-Id: I0997a502dc88a28f993f51a8ef23aeac17694b90
diff --git a/services/surfaceflinger/tests/unittests/DisplayTransactionTest.cpp b/services/surfaceflinger/tests/unittests/DisplayTransactionTest.cpp
index 044c112..31262b3 100644
--- a/services/surfaceflinger/tests/unittests/DisplayTransactionTest.cpp
+++ b/services/surfaceflinger/tests/unittests/DisplayTransactionTest.cpp
@@ -168,7 +168,12 @@
}
bool DisplayTransactionTest::hasPhysicalHwcDisplay(HWDisplayId hwcDisplayId) const {
- return mFlinger.hwcPhysicalDisplayIdMap().count(hwcDisplayId) == 1;
+ const auto& map = mFlinger.hwcPhysicalDisplayIdMap();
+
+ const auto it = map.find(hwcDisplayId);
+ if (it == map.end()) return false;
+
+ return mFlinger.hwcDisplayData().count(it->second) == 1;
}
bool DisplayTransactionTest::hasTransactionFlagSet(int32_t flag) const {