libhwc2.1: fix ExynosExternalDisplay::disable()

When DP cable is connected, the initial state of external display is:
mHpdStatus = true
mEnabled = false

External display will remain in the above state until DP mirroring
has been confirmed via UI dialog.

If DP cable is disconnected in this state, or if the sink unexpectedly
sends a quick HPD unplug event, external display state changes back to:
mHpdStatus = false
mEnabled = false

and SurfaceFlinger subsequently calls:
ExynosExternalDisplay::setPowerMode(OFF)
  ExynosExternalDisplay::disable()

We need to do full power-down in disable() when mHpdStatus = false.
We cannot skip it just because mEnabled = false.

This change fixes the handling of unexpected rapid sequence of:
HPD plug -> HPD unplug -> HPD plug
that various sinks and hubs use to reset their internal state.

Bug: 310693327
Test: manual testing with USB hub and monitor
Change-Id: Ieffea865b19c802c6903591a2356a7ccb3c1775d
1 file changed