Merge "getActivityTokenBelow should exclude finishing activity" into sc-v2-dev

This commit is contained in:
Chris Li
2021-08-22 22:08:19 +00:00
committed by Android (Google) Code Review
2 changed files with 5 additions and 2 deletions

View File

@@ -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 @Nullable
public IBinder getActivityTokenBelow(IBinder activityToken) { public IBinder getActivityTokenBelow(IBinder activityToken) {

View File

@@ -554,7 +554,9 @@ class ActivityClientController extends IActivityClientController.Stub {
if (ar == null) { if (ar == null) {
return 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()) { if (below != null && below.getUid() == ar.getUid()) {
return below.appToken.asBinder(); return below.appToken.asBinder();
} }