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

Commit cdb9690a authored by Hongwei Wang's avatar Hongwei Wang
Browse files

Add debugging information on PiP content overlay

Added the reason for creating the overlay. Updated
SwipePipToHomeAnimator constructor also due to the fact the source rect
hint from Builder class is never empty.

Bug: 330488822
Test: manually, follow the reproduce path
Flag: NA
Change-Id: Id98ce799d7c96fff3279c0df0fa49084a49d563a
parent 58a01874
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,