SF: Decouple EventThread from DisplayDevice
EventThread uses DisplayDevice::DisplayType constants, which will be
removed in a follow-up CL. This CL replaces them with local constants as
a stopgap until stable display IDs are propagated through the SF/WM
interface.
Bug: 74619554
Test: libsurfaceflinger_unittest
Change-Id: I68be363dc58c5e3aa17d05fba156d520a01fa775
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index db534cc..5acf2b8 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -2293,8 +2293,11 @@
if (const auto display = getDisplayDeviceLocked(draw.keyAt(i))) {
display->disconnect(getHwComposer());
}
- if (draw[i].type < DisplayDevice::NUM_BUILTIN_DISPLAY_TYPES)
- mEventThread->onHotplugReceived(draw[i].type, false);
+ if (draw[i].type == DisplayDevice::DISPLAY_PRIMARY) {
+ mEventThread->onHotplugReceived(EventThread::DisplayType::Primary, false);
+ } else if (draw[i].type == DisplayDevice::DISPLAY_EXTERNAL) {
+ mEventThread->onHotplugReceived(EventThread::DisplayType::External, false);
+ }
mDisplays.erase(draw.keyAt(i));
} else {
// this display is in both lists. see if something changed.
@@ -2395,7 +2398,13 @@
setupNewDisplayDeviceInternal(displayToken, displayId, state,
dispSurface, producer));
if (!state.isVirtual()) {
- mEventThread->onHotplugReceived(state.type, true);
+ if (state.type == DisplayDevice::DISPLAY_PRIMARY) {
+ mEventThread->onHotplugReceived(EventThread::DisplayType::Primary,
+ true);
+ } else if (state.type == DisplayDevice::DISPLAY_EXTERNAL) {
+ mEventThread->onHotplugReceived(EventThread::DisplayType::External,
+ true);
+ }
}
}
}