Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9aa000e4 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Apply localBounds / screenSpaceBounds for RemoteAnimationTarget in...

Merge "Apply localBounds / screenSpaceBounds for RemoteAnimationTarget in Launcher" into ub-launcher3-master
parents 29082d89 7d861dd1
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -213,7 +213,7 @@ public final class FallbackActivityInterface implements
    @Override
    public Rect getOverviewWindowBounds(Rect homeBounds, RemoteAnimationTargetCompat target) {
        // TODO: Remove this once b/77875376 is fixed
        return target.sourceContainerBounds;
        return target.screenSpaceBounds;
    }

    @Override
+17 −4
Original line number Diff line number Diff line
@@ -50,6 +50,7 @@ import com.android.systemui.shared.system.WindowManagerWrapper;
import static com.android.launcher3.config.FeatureFlags.ENABLE_QUICKSTEP_LIVE_TILE;
import static com.android.systemui.shared.system.QuickStepContract.getWindowCornerRadius;
import static com.android.systemui.shared.system.QuickStepContract.supportsRoundedCornersOnWindows;
import static com.android.systemui.shared.system.RemoteAnimationTargetCompat.ACTIVITY_TYPE_HOME;
import static com.android.systemui.shared.system.RemoteAnimationTargetCompat.MODE_CLOSING;
import static com.android.systemui.shared.system.RemoteAnimationTargetCompat.MODE_OPENING;

@@ -119,7 +120,7 @@ public class AppWindowAnimationHelper {

    private void updateSourceStack(RemoteAnimationTargetCompat target) {
        mSourceInsets.set(target.contentInsets);
        mSourceStackBounds.set(target.sourceContainerBounds);
        mSourceStackBounds.set(target.screenSpaceBounds);

        // TODO: Should sourceContainerBounds already have this offset?
        mSourceStackBounds.offsetTo(target.position.x, target.position.y);
@@ -199,9 +200,17 @@ public class AppWindowAnimationHelper {
        for (int i = 0; i < params.mTargetSet.unfilteredApps.length; i++) {
            RemoteAnimationTargetCompat app = params.mTargetSet.unfilteredApps[i];
            SurfaceParams.Builder builder = new SurfaceParams.Builder(app.leash);
            if (app.localBounds != null) {
                mTmpMatrix.setTranslate(0, 0);
                if (app.activityType == ACTIVITY_TYPE_HOME && app.mode == MODE_CLOSING) {
                    mTmpMatrix.setTranslate(app.localBounds.left, app.localBounds.top);
                }
            } else {
                mTmpMatrix.setTranslate(app.position.x, app.position.y);
            }

            Rect crop = mTmpRect;
            crop.set(app.sourceContainerBounds);
            crop.set(app.screenSpaceBounds);
            crop.offsetTo(0, 0);
            float alpha;
            float cornerRadius = 0f;
@@ -211,7 +220,11 @@ public class AppWindowAnimationHelper {
                alpha = mTaskAlphaCallback.getAlpha(app, params.mTargetAlpha);
                if (app.activityType != RemoteAnimationTargetCompat.ACTIVITY_TYPE_HOME) {
                    mTmpMatrix.setRectToRect(mSourceRect, mCurrentRect, ScaleToFit.FILL);
                    if (app.localBounds != null) {
                        mTmpMatrix.postTranslate(app.localBounds.left, app.localBounds.top);
                    } else {
                        mTmpMatrix.postTranslate(app.position.x, app.position.y);
                    }
                    mCurrentClipRectF.roundOut(crop);
                    if (mSupportsRoundedCornersOnWindows) {
                        if (params.mCornerRadius > -1) {
+30 −10
Original line number Diff line number Diff line
@@ -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.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();
                }