Merge "Fix quick switch in between two split pairs crash" into tm-qpr-dev am: 750009face am: fc155dd5b0 am: 9f70b5b74d
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/21460191 Change-Id: I6a401e4166b1c3c06ef9d0e06cfcd3285f4b04d6 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -877,7 +877,7 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
|
|||||||
if (DesktopTaskView.DESKTOP_MODE_SUPPORTED && targets.hasDesktopTasks()) {
|
if (DesktopTaskView.DESKTOP_MODE_SUPPORTED && targets.hasDesktopTasks()) {
|
||||||
mRemoteTargetHandles = mTargetGluer.assignTargetsForDesktop(targets);
|
mRemoteTargetHandles = mTargetGluer.assignTargetsForDesktop(targets);
|
||||||
} else {
|
} else {
|
||||||
mRemoteTargetHandles = mTargetGluer.assignTargetsForSplitScreen(mContext, targets);
|
mRemoteTargetHandles = mTargetGluer.assignTargetsForSplitScreen(targets);
|
||||||
}
|
}
|
||||||
mRecentsAnimationController = controller;
|
mRecentsAnimationController = controller;
|
||||||
mRecentsAnimationTargets = targets;
|
mRecentsAnimationTargets = targets;
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ public class RemoteTargetGluer {
|
|||||||
* Length of targets.apps should match that of {@link #mRemoteTargetHandles}.
|
* Length of targets.apps should match that of {@link #mRemoteTargetHandles}.
|
||||||
*
|
*
|
||||||
* If split screen may be active when this is called, you might want to use
|
* If split screen may be active when this is called, you might want to use
|
||||||
* {@link #assignTargetsForSplitScreen(Context, RemoteAnimationTargets)}
|
* {@link #assignTargetsForSplitScreen(RemoteAnimationTargets)}
|
||||||
*/
|
*/
|
||||||
public RemoteTargetHandle[] assignTargets(RemoteAnimationTargets targets) {
|
public RemoteTargetHandle[] assignTargets(RemoteAnimationTargets targets) {
|
||||||
for (int i = 0; i < mRemoteTargetHandles.length; i++) {
|
for (int i = 0; i < mRemoteTargetHandles.length; i++) {
|
||||||
@@ -102,43 +102,45 @@ public class RemoteTargetGluer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Similar to {@link #assignTargets(RemoteAnimationTargets)}, except this matches the
|
* Similar to {@link #assignTargets(RemoteAnimationTargets)}, except this assigns the
|
||||||
* apps in targets.apps to that of the _active_ split screened tasks.
|
* apps in {@code targets.apps} to the {@link #mRemoteTargetHandles} with index 0 will being
|
||||||
* See {@link #assignTargetsForSplitScreen(RemoteAnimationTargets, int[])}
|
* the left/top task, index 1 right/bottom.
|
||||||
*/
|
*/
|
||||||
public RemoteTargetHandle[] assignTargetsForSplitScreen(
|
public RemoteTargetHandle[] assignTargetsForSplitScreen(RemoteAnimationTargets targets) {
|
||||||
Context context, RemoteAnimationTargets targets) {
|
|
||||||
int[] splitIds = TopTaskTracker.INSTANCE.get(context).getRunningSplitTaskIds();
|
|
||||||
return assignTargetsForSplitScreen(targets, splitIds);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Assigns the provided splitIDs to the {@link #mRemoteTargetHandles}, with index 0 will being
|
|
||||||
* the left/top task, index 1 right/bottom
|
|
||||||
*/
|
|
||||||
public RemoteTargetHandle[] assignTargetsForSplitScreen(RemoteAnimationTargets targets,
|
|
||||||
int[] splitIds) {
|
|
||||||
RemoteAnimationTarget topLeftTarget; // only one set if single/fullscreen task
|
|
||||||
RemoteAnimationTarget bottomRightTarget;
|
|
||||||
if (mRemoteTargetHandles.length == 1) {
|
if (mRemoteTargetHandles.length == 1) {
|
||||||
// If we're not in split screen, the splitIds count doesn't really matter since we
|
// If we're not in split screen, the splitIds count doesn't really matter since we
|
||||||
// should always hit this case.
|
// should always hit this case.
|
||||||
mRemoteTargetHandles[0].mTransformParams.setTargetSet(targets);
|
mRemoteTargetHandles[0].mTransformParams.setTargetSet(targets);
|
||||||
if (targets.apps.length > 0) {
|
if (targets.apps.length > 0) {
|
||||||
// Unclear why/when target.apps length == 0, but it sure does happen :(
|
// Unclear why/when target.apps length == 0, but it sure does happen :(
|
||||||
topLeftTarget = targets.apps[0];
|
mRemoteTargetHandles[0].mTaskViewSimulator.setPreview(targets.apps[0], null);
|
||||||
mRemoteTargetHandles[0].mTaskViewSimulator.setPreview(topLeftTarget, null);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// split screen
|
RemoteAnimationTarget topLeftTarget = targets.apps[0];
|
||||||
topLeftTarget = targets.findTask(splitIds[0]);
|
|
||||||
bottomRightTarget = targets.findTask(splitIds[1]);
|
// Fetch the adjacent target for split screen.
|
||||||
|
RemoteAnimationTarget bottomRightTarget = null;
|
||||||
|
for (int i = 1; i < targets.apps.length; i++) {
|
||||||
|
final RemoteAnimationTarget target = targets.apps[i];
|
||||||
|
Rect topLeftBounds = getStartBounds(topLeftTarget);
|
||||||
|
Rect bounds = getStartBounds(target);
|
||||||
|
if (topLeftBounds.left > bounds.right || topLeftBounds.top > bounds.bottom) {
|
||||||
|
bottomRightTarget = topLeftTarget;
|
||||||
|
topLeftTarget = target;
|
||||||
|
break;
|
||||||
|
} else if (topLeftBounds.right < bounds.left || topLeftBounds.bottom < bounds.top) {
|
||||||
|
bottomRightTarget = target;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// remoteTargetHandle[0] denotes topLeft task, so we pass in the bottomRight to exclude,
|
// remoteTargetHandle[0] denotes topLeft task, so we pass in the bottomRight to exclude,
|
||||||
// vice versa
|
// vice versa
|
||||||
mSplitBounds = new SplitBounds(
|
mSplitBounds = new SplitBounds(
|
||||||
getStartBounds(topLeftTarget),
|
getStartBounds(topLeftTarget),
|
||||||
getStartBounds(bottomRightTarget), splitIds[0], splitIds[1]);
|
getStartBounds(bottomRightTarget),
|
||||||
|
topLeftTarget.taskId,
|
||||||
|
bottomRightTarget.taskId);
|
||||||
mRemoteTargetHandles[0].mTransformParams.setTargetSet(
|
mRemoteTargetHandles[0].mTransformParams.setTargetSet(
|
||||||
createRemoteAnimationTargetsForTarget(targets, bottomRightTarget));
|
createRemoteAnimationTargetsForTarget(targets, bottomRightTarget));
|
||||||
mRemoteTargetHandles[0].mTaskViewSimulator.setPreview(topLeftTarget,
|
mRemoteTargetHandles[0].mTaskViewSimulator.setPreview(topLeftTarget,
|
||||||
|
|||||||
@@ -190,7 +190,7 @@ public final class TaskViewUtils {
|
|||||||
if (forDesktop) {
|
if (forDesktop) {
|
||||||
remoteTargetHandles = gluer.assignTargetsForDesktop(targets);
|
remoteTargetHandles = gluer.assignTargetsForDesktop(targets);
|
||||||
} else if (v.containsMultipleTasks()) {
|
} else if (v.containsMultipleTasks()) {
|
||||||
remoteTargetHandles = gluer.assignTargetsForSplitScreen(targets, v.getTaskIds());
|
remoteTargetHandles = gluer.assignTargetsForSplitScreen(targets);
|
||||||
} else {
|
} else {
|
||||||
remoteTargetHandles = gluer.assignTargets(targets);
|
remoteTargetHandles = gluer.assignTargets(targets);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5036,8 +5036,7 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
|||||||
mRemoteTargetHandles = gluer.assignTargetsForDesktop(recentsAnimationTargets);
|
mRemoteTargetHandles = gluer.assignTargetsForDesktop(recentsAnimationTargets);
|
||||||
} else {
|
} else {
|
||||||
gluer = new RemoteTargetGluer(getContext(), getSizeStrategy());
|
gluer = new RemoteTargetGluer(getContext(), getSizeStrategy());
|
||||||
mRemoteTargetHandles = gluer.assignTargetsForSplitScreen(
|
mRemoteTargetHandles = gluer.assignTargetsForSplitScreen(recentsAnimationTargets);
|
||||||
getContext(), recentsAnimationTargets);
|
|
||||||
}
|
}
|
||||||
mSplitBoundsConfig = gluer.getSplitBounds();
|
mSplitBoundsConfig = gluer.getSplitBounds();
|
||||||
// Add release check to the targets from the RemoteTargetGluer and not the targets
|
// Add release check to the targets from the RemoteTargetGluer and not the targets
|
||||||
|
|||||||
Reference in New Issue
Block a user