Improve readability and add protections against use after release NPE

Preventively ensure the dimLayer has not been released before trying to access it.

Fix: 308448047
Test: atest CtsWindowManagerDeviceOther:android.server.wm.other.MinimalPostProcessingTests#testTwoVisibleWindowsSecondOnePrefersMinimalPostProcessing --iteration 100
Test: atest DimmerTests
Change-Id: Id08838e0a98ba949382442b8fac8e81156d1aa40
5 files changed