Change Task to have generic WindowContainer children (73/n)

- Step towards Tasks containing other Tasks.
- There are several places where we want to perform an operation on all
activities in a branch of the hierarchy. We end up looping based on
the parent knowing what type of children is in the sub-branch.
Instead use forAllActivities() to perfrom the operation on all
activities in the sub-branch.

Bug: 80414790
Test: Existing tests pass
Change-Id: I3dd08784e82b3eceac9aacacd4d1f1bd85ef8c02
diff --git a/services/core/java/com/android/server/wm/ActivityMetricsLogger.java b/services/core/java/com/android/server/wm/ActivityMetricsLogger.java
index 9fa5d9f1..a593ef8 100644
--- a/services/core/java/com/android/server/wm/ActivityMetricsLogger.java
+++ b/services/core/java/com/android/server/wm/ActivityMetricsLogger.java
@@ -546,13 +546,7 @@
 
     /** @return {@code true} if the given task has an activity will be drawn. */
     private static boolean hasActivityToBeDrawn(Task t) {
-        for (int i = t.getChildCount() - 1; i >= 0; --i) {
-            final ActivityRecord r = t.getChildAt(i);
-            if (r.mVisibleRequested && !r.mDrawn && !r.finishing) {
-                return true;
-            }
-        }
-        return false;
+        return t.forAllActivities((r) -> r.mVisibleRequested && !r.mDrawn && !r.finishing);
     }
 
     private void checkVisibility(Task t, ActivityRecord r) {