Merge "Fix PiP rotation when Shell Transition is on." into sc-v2-dev
This commit is contained in:
@@ -27,6 +27,7 @@ import static com.android.wm.shell.pip.PipAnimationController.TRANSITION_DIRECTI
|
|||||||
import static com.android.wm.shell.pip.PipAnimationController.TRANSITION_DIRECTION_LEAVE_PIP;
|
import static com.android.wm.shell.pip.PipAnimationController.TRANSITION_DIRECTION_LEAVE_PIP;
|
||||||
import static com.android.wm.shell.pip.PipAnimationController.TRANSITION_DIRECTION_LEAVE_PIP_TO_SPLIT_SCREEN;
|
import static com.android.wm.shell.pip.PipAnimationController.TRANSITION_DIRECTION_LEAVE_PIP_TO_SPLIT_SCREEN;
|
||||||
import static com.android.wm.shell.pip.PipAnimationController.TRANSITION_DIRECTION_REMOVE_STACK;
|
import static com.android.wm.shell.pip.PipAnimationController.TRANSITION_DIRECTION_REMOVE_STACK;
|
||||||
|
import static com.android.wm.shell.pip.PipAnimationController.TRANSITION_DIRECTION_SAME;
|
||||||
import static com.android.wm.shell.pip.PipAnimationController.TRANSITION_DIRECTION_SNAP_AFTER_RESIZE;
|
import static com.android.wm.shell.pip.PipAnimationController.TRANSITION_DIRECTION_SNAP_AFTER_RESIZE;
|
||||||
import static com.android.wm.shell.pip.PipAnimationController.TRANSITION_DIRECTION_TO_PIP;
|
import static com.android.wm.shell.pip.PipAnimationController.TRANSITION_DIRECTION_TO_PIP;
|
||||||
import static com.android.wm.shell.pip.PipAnimationController.TRANSITION_DIRECTION_USER_RESIZE;
|
import static com.android.wm.shell.pip.PipAnimationController.TRANSITION_DIRECTION_USER_RESIZE;
|
||||||
@@ -84,6 +85,7 @@ import com.android.wm.shell.pip.PipSnapAlgorithm;
|
|||||||
import com.android.wm.shell.pip.PipTaskOrganizer;
|
import com.android.wm.shell.pip.PipTaskOrganizer;
|
||||||
import com.android.wm.shell.pip.PipTransitionController;
|
import com.android.wm.shell.pip.PipTransitionController;
|
||||||
import com.android.wm.shell.pip.PipUtils;
|
import com.android.wm.shell.pip.PipUtils;
|
||||||
|
import com.android.wm.shell.transition.Transitions;
|
||||||
|
|
||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
@@ -455,11 +457,18 @@ public class PipController implements PipTransitionController.PipTransitionCallb
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Runnable updateDisplayLayout = () -> {
|
Runnable updateDisplayLayout = () -> {
|
||||||
|
final boolean fromRotation = Transitions.ENABLE_SHELL_TRANSITIONS
|
||||||
|
&& mPipBoundsState.getDisplayLayout().rotation() != layout.rotation();
|
||||||
mPipBoundsState.setDisplayLayout(layout);
|
mPipBoundsState.setDisplayLayout(layout);
|
||||||
|
final WindowContainerTransaction wct =
|
||||||
|
fromRotation ? new WindowContainerTransaction() : null;
|
||||||
updateMovementBounds(null /* toBounds */,
|
updateMovementBounds(null /* toBounds */,
|
||||||
false /* fromRotation */, false /* fromImeAdjustment */,
|
fromRotation, false /* fromImeAdjustment */,
|
||||||
false /* fromShelfAdjustment */,
|
false /* fromShelfAdjustment */,
|
||||||
null /* windowContainerTransaction */);
|
wct /* windowContainerTransaction */);
|
||||||
|
if (wct != null) {
|
||||||
|
mPipTaskOrganizer.applyFinishBoundsResize(wct, TRANSITION_DIRECTION_SAME);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if (mPipTaskOrganizer.isInPip() && saveRestoreSnapFraction) {
|
if (mPipTaskOrganizer.isInPip() && saveRestoreSnapFraction) {
|
||||||
|
|||||||
@@ -32,6 +32,8 @@ import com.android.server.wm.flicker.helpers.setRotation
|
|||||||
import com.android.server.wm.flicker.navBarLayerRotatesAndScales
|
import com.android.server.wm.flicker.navBarLayerRotatesAndScales
|
||||||
import com.android.server.wm.flicker.startRotation
|
import com.android.server.wm.flicker.startRotation
|
||||||
import com.android.server.wm.flicker.statusBarLayerRotatesScales
|
import com.android.server.wm.flicker.statusBarLayerRotatesScales
|
||||||
|
import com.android.server.wm.traces.common.Region
|
||||||
|
import com.android.server.wm.traces.parser.minus
|
||||||
import com.android.wm.shell.flicker.helpers.FixedAppHelper
|
import com.android.wm.shell.flicker.helpers.FixedAppHelper
|
||||||
import org.junit.FixMethodOrder
|
import org.junit.FixMethodOrder
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
@@ -94,7 +96,10 @@ class PipRotationTest(testSpec: FlickerTestParameter) : PipTransition(testSpec)
|
|||||||
@Test
|
@Test
|
||||||
fun appLayerRotates_StartingBounds() {
|
fun appLayerRotates_StartingBounds() {
|
||||||
testSpec.assertLayersStart {
|
testSpec.assertLayersStart {
|
||||||
visibleRegion(fixedApp.component).coversExactly(startingBounds)
|
val pipRegion = visibleRegion(pipApp.component).region
|
||||||
|
val expectedWithoutPip = Region(startingBounds.bounds.left, startingBounds.bounds.top,
|
||||||
|
startingBounds.bounds.right, startingBounds.bounds.bottom).minus(pipRegion)
|
||||||
|
visibleRegion(fixedApp.component).coversExactly(expectedWithoutPip)
|
||||||
visibleRegion(pipApp.component).coversAtMost(startingBounds)
|
visibleRegion(pipApp.component).coversAtMost(startingBounds)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -103,7 +108,10 @@ class PipRotationTest(testSpec: FlickerTestParameter) : PipTransition(testSpec)
|
|||||||
@Test
|
@Test
|
||||||
fun appLayerRotates_EndingBounds() {
|
fun appLayerRotates_EndingBounds() {
|
||||||
testSpec.assertLayersEnd {
|
testSpec.assertLayersEnd {
|
||||||
visibleRegion(fixedApp.component).coversExactly(endingBounds)
|
val pipRegion = visibleRegion(pipApp.component).region
|
||||||
|
val expectedWithoutPip = Region(endingBounds.bounds.left, endingBounds.bounds.top,
|
||||||
|
endingBounds.bounds.right, endingBounds.bounds.bottom).minus(pipRegion)
|
||||||
|
visibleRegion(fixedApp.component).coversExactly(expectedWithoutPip)
|
||||||
visibleRegion(pipApp.component).coversAtMost(endingBounds)
|
visibleRegion(pipApp.component).coversAtMost(endingBounds)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user