Simplify activity sleeping condition

It was confusing to check from root task. Since individual TaskFragment
can have resume-able activity, it should check the container visibility
rather than isFocusedRootTaskOnDisplay. So it won't miss the cases of
multiple-window mode.

Also reorder the cheaper conditions to front, so the methods can reduce
extra unnecessary execution.

Bug: 163976519
Flag: EXEMPT clean up legacy logic
Test: atest RootTaskTests#testShouldSleepActivities
Change-Id: Ib79aae0f445b6e7ecbb547a69f0eaa60357fe937
4 files changed