Merge "Resize mRemoteTargetHandles when RecentsAnimationStarts" into udc-dev

This commit is contained in:
Vinit Nayak
2023-05-30 22:10:28 +00:00
committed by Android (Google) Code Review
3 changed files with 45 additions and 3 deletions
@@ -147,6 +147,7 @@ import com.android.wm.shell.startingsurface.SplashScreenExitAnimationUtils;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Objects;
import java.util.Optional;
import java.util.function.Consumer;
@@ -662,6 +663,14 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
} else {
runningTasks = mGestureState.getRunningTask().getPlaceholderTasks();
}
// Safeguard against any null tasks being sent to recents view, happens when quickswitching
// very quickly w/ split tasks because TopTaskTracker provides stale information compared to
// actual running tasks in the recents animation.
// TODO(b/236226779), Proper fix (ag/22237143)
if (Arrays.stream(runningTasks).anyMatch(Objects::isNull)) {
return;
}
mRecentsView.onGestureAnimationStart(runningTasks, mDeviceState.getRotationTouchHelper());
}
@@ -915,7 +924,12 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
if (DesktopTaskView.DESKTOP_MODE_SUPPORTED && targets.hasDesktopTasks()) {
mRemoteTargetHandles = mTargetGluer.assignTargetsForDesktop(targets);
} else {
int untrimmedAppCount = mRemoteTargetHandles.length;
mRemoteTargetHandles = mTargetGluer.assignTargetsForSplitScreen(targets);
if (mRemoteTargetHandles.length < untrimmedAppCount && mIsSwipeForSplit) {
updateIsGestureForSplit(mRemoteTargetHandles.length);
setupRecentsViewUi();
}
}
mRecentsAnimationController = controller;
mRecentsAnimationTargets = targets;