Merge "Keep fixed rotation transformed surface position for animation leash" into rvc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
81af900456
@@ -2304,14 +2304,18 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer<
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void resetSurfacePositionForAnimationLeash(Transaction t) {
|
||||||
|
t.setPosition(mSurfaceControl, 0, 0);
|
||||||
|
mLastSurfacePosition.set(0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onAnimationLeashCreated(Transaction t, SurfaceControl leash) {
|
public void onAnimationLeashCreated(Transaction t, SurfaceControl leash) {
|
||||||
mLastLayer = -1;
|
mLastLayer = -1;
|
||||||
reassignLayer(t);
|
reassignLayer(t);
|
||||||
|
|
||||||
// Leash is now responsible for position, so set our position to 0.
|
// Leash is now responsible for position, so set our position to 0.
|
||||||
t.setPosition(mSurfaceControl, 0, 0);
|
resetSurfacePositionForAnimationLeash(t);
|
||||||
mLastSurfacePosition.set(0, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -5249,16 +5249,6 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
|
|||||||
super.prepareSurfaces();
|
super.prepareSurfaces();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onAnimationLeashCreated(Transaction t, SurfaceControl leash) {
|
|
||||||
super.onAnimationLeashCreated(t, leash);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onAnimationLeashLost(Transaction t) {
|
|
||||||
super.onAnimationLeashLost(t);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
void updateSurfacePosition(Transaction t) {
|
void updateSurfacePosition(Transaction t) {
|
||||||
|
|||||||
@@ -632,6 +632,15 @@ class WindowToken extends WindowContainer<WindowState> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
void resetSurfacePositionForAnimationLeash(SurfaceControl.Transaction t) {
|
||||||
|
// Keep the transformed position to animate because the surface will show in different
|
||||||
|
// rotation than the animator of leash.
|
||||||
|
if (!isFixedRotationTransforming()) {
|
||||||
|
super.resetSurfacePositionForAnimationLeash(t);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gives a chance to this {@link WindowToken} to adjust the {@link
|
* Gives a chance to this {@link WindowToken} to adjust the {@link
|
||||||
* android.view.WindowManager.LayoutParams} of its windows.
|
* android.view.WindowManager.LayoutParams} of its windows.
|
||||||
|
|||||||
@@ -1324,7 +1324,7 @@ public class ActivityRecordTests extends ActivityTestsBase {
|
|||||||
|
|
||||||
display.rotateInDifferentOrientationIfNeeded(mActivity);
|
display.rotateInDifferentOrientationIfNeeded(mActivity);
|
||||||
display.mFixedRotationLaunchingApp = mActivity;
|
display.mFixedRotationLaunchingApp = mActivity;
|
||||||
displayRotation.updateRotationUnchecked(false /* forceUpdate */);
|
displayRotation.updateRotationUnchecked(true /* forceUpdate */);
|
||||||
|
|
||||||
assertTrue(displayRotation.isRotatingSeamlessly());
|
assertTrue(displayRotation.isRotatingSeamlessly());
|
||||||
|
|
||||||
|
|||||||
@@ -90,6 +90,7 @@ import android.view.ISystemGestureExclusionListener;
|
|||||||
import android.view.IWindowManager;
|
import android.view.IWindowManager;
|
||||||
import android.view.MotionEvent;
|
import android.view.MotionEvent;
|
||||||
import android.view.Surface;
|
import android.view.Surface;
|
||||||
|
import android.view.SurfaceControl.Transaction;
|
||||||
import android.view.ViewRootImpl;
|
import android.view.ViewRootImpl;
|
||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
import android.view.test.InsetsModeSession;
|
import android.view.test.InsetsModeSession;
|
||||||
@@ -1040,6 +1041,12 @@ public class DisplayContentTests extends WindowTestsBase {
|
|||||||
assertEquals(config90.orientation, app.getConfiguration().orientation);
|
assertEquals(config90.orientation, app.getConfiguration().orientation);
|
||||||
assertEquals(config90.windowConfiguration.getBounds(), app.getBounds());
|
assertEquals(config90.windowConfiguration.getBounds(), app.getBounds());
|
||||||
|
|
||||||
|
// Make wallaper laid out with the fixed rotation transform.
|
||||||
|
final WindowToken wallpaperToken = mWallpaperWindow.mToken;
|
||||||
|
wallpaperToken.linkFixedRotationTransform(app);
|
||||||
|
mWallpaperWindow.mLayoutNeeded = true;
|
||||||
|
performLayout(mDisplayContent);
|
||||||
|
|
||||||
// Force the negative offset to verify it can be updated.
|
// Force the negative offset to verify it can be updated.
|
||||||
mWallpaperWindow.mWinAnimator.mXOffset = mWallpaperWindow.mWinAnimator.mYOffset = -1;
|
mWallpaperWindow.mWinAnimator.mXOffset = mWallpaperWindow.mWinAnimator.mYOffset = -1;
|
||||||
assertTrue(mDisplayContent.mWallpaperController.updateWallpaperOffset(mWallpaperWindow,
|
assertTrue(mDisplayContent.mWallpaperController.updateWallpaperOffset(mWallpaperWindow,
|
||||||
@@ -1047,6 +1054,13 @@ public class DisplayContentTests extends WindowTestsBase {
|
|||||||
assertThat(mWallpaperWindow.mWinAnimator.mXOffset).isGreaterThan(-1);
|
assertThat(mWallpaperWindow.mWinAnimator.mXOffset).isGreaterThan(-1);
|
||||||
assertThat(mWallpaperWindow.mWinAnimator.mYOffset).isGreaterThan(-1);
|
assertThat(mWallpaperWindow.mWinAnimator.mYOffset).isGreaterThan(-1);
|
||||||
|
|
||||||
|
// The wallpaper need to animate with transformed position, so its surface position should
|
||||||
|
// not be reset.
|
||||||
|
final Transaction t = wallpaperToken.getPendingTransaction();
|
||||||
|
spyOn(t);
|
||||||
|
mWallpaperWindow.mToken.onAnimationLeashCreated(t, null /* leash */);
|
||||||
|
verify(t, never()).setPosition(any(), eq(0), eq(0));
|
||||||
|
|
||||||
mDisplayContent.mAppTransition.notifyAppTransitionFinishedLocked(app.token);
|
mDisplayContent.mAppTransition.notifyAppTransitionFinishedLocked(app.token);
|
||||||
|
|
||||||
// The animation in old rotation should be cancelled.
|
// The animation in old rotation should be cancelled.
|
||||||
|
|||||||
Reference in New Issue
Block a user