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

Commit 7a5c0312 authored by Riddle Hsu's avatar Riddle Hsu
Browse files

Delay visible of rotation enter animation

At the beginning of rotation animation, because the screenshot is
almost opaque, it doesn't need to draw all real surfaces at the
same time.

Bug: 439946818
Flag: com.android.window.flags.no_alpha_rotation_enter_animation
Test: ftrace_events: "gpu_mem/gpu_mem_total"
Change-Id: I1c8f8a73a2b6b8893405e6a9864e95fce87e6b46
parent e58b13fc
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -419,7 +419,6 @@ class ScreenRotationAnimation {

    private void postProcessRotationAnimation(@NonNull AnimationSet enterAnim,
            @NonNull AnimationSet exitAnim, int rotationDelta) {
        int alphaAnimIndex = -1;
        long enterClipDuration = 0;
        long enterClipStartOffset = 0;
        final var enterAnimations = enterAnim.getAnimations();
@@ -429,14 +428,15 @@ class ScreenRotationAnimation {
                // Use half duration to avoid showing blank area too long.
                enterClipDuration = anim.getDuration() / 2;
                enterClipStartOffset = anim.getStartOffset() / 2;
                alphaAnimIndex = i;
                // TODO(b/438615184): Update screen_rotate_*_enter.xml.
                // Use an instant alpha animation to delay the enter surface from being visible
                // when it is almost occluded by the exit surface. That may reduce some cost of
                // layer composition.
                anim.setDuration(10);
                anim.setStartOffset(enterClipStartOffset);
                break;
            }
        }
        // TODO(b/438615184): Remove alpha animation from screen_rotate_*_enter.xml.
        if (alphaAnimIndex >= 0) {
            enterAnimations.remove(alphaAnimIndex);
        }
        if (rotationDelta % 2 == 0) {
            // 180 degree delta doesn't have size change, so no additional effects are needed.
            return;