[SF] Don't reset display state on reconnection
Currently we reset the display state when hotplug reconnect
is received for an already connected display. This is not
correct, instead the state has to be updated by DisplayManager.
This fixes a bug when config_maxUiWidth is set in frameworks/
base. In this case the framework sets the display viewport to
match the limited layer stack size but this setting is lost
after a hotplug.
Bug: 157549449
Test: build, flash, plug out and in the display, make sure the
picture is still properly displayed
Change-Id: If8536963a4b912a6ff7d41a0fe54181cae35cc65
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index 2d25319..0acd926 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -2674,7 +2674,8 @@
}
processDisplayAdded(displayToken, currentState);
if (currentState.physical) {
- initializeDisplays();
+ const auto display = getDisplayDeviceLocked(displayToken);
+ setPowerModeInternal(display, hal::PowerMode::ON);
}
return;
}