Fix crash in Flattener dumpsys

When there are multiple connected displays where only one of them is
powered on, then caching is enabled on all displays but may
historically only been used on one. This means that mInitialLayerCounts
may be empty, which breaks retrieving the max element with
std::max_element. Add an emptiness check to sidestep that issue.

Bug: 187736454
Test: dumpsys SurfaceFlinger --planner
Change-Id: Iee917bb75c89e47f92f3440dd58bc58755e1f7b4
1 file changed