mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-01 08:16:49 +00:00
Apply localBounds / screenSpaceBounds for RemoteAnimationTarget in Launcher
This is to fix in Hierarchical animation (i.e. the animation will
reparent to parent container's surface control rather then a fixed
fullscreen animation layer),
TaskView surface in overview screen the position will be shifted
when entering split-screen mode.
Test: manual as follow steps:
- Launching app from launcher to split-screen secondary stack
- Swipe up to overview screen and drag TaskView to see if the TaskView
surface is shfted, expected is not.
Bug: 148780840
Change-Id: Ia7e9c2649ae3e35747859c211a4299198c16db00
This commit is contained in:
@@ -49,6 +49,7 @@ import android.content.Context;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Matrix;
|
||||
import android.graphics.Point;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.RectF;
|
||||
import android.graphics.drawable.Drawable;
|
||||
@@ -299,8 +300,12 @@ public abstract class QuickstepAppTransitionManagerImpl extends LauncherAppTrans
|
||||
if (mLauncher.isInMultiWindowMode()) {
|
||||
for (RemoteAnimationTargetCompat target : appTargets) {
|
||||
if (target.mode == MODE_OPENING) {
|
||||
bounds.set(target.sourceContainerBounds);
|
||||
bounds.offsetTo(target.position.x, target.position.y);
|
||||
bounds.set(target.screenSpaceBounds);
|
||||
if (target.localBounds != null) {
|
||||
bounds.set(target.localBounds);
|
||||
} else {
|
||||
bounds.offsetTo(target.position.x, target.position.y);
|
||||
}
|
||||
return bounds;
|
||||
}
|
||||
}
|
||||
@@ -460,6 +465,7 @@ public abstract class QuickstepAppTransitionManagerImpl extends LauncherAppTrans
|
||||
RectF targetBounds = new RectF(windowTargetBounds);
|
||||
RectF currentBounds = new RectF();
|
||||
RectF temp = new RectF();
|
||||
Point tmpPos = new Point();
|
||||
|
||||
AnimatorSet animatorSet = new AnimatorSet();
|
||||
ValueAnimator appAnimator = ValueAnimator.ofFloat(0, 1);
|
||||
@@ -547,6 +553,13 @@ public abstract class QuickstepAppTransitionManagerImpl extends LauncherAppTrans
|
||||
for (int i = appTargets.length - 1; i >= 0; i--) {
|
||||
RemoteAnimationTargetCompat target = appTargets[i];
|
||||
SurfaceParams.Builder builder = new SurfaceParams.Builder(target.leash);
|
||||
|
||||
tmpPos.set(target.position.x, target.position.y);
|
||||
if (target.localBounds != null) {
|
||||
final Rect localBounds = target.localBounds;
|
||||
tmpPos.set(target.localBounds.left, target.localBounds.top);
|
||||
}
|
||||
|
||||
if (target.mode == MODE_OPENING) {
|
||||
matrix.setScale(scale, scale);
|
||||
matrix.postTranslate(transX0, transY0);
|
||||
@@ -563,9 +576,9 @@ public abstract class QuickstepAppTransitionManagerImpl extends LauncherAppTrans
|
||||
.withAlpha(1f - mIconAlpha.value)
|
||||
.withCornerRadius(mWindowRadius.value);
|
||||
} else {
|
||||
matrix.setTranslate(target.position.x, target.position.y);
|
||||
matrix.setTranslate(tmpPos.x, tmpPos.y);
|
||||
builder.withMatrix(matrix)
|
||||
.withWindowCrop(target.sourceContainerBounds)
|
||||
.withWindowCrop(target.screenSpaceBounds)
|
||||
.withAlpha(1f);
|
||||
}
|
||||
builder.withLayer(RemoteAnimationProvider.getLayer(target, MODE_OPENING));
|
||||
@@ -662,7 +675,7 @@ public abstract class QuickstepAppTransitionManagerImpl extends LauncherAppTrans
|
||||
RemoteAnimationTargetCompat target = appTargets[i];
|
||||
params[i] = new SurfaceParams.Builder(target.leash)
|
||||
.withAlpha(1f)
|
||||
.withWindowCrop(target.sourceContainerBounds)
|
||||
.withWindowCrop(target.screenSpaceBounds)
|
||||
.withLayer(RemoteAnimationProvider.getLayer(target, MODE_OPENING))
|
||||
.withCornerRadius(cornerRadius)
|
||||
.build();
|
||||
@@ -681,6 +694,7 @@ public abstract class QuickstepAppTransitionManagerImpl extends LauncherAppTrans
|
||||
SyncRtSurfaceTransactionApplierCompat surfaceApplier =
|
||||
new SyncRtSurfaceTransactionApplierCompat(mDragLayer);
|
||||
Matrix matrix = new Matrix();
|
||||
Point tmpPos = new Point();
|
||||
ValueAnimator closingAnimator = ValueAnimator.ofFloat(0, 1);
|
||||
int duration = CLOSING_TRANSITION_DURATION_MS;
|
||||
float windowCornerRadius = mDeviceProfile.isMultiWindowMode
|
||||
@@ -697,22 +711,28 @@ public abstract class QuickstepAppTransitionManagerImpl extends LauncherAppTrans
|
||||
for (int i = appTargets.length - 1; i >= 0; i--) {
|
||||
RemoteAnimationTargetCompat target = appTargets[i];
|
||||
SurfaceParams.Builder builder = new SurfaceParams.Builder(target.leash);
|
||||
|
||||
tmpPos.set(target.position.x, target.position.y);
|
||||
if (target.localBounds != null) {
|
||||
tmpPos.set(target.localBounds.left, target.localBounds.top);
|
||||
}
|
||||
|
||||
if (target.mode == MODE_CLOSING) {
|
||||
matrix.setScale(mScale.value, mScale.value,
|
||||
target.sourceContainerBounds.centerX(),
|
||||
target.sourceContainerBounds.centerY());
|
||||
target.screenSpaceBounds.centerX(),
|
||||
target.screenSpaceBounds.centerY());
|
||||
matrix.postTranslate(0, mDy.value);
|
||||
matrix.postTranslate(target.position.x, target.position.y);
|
||||
matrix.postTranslate(tmpPos.x, tmpPos.y);
|
||||
builder.withMatrix(matrix)
|
||||
.withAlpha(mAlpha.value)
|
||||
.withCornerRadius(windowCornerRadius);
|
||||
} else {
|
||||
matrix.setTranslate(target.position.x, target.position.y);
|
||||
matrix.setTranslate(tmpPos.x, tmpPos.y);
|
||||
builder.withMatrix(matrix)
|
||||
.withAlpha(1f);
|
||||
}
|
||||
params[i] = builder
|
||||
.withWindowCrop(target.sourceContainerBounds)
|
||||
.withWindowCrop(target.screenSpaceBounds)
|
||||
.withLayer(RemoteAnimationProvider.getLayer(target, MODE_CLOSING))
|
||||
.build();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user