Check idle activity from all visible task fragment

The very old legacy logic only handles fullscreen windowing mode case.
If multiple tasks are launching at the same time, the power mode may
be finished too early by the first activity reports idle. That results
in a long startup delay.

Also add a case to handle cold launching activity. Before the process
is attached, the activity record state is INITIALIZING. But if it can
be resumed after its process is attached, its idle state should also
be considered. E.g. launching a split-screen pair with hot launch of
one side and cold launch on another side. When the first one reported
idle, allResumedActivitiesIdle should still return false.

Fix: 356522395
Flag: EXEMPT bugfix
Test: atest RootWindowContainerTests#testAllResumedActivitiesIdle
Change-Id: Ida677ec93916f37cf2aebd33113f9730d8c211ab
3 files changed