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

Commit e2459d14 authored by Wei Sheng Shih's avatar Wei Sheng Shih Committed by Android (Google) Code Review
Browse files

Merge "[PB] Adjust default cross animation for floating window." into main

parents 6089fc60 8be6b1f5
Loading
Loading
Loading
Loading
+22 −0
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import static android.view.Display.DEFAULT_DISPLAY;
import static android.view.WindowInsetsController.APPEARANCE_LIGHT_STATUS_BARS;

import android.annotation.NonNull;
import android.annotation.Nullable;
import android.graphics.Color;
import android.graphics.Rect;
import android.view.SurfaceControl;
@@ -59,6 +60,23 @@ public class BackAnimationBackground {
     */
    public void ensureBackground(Rect startRect, int color,
            @NonNull SurfaceControl.Transaction transaction, int statusbarHeight) {
        ensureBackground(startRect, color, transaction, statusbarHeight,
                null /* cropBounds */, 0 /* cornerRadius */);
    }

    /**
     * Ensures the back animation background color layer is present.
     *
     * @param startRect The start bounds of the closing target.
     * @param color The background color.
     * @param transaction The animation transaction.
     * @param statusbarHeight The height of the statusbar (in px).
     * @param cropBounds The crop bounds of the surface, set to non-empty to show wallpaper.
     * @param cornerRadius The radius of corner, only work when cropBounds is not empty.
     */
    public void ensureBackground(Rect startRect, int color,
            @NonNull SurfaceControl.Transaction transaction, int statusbarHeight,
            @Nullable Rect cropBounds, float cornerRadius) {
        if (mBackgroundSurface != null) {
            return;
        }
@@ -78,6 +96,10 @@ public class BackAnimationBackground {
        transaction.setColor(mBackgroundSurface, colorComponents)
                .setLayer(mBackgroundSurface, BACKGROUND_LAYER)
                .show(mBackgroundSurface);
        if (cropBounds != null && !cropBounds.isEmpty()) {
            transaction.setCrop(mBackgroundSurface, cropBounds)
                    .setCornerRadius(mBackgroundSurface, cornerRadius);
        }
        mStartBounds = startRect;
        mIsRequestingStatusBarAppearance = false;
        mStatusbarHeight = statusbarHeight;
+7 −4
Original line number Diff line number Diff line
@@ -192,7 +192,10 @@ abstract class CrossActivityBackAnimation(
                closingTarget!!.windowConfiguration.bounds,
                getBackgroundColor(),
                transaction,
            statusbarHeight
                statusbarHeight,
                if (closingTarget!!.windowConfiguration.tasksAreFloating())
                    closingTarget!!.localBounds else null,
                cornerRadius
        )
        ensureScrimLayer()
        if (isLetterboxed && enteringHasSameLetterbox) {
+3 −1
Original line number Diff line number Diff line
@@ -283,8 +283,10 @@ class BackNavigationController {
                    // keyguard locked and activities are unable to show when locked.
                    backType = BackNavigationInfo.TYPE_CALLBACK;
                }
            } else if (currentTask.mAtmService.getLockTaskController().isTaskLocked(currentTask)) {
            } else if (currentTask.mAtmService.getLockTaskController().isTaskLocked(currentTask)
                    || currentTask.getWindowConfiguration().tasksAreFloating()) {
                // Do not predict if current task is in task locked.
                // Also, it is unable to play cross task animation for floating task.
                backType = BackNavigationInfo.TYPE_CALLBACK;
            } else {
                // Check back-to-home or cross-task