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

Commit a0893157 authored by Hongwei Wang's avatar Hongwei Wang Committed by Android (Google) Code Review
Browse files

Merge "Add debugging information on PiP content overlay" into 24D1-dev

parents 098c477a cdb9690a
Loading
Loading
Loading
Loading
+13 −9
Original line number Diff line number Diff line
@@ -112,7 +112,7 @@ public class SwipePipToHomeAnimator extends RectFSpringAnim {
            @NonNull ActivityInfo activityInfo,
            int appIconSizePx,
            @NonNull SurfaceControl leash,
            @Nullable Rect sourceRectHint,
            @NonNull Rect sourceRectHint,
            @NonNull Rect appBounds,
            @NonNull Matrix homeToWindowPositionMap,
            @NonNull RectF startBounds,
@@ -135,22 +135,25 @@ public class SwipePipToHomeAnimator extends RectFSpringAnim {
        mDestinationBoundsTransformed.set(destinationBoundsTransformed);
        mSurfaceTransactionHelper = new PipSurfaceTransactionHelper(cornerRadius, shadowRadius);

        if (sourceRectHint != null && (sourceRectHint.width() < destinationBounds.width()
                || sourceRectHint.height() < destinationBounds.height())) {
        String reasonForCreateOverlay = null; // For debugging purpose.
        if (sourceRectHint.isEmpty()) {
            reasonForCreateOverlay = "Source rect hint is empty";
        } else if (sourceRectHint.width() < destinationBounds.width()
                || sourceRectHint.height() < destinationBounds.height()) {
            // This is a situation in which the source hint rect on at least one axis is smaller
            // than the destination bounds, which presents a problem because we would have to scale
            // up that axis to fit the bounds. So instead, just fallback to the non-source hint
            // animation in this case.
            sourceRectHint = null;
        }

        if (sourceRectHint != null && !appBounds.contains(sourceRectHint)) {
            reasonForCreateOverlay = "Source rect hint is too small " + sourceRectHint;
            sourceRectHint.setEmpty();
        } else if (!appBounds.contains(sourceRectHint)) {
            // This is a situation in which the source hint rect is outside the app bounds, so it is
            // not a valid rectangle to use for cropping app surface
            sourceRectHint = null;
            sourceRectHint.setEmpty();
            reasonForCreateOverlay = "Source rect hint exceeds display bounds " + sourceRectHint;
        }

        if (sourceRectHint == null) {
        if (sourceRectHint.isEmpty()) {
            mSourceRectHint.setEmpty();
            mSourceHintRectInsets = null;

@@ -162,6 +165,7 @@ public class SwipePipToHomeAnimator extends RectFSpringAnim {
                    new IconProvider(context).getIcon(mActivityInfo), appIconSizePx);
            final SurfaceControl.Transaction tx = new SurfaceControl.Transaction();
            mPipContentOverlay.attach(tx, mLeash);
            Log.d(TAG, getContentOverlay() + " is created: " + reasonForCreateOverlay);
        } else {
            mSourceRectHint.set(sourceRectHint);
            mSourceHintRectInsets = new Rect(sourceRectHint.left - appBounds.left,