Add isEmpty info in SplitInfo

Currently SplitInfo callback didn't dispatched if the top Activity is
from other process than TaskFragmentOrganizer's.

This CL adds a flag isEmpty in SplitInfo to make users know if there may
be an Activity from other process even if Activity list is empty.

Bug: 202230350
Test: manual - reproducible steps mentioned in bug 202230350
Change-Id: Ie28a4db9fffb2d661592cf43f9316aa0824e4635
diff --git a/libs/WindowManager/Jetpack/src/androidx/window/extensions/embedding/SplitController.java b/libs/WindowManager/Jetpack/src/androidx/window/extensions/embedding/SplitController.java
index 42b4380..20515e7 100644
--- a/libs/WindowManager/Jetpack/src/androidx/window/extensions/embedding/SplitController.java
+++ b/libs/WindowManager/Jetpack/src/androidx/window/extensions/embedding/SplitController.java
@@ -516,12 +516,8 @@
                 // Skipping containers that do not have any activities to report.
                 continue;
             }
-            ActivityStack primaryContainer =
-                    new ActivityStack(
-                            container.getPrimaryContainer().collectActivities());
-            ActivityStack secondaryContainer =
-                    new ActivityStack(
-                            container.getSecondaryContainer().collectActivities());
+            ActivityStack primaryContainer = container.getPrimaryContainer().toActivityStack();
+            ActivityStack secondaryContainer = container.getSecondaryContainer().toActivityStack();
             SplitInfo splitState = new SplitInfo(primaryContainer,
                     secondaryContainer,
                     // Splits that are not showing side-by-side are reported as having 0 split
diff --git a/libs/WindowManager/Jetpack/src/androidx/window/extensions/embedding/TaskFragmentContainer.java b/libs/WindowManager/Jetpack/src/androidx/window/extensions/embedding/TaskFragmentContainer.java
index 54e44a7..80d9c2c 100644
--- a/libs/WindowManager/Jetpack/src/androidx/window/extensions/embedding/TaskFragmentContainer.java
+++ b/libs/WindowManager/Jetpack/src/androidx/window/extensions/embedding/TaskFragmentContainer.java
@@ -109,6 +109,10 @@
         return allActivities;
     }
 
+    ActivityStack toActivityStack() {
+        return new ActivityStack(collectActivities(), mInfo.getRunningActivityCount() == 0);
+    }
+
     void addPendingAppearedActivity(@NonNull Activity pendingAppearedActivity) {
         mPendingAppearedActivities.add(pendingAppearedActivity);
     }
diff --git a/libs/WindowManager/Jetpack/window-extensions-release.aar b/libs/WindowManager/Jetpack/window-extensions-release.aar
index 4f36c9c..830d13d 100644
--- a/libs/WindowManager/Jetpack/window-extensions-release.aar
+++ b/libs/WindowManager/Jetpack/window-extensions-release.aar
Binary files differ