diff options
author | 2024-02-06 21:03:19 +0000 | |
---|---|---|
committer | 2024-02-06 21:03:19 +0000 | |
commit | dd09097ec2656aaf9cdf5a9e312f404d56f8b960 (patch) | |
tree | 7889a114196506c6598e557fa33a507eec7d164c | |
parent | 036c283b3f8da1d93eb4a9bcce72d409ebe145cc (diff) | |
parent | 9f0fc5906280883cac1129a7947b741f45a97ae1 (diff) |
Merge "Report hotplug error to framework" into main
-rw-r--r-- | services/surfaceflinger/SurfaceFlinger.cpp | 6 | ||||
-rw-r--r-- | services/surfaceflinger/tests/unittests/SurfaceFlinger_HotplugTest.cpp | 12 |
2 files changed, 17 insertions, 1 deletions
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp index 89a341ff84..589ef99a63 100644 --- a/services/surfaceflinger/SurfaceFlinger.cpp +++ b/services/surfaceflinger/SurfaceFlinger.cpp @@ -3476,8 +3476,12 @@ const char* SurfaceFlinger::processHotplug(PhysicalDisplayId displayId, auto [displayModes, activeMode] = loadDisplayModes(displayId); if (!activeMode) { - // TODO(b/241286153): Report hotplug failure to the framework. ALOGE("Failed to hotplug display %s", to_string(displayId).c_str()); + if (FlagManager::getInstance().hotplug2()) { + mScheduler->onHotplugConnectionError(mAppConnectionHandle, + static_cast<int32_t>( + DisplayHotplugEvent::ERROR_UNKNOWN)); + } getHwComposer().disconnectDisplay(displayId); return nullptr; } diff --git a/services/surfaceflinger/tests/unittests/SurfaceFlinger_HotplugTest.cpp b/services/surfaceflinger/tests/unittests/SurfaceFlinger_HotplugTest.cpp index a270dc91f2..897f9a0319 100644 --- a/services/surfaceflinger/tests/unittests/SurfaceFlinger_HotplugTest.cpp +++ b/services/surfaceflinger/tests/unittests/SurfaceFlinger_HotplugTest.cpp @@ -17,8 +17,14 @@ #undef LOG_TAG #define LOG_TAG "LibSurfaceFlingerUnittests" +#include <aidl/android/hardware/graphics/common/DisplayHotplugEvent.h> +#include <com_android_graphics_surfaceflinger_flags.h> +#include <common/test/FlagUtils.h> #include "DisplayTransactionTestHelpers.h" +using namespace com::android::graphics::surfaceflinger; +using ::aidl::android::hardware::graphics::common::DisplayHotplugEvent; + namespace android { class HotplugTest : public DisplayTransactionTest {}; @@ -87,6 +93,8 @@ TEST_F(HotplugTest, ignoresDuplicateDisconnection) { } TEST_F(HotplugTest, rejectsHotplugIfFailedToLoadDisplayModes) { + SET_FLAG_FOR_TEST(flags::connected_display, true); + // Inject a primary display. PrimaryDisplayVariant::injectHwcDisplay(this); @@ -94,6 +102,10 @@ TEST_F(HotplugTest, rejectsHotplugIfFailedToLoadDisplayModes) { constexpr bool kFailedHotplug = true; ExternalDisplay::setupHwcHotplugCallExpectations<kFailedHotplug>(this); + EXPECT_CALL(*mEventThread, + onHotplugConnectionError(static_cast<int32_t>(DisplayHotplugEvent::ERROR_UNKNOWN))) + .Times(1); + // Simulate a connect event that fails to load display modes due to HWC already having // disconnected the display but SF yet having to process the queued disconnect event. EXPECT_CALL(*mComposer, getActiveConfig(ExternalDisplay::HWC_DISPLAY_ID, _)) |