Move DimLayer to Root if translucent window and not multi-window

When the first window in a Task opens, the Task will animate to enter
instead of the app with the introduction of hierarchal animations. This
causes problems if the first window is translucent and has a dim since
the dim layer will animate with the Task instead of fading in.

To prevent that, we can move the dim layer to a higher up level in the
hierarchy, but still maintain the relative Z order. We still place the
dim at the Task level if the Task is non translucent or if the Task is
in multi-window mode. We find the root task and check if it's translucent.
If so, it will find the Dimmer object for the next level up in the
hierarchy and create the dim layer at that level instead of the Task.
If the Task is not translucent, we add the dimmer to the Task level.

Since the dim layer is at the display level, translucent Tasks don't
behave correctly when swiping to recents. When the dim layer was
parented to the Task, the dim layer would animate with the Task when
swiping up to recents. In this change, the dim layer will fade out if
placed on the display level when swiping to go to recents.

Test: Open assistant and see dim layer fade in
Test: Open translucent app with dim layer. Swipe to recents
Fixes: 148938447
Change-Id: I6e275b778da4cb7aeda3b3483a14f5f9d2796e44
2 files changed