Merge "Use screen rotation animation only if the display has content"
This commit is contained in:
@@ -1424,7 +1424,7 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
|
||||
mWaitingForConfig = true;
|
||||
if (mTransitionController.isShellTransitionsEnabled()) {
|
||||
requestChangeTransitionIfNeeded(changes, null /* displayChange */);
|
||||
} else {
|
||||
} else if (mLastHasContent) {
|
||||
mWmService.startFreezingDisplay(0 /* exitAnim */, 0 /* enterAnim */, this);
|
||||
}
|
||||
sendNewConfiguration();
|
||||
@@ -3220,6 +3220,7 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
|
||||
*/
|
||||
void requestChangeTransitionIfNeeded(@ActivityInfo.Config int changes,
|
||||
@Nullable TransitionRequestInfo.DisplayChange displayChange) {
|
||||
if (!mLastHasContent) return;
|
||||
final TransitionController controller = mTransitionController;
|
||||
if (controller.isCollecting()) {
|
||||
if (displayChange != null) {
|
||||
@@ -5088,6 +5089,11 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
|
||||
return mLastHasContent;
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
void setLastHasContent() {
|
||||
mLastHasContent = true;
|
||||
}
|
||||
|
||||
void registerPointerEventListener(@NonNull PointerEventListener listener) {
|
||||
mPointerEventDispatcher.registerInputEventListener(listener);
|
||||
}
|
||||
|
||||
@@ -256,7 +256,7 @@ public class FadeRotationAnimationController extends FadeAnimationController {
|
||||
false /* applyFixedTransformationHint */);
|
||||
for (int i = mTargetWindowTokens.size() - 1; i >= 0; i--) {
|
||||
final SurfaceControl leash = mTargetWindowTokens.valueAt(i);
|
||||
if (leash != null) {
|
||||
if (leash != null && leash.isValid()) {
|
||||
rotator.applyTransform(t, leash);
|
||||
}
|
||||
}
|
||||
@@ -265,7 +265,7 @@ public class FadeRotationAnimationController extends FadeAnimationController {
|
||||
// Hide the windows immediately because a screenshot layer should cover the screen.
|
||||
for (int i = mTargetWindowTokens.size() - 1; i >= 0; i--) {
|
||||
final SurfaceControl leash = mTargetWindowTokens.valueAt(i);
|
||||
if (leash != null) {
|
||||
if (leash != null && leash.isValid()) {
|
||||
t.setAlpha(leash, 0f);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1718,6 +1718,7 @@ public class DisplayContentTests extends WindowTestsBase {
|
||||
@Test
|
||||
public void testShellTransitRotation() {
|
||||
DisplayContent dc = createNewDisplay();
|
||||
dc.setLastHasContent();
|
||||
|
||||
final TestTransitionPlayer testPlayer = registerTestTransitionPlayer();
|
||||
final DisplayRotation dr = dc.getDisplayRotation();
|
||||
|
||||
@@ -488,6 +488,7 @@ public class TransitionTests extends WindowTestsBase {
|
||||
final TestTransitionPlayer player = registerTestTransitionPlayer();
|
||||
|
||||
mDisplayContent.getDisplayRotation().setRotation(mDisplayContent.getRotation() + 1);
|
||||
mDisplayContent.setLastHasContent();
|
||||
mDisplayContent.requestChangeTransitionIfNeeded(1 /* any changes */,
|
||||
null /* displayChange */);
|
||||
final FadeRotationAnimationController fadeController =
|
||||
@@ -536,6 +537,7 @@ public class TransitionTests extends WindowTestsBase {
|
||||
null /* remoteTransition */, null /* displayChange */);
|
||||
mDisplayContent.getDisplayRotation().setRotation(mDisplayContent.getRotation() + 1);
|
||||
final int anyChanges = 1;
|
||||
mDisplayContent.setLastHasContent();
|
||||
mDisplayContent.requestChangeTransitionIfNeeded(anyChanges, null /* displayChange */);
|
||||
transition.setKnownConfigChanges(mDisplayContent, anyChanges);
|
||||
final FadeRotationAnimationController fadeController =
|
||||
@@ -550,9 +552,11 @@ public class TransitionTests extends WindowTestsBase {
|
||||
assertTrue(app.getTask().inTransition());
|
||||
|
||||
final SurfaceControl.Transaction startTransaction = mock(SurfaceControl.Transaction.class);
|
||||
final SurfaceControl leash = statusBar.mToken.getAnimationLeash();
|
||||
doReturn(true).when(leash).isValid();
|
||||
player.onTransactionReady(startTransaction);
|
||||
// The leash should be unrotated.
|
||||
verify(startTransaction).setMatrix(eq(statusBar.mToken.getAnimationLeash()), any(), any());
|
||||
verify(startTransaction).setMatrix(eq(leash), any(), any());
|
||||
|
||||
// The redrawn window will be faded in when the transition finishes. And because this test
|
||||
// only use one non-activity window, the fade rotation controller should also be cleared.
|
||||
|
||||
Reference in New Issue
Block a user