Make LogicalLight @Nullable: part two (internal)

Primarily refactors populateAvailableLights()

* breaks AIDL and HIDL logic into two small helpers
* stops going and inventing fake lights if we have the AIDL HAL.

Also reworks some LightsService internals

* move "system light" definition into the light class
* rename mLights -> mLightsByType (matching mLightsById)
* put the traceEnd() for "setLightState" in one final block

The way the HIDL HAL goes and invents fake lights hasn't been changed,
to avoid breaking HALs that didn't implement getLights() before.

Bug: 151113302
Test: atest LightsManagerTest
Test: atest LightsServiceTest
Test: atest google/perf/boottime/boottime-test
Change-Id: I23545586a2fa44ec656cd4c58df61970ce6db979
1 file changed