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

Commit 6f31eac8 authored by Ikram Gabiyev's avatar Ikram Gabiyev Committed by Android (Google) Code Review
Browse files

Merge "Auto resize to min size if pip too small" into main

parents 9980edf6 d029e237
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -622,6 +622,8 @@ public class PipBoundsState {
        pw.println(innerPrefix + "mShelfHeight=" + mShelfHeight);
        pw.println(innerPrefix + "mHasUserMovedPip=" + mHasUserMovedPip);
        pw.println(innerPrefix + "mHasUserResizedPip=" + mHasUserResizedPip);
        pw.println(innerPrefix + "mMinSize=" + mMinSize);
        pw.println(innerPrefix + "mMaxSize=" + mMaxSize);
        if (mPipReentryState == null) {
            pw.println(innerPrefix + "mPipReentryState=null");
        } else {
+8 −0
Original line number Diff line number Diff line
@@ -579,6 +579,12 @@ public class PipResizeGestureHandler {
                    resizeRectAboutCenter(mLastResizeBounds, mMaxSize.x, mMaxSize.y);
                }

                // If user resize is smaller than min size, auto resize to min
                if (mLastResizeBounds.width() < mMinSize.x
                        || mLastResizeBounds.height() < mMinSize.y) {
                    resizeRectAboutCenter(mLastResizeBounds, mMinSize.x, mMinSize.y);
                }

                // get the current movement bounds
                final Rect movementBounds = mPipBoundsAlgorithm
                        .getMovementBounds(mLastResizeBounds);
@@ -679,6 +685,8 @@ public class PipResizeGestureHandler {
        pw.println(innerPrefix + "mEnablePinchResize=" + mEnablePinchResize);
        pw.println(innerPrefix + "mThresholdCrossed=" + mThresholdCrossed);
        pw.println(innerPrefix + "mOhmOffset=" + mOhmOffset);
        pw.println(innerPrefix + "mMinSize=" + mMinSize);
        pw.println(innerPrefix + "mMaxSize=" + mMaxSize);
    }

    class PipResizeInputEventReceiver extends BatchedInputEventReceiver {
+16 −3
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package com.android.wm.shell.flicker.pip

import android.platform.test.annotations.Presubmit
import android.tools.common.Rotation
import android.tools.common.flicker.subject.exceptions.IncorrectRegionException
import android.tools.device.flicker.junit.FlickerParametersRunnerFactory
import android.tools.device.flicker.legacy.FlickerBuilder
import android.tools.device.flicker.legacy.LegacyFlickerTest
@@ -40,14 +41,26 @@ class PipPinchInTest(flicker: LegacyFlickerTest) : PipTransition(flicker) {
        transitions { pipApp.pinchInPipWindow(wmHelper, 0.4f, 30) }
    }

    /** Checks that the visible region area of [pipApp] always decreases during the animation. */
    /**
     * Checks that the visible region area of [pipApp] decreases
     * and then increases during the animation.
     */
    @Presubmit
    @Test
    fun pipLayerAreaDecreases() {
    fun pipLayerAreaDecreasesThenIncreases() {
        val isAreaDecreasing = arrayOf(true)
        flicker.assertLayers {
            val pipLayerList = this.layers { pipApp.layerMatchesAnyOf(it) && it.isVisible }
            pipLayerList.zipWithNext { previous, current ->
                if (isAreaDecreasing[0]) {
                    try {
                        current.visibleRegion.notBiggerThan(previous.visibleRegion.region)
                    } catch (e: IncorrectRegionException) {
                        isAreaDecreasing[0] = false
                    }
                } else {
                    previous.visibleRegion.notBiggerThan(current.visibleRegion.region)
                }
            }
        }
    }