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

Commit ce308321 authored by Ikram Gabiyev's avatar Ikram Gabiyev
Browse files

[PiP2] Add start delay to app icon overlay fadeout

Same as in PiP1, if entering PiP with app icon overlay,
PiP2 should also use some start delay to fadeout animation.
This allows the app's redraw to not be visible.

The user can still interact with the PiP window throughout the fadeout,
unlike in PiP1 however; so in PiP2, touch interactions are still allowed
early.

Bug: 397984771
Flag: com.android.wm.shell.enable_pip2
Test: swipe PiP to home with invalid src-rect-hint
Change-Id: I8a4a55ab0c5701c31d3e8b5b9540d9b807091e18
parent 6d2cc8c4
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -50,6 +50,7 @@ import android.graphics.PointF;
import android.graphics.Rect;
import android.os.Bundle;
import android.os.IBinder;
import android.os.SystemProperties;
import android.view.SurfaceControl;
import android.view.WindowManager;
import android.window.TransitionInfo;
@@ -105,7 +106,10 @@ public class PipTransition extends PipTransitionController implements
     * The fixed start delay in ms when fading out the content overlay from bounds animation.
     * The fadeout animation is guaranteed to start after the client has drawn under the new config.
     */
    private static final int CONTENT_OVERLAY_FADE_OUT_DELAY_MS = 500;
    private static final int EXTRA_CONTENT_OVERLAY_FADE_OUT_DELAY_MS =
            SystemProperties.getInt(
                    "persist.wm.debug.extra_content_overlay_fade_out_delay_ms", 400);
    private static final int CONTENT_OVERLAY_FADE_OUT_DURATION_MS = 500;

    //
    // Dependencies
@@ -551,7 +555,8 @@ public class PipTransition extends PipTransitionController implements
            @NonNull Runnable onAnimationEnd) {
        PipAlphaAnimator animator = new PipAlphaAnimator(mContext, overlayLeash,
                null /* startTx */, null /* finishTx */, PipAlphaAnimator.FADE_OUT);
        animator.setDuration(CONTENT_OVERLAY_FADE_OUT_DELAY_MS);
        animator.setDuration(CONTENT_OVERLAY_FADE_OUT_DURATION_MS);
        animator.setStartDelay(EXTRA_CONTENT_OVERLAY_FADE_OUT_DELAY_MS);
        animator.setAnimationEndCallback(onAnimationEnd);
        animator.start();
    }