summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Chris Li <lihongyu@google.com> 2021-08-21 12:25:57 -0700
committer Chris Li <lihongyu@google.com> 2021-08-21 12:25:57 -0700
commit9c606e2740d48713eb1a45d477d94d1bbc0e2108 (patch)
treedf298c3c13d491b383247ab2d39d8dd7b167b595
parent50fc335c4bd62e4cca9932e69939983fa3a51b2e (diff)
getActivityTokenBelow should exclude finishing activity
This method was introduced in ag/15302841 to check the new launch activity and the activity below. However, when launching an activity into split, the organizer may also call to finish existing activity in split. We don't want to check the split rule with a finishing activity. Bug: 190433398 Test: test with demo app Change-Id: I7f604ddea7c2f68adc3cee52b8872e653d5dad98
-rw-r--r--core/java/android/app/ActivityClient.java3
-rw-r--r--services/core/java/com/android/server/wm/ActivityClientController.java4
2 files changed, 5 insertions, 2 deletions
diff --git a/core/java/android/app/ActivityClient.java b/core/java/android/app/ActivityClient.java
index 2efdf51612c7..db7ab1a6f379 100644
--- a/core/java/android/app/ActivityClient.java
+++ b/core/java/android/app/ActivityClient.java
@@ -207,7 +207,8 @@ public class ActivityClient {
}
/**
- * Returns the activity token below in the same task if it belongs to the same process.
+ * Returns the non-finishing activity token below in the same task if it belongs to the same
+ * process.
*/
@Nullable
public IBinder getActivityTokenBelow(IBinder activityToken) {
diff --git a/services/core/java/com/android/server/wm/ActivityClientController.java b/services/core/java/com/android/server/wm/ActivityClientController.java
index 043e2dd07087..cc0db1d12e7b 100644
--- a/services/core/java/com/android/server/wm/ActivityClientController.java
+++ b/services/core/java/com/android/server/wm/ActivityClientController.java
@@ -554,7 +554,9 @@ class ActivityClientController extends IActivityClientController.Stub {
if (ar == null) {
return null;
}
- final ActivityRecord below = ar.getTask().getActivityBelow(ar);
+ // Exclude finishing activity.
+ final ActivityRecord below = ar.getTask().getActivity((r) -> !r.finishing,
+ ar, false /*includeBoundary*/, true /*traverseTopToBottom*/);
if (below != null && below.getUid() == ar.getUid()) {
return below.appToken.asBinder();
}