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

Commit 0fa7c11a authored by Winson Chung's avatar Winson Chung Committed by Automerger Merge Worker
Browse files

Merge "Skip animating out bubble screenshot if surface is not ready" into...

Merge "Skip animating out bubble screenshot if surface is not ready" into sc-dev am: d4dd12ee am: 36fe682d

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15352585

Change-Id: I4714f9a7dfa777251b3f73bd3f3ccbf6cda5f91f
parents 3ee2820e 36fe682d
Loading
Loading
Loading
Loading
+17 −1
Original line number Diff line number Diff line
@@ -45,6 +45,7 @@ import android.view.Choreographer;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.SurfaceControl;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
import android.view.View;
import android.view.ViewGroup;
@@ -205,6 +206,7 @@ public class BubbleStackView extends FrameLayout
     * between bubble activities without needing both to be alive at the same time.
     */
    private SurfaceView mAnimatingOutSurfaceView;
    private boolean mAnimatingOutSurfaceReady;

    /** Container for the animating-out SurfaceView. */
    private FrameLayout mAnimatingOutSurfaceContainer;
@@ -808,6 +810,20 @@ public class BubbleStackView extends FrameLayout
        mAnimatingOutSurfaceView.setZOrderOnTop(true);
        mAnimatingOutSurfaceView.setCornerRadius(mCornerRadius);
        mAnimatingOutSurfaceView.setLayoutParams(new ViewGroup.LayoutParams(0, 0));
        mAnimatingOutSurfaceView.getHolder().addCallback(new SurfaceHolder.Callback() {
            @Override
            public void surfaceChanged(SurfaceHolder surfaceHolder, int i, int i1, int i2) {}

            @Override
            public void surfaceCreated(SurfaceHolder surfaceHolder) {
                mAnimatingOutSurfaceReady = true;
            }

            @Override
            public void surfaceDestroyed(SurfaceHolder surfaceHolder) {
                mAnimatingOutSurfaceReady = false;
            }
        });
        mAnimatingOutSurfaceContainer.addView(mAnimatingOutSurfaceView);

        mAnimatingOutSurfaceContainer.setPadding(
@@ -2652,7 +2668,7 @@ public class BubbleStackView extends FrameLayout
                return;
            }

            if (!mIsExpanded) {
            if (!mIsExpanded || !mAnimatingOutSurfaceReady) {
                onComplete.accept(false);
                return;
            }