SF: Refactor HWComposer::onHotplug()
Currently HWComposer::onHotplug() contains logic that is
executed when hotplug disconnect or connect event occurs.
However reading what exactly is done during e.g. hotplug
connect is hard, because the logic is spread between two
if statements and the function HWComposer::onHotplugConnect().
This change moves all hotplug connect logic to
HWComposer::onHotplugConnect() and all disconnect logic
to a new function HWComposer::onHotplugDisconnect().
Additionally this CLs refactors onHotplugConnect() which
is currently responsible for multiple concerns, which is
making the code hard to understand and reuse.
- checking if the event should be ignored is moved to
a new function shouldIgnoreHotplugConnect()
- creating the necessary state for the new display is
moved to a new function allocatePhysicalDisplay()
Some of the newly created functions will be directly reused
in following CLs.
Bug: 143451809
Test: m surfaceflinger
Test: atest libsurfaceflinger_unittest
Merged-In: Ib4dae2ce81e8cac176a56b6de787a4f76d01c050
Change-Id: Ib4dae2ce81e8cac176a56b6de787a4f76d01c050
(cherry picked from commit 05f9398f9405587f8d1a5c5c17feffc89890ca2e)
3 files changed