Pinned stack animation: Fix inset logic.
When animating to the fullscreen size, we need to immediately report insets as if we were fullscreen so that the app will draw its content in the appropriate aspect ratio depending on whether or not it plans to paint behind the insets. Two things were preventing this, first the pinned stack is skipped for temp task inset calculation, and second we were passing null as the temp inset bounds. Bug: 35396882 Test: Move skeleton pinned app to fullscreen. Verify no aspect jump at end. Change-Id: I670fe9423fbde45d55b95801c6dcbad97b0280d1
This commit is contained in:
@@ -2394,7 +2394,18 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D
|
||||
mWindowManager.deferSurfaceLayout();
|
||||
try {
|
||||
ActivityRecord r = stack.topRunningActivityLocked();
|
||||
stack.resize(pinnedBounds, tempPinnedTaskBounds, null);
|
||||
Rect insetBounds = null;
|
||||
if (tempPinnedTaskBounds != null) {
|
||||
// We always use 0,0 as the position for the inset rect because
|
||||
// if we are getting insets at all in the pinned stack it must mean
|
||||
// we are headed for fullscreen.
|
||||
insetBounds = tempRect;
|
||||
insetBounds.top = 0;
|
||||
insetBounds.left = 0;
|
||||
insetBounds.right = tempPinnedTaskBounds.width();
|
||||
insetBounds.bottom = tempPinnedTaskBounds.height();
|
||||
}
|
||||
stack.resize(pinnedBounds, tempPinnedTaskBounds, insetBounds);
|
||||
stack.ensureVisibleActivitiesConfigurationLocked(r, false);
|
||||
} finally {
|
||||
mWindowManager.continueSurfaceLayout();
|
||||
|
||||
@@ -176,7 +176,7 @@ public class BoundsAnimationController {
|
||||
// we trigger any size changes, so it can swap surfaces
|
||||
// in to appropriate modes, or do as it wishes otherwise.
|
||||
if (!mReplacement) {
|
||||
mTarget.onAnimationStart();
|
||||
mTarget.onAnimationStart(mMoveToFullScreen);
|
||||
}
|
||||
|
||||
// Immediately update the task bounds if they have to become larger, but preserve
|
||||
@@ -263,7 +263,7 @@ public class BoundsAnimationController {
|
||||
*/
|
||||
boolean setPinnedStackSize(Rect bounds, Rect taskBounds);
|
||||
|
||||
void onAnimationStart();
|
||||
void onAnimationStart(boolean toFullscreen);
|
||||
|
||||
/**
|
||||
* Callback for the target to inform it that the animation has ended, so it can do some
|
||||
|
||||
@@ -592,8 +592,15 @@ class Task extends WindowContainer<AppWindowToken> implements DimLayer.DimLayerU
|
||||
return mStack != null && mStack.mStackId == PINNED_STACK_ID;
|
||||
}
|
||||
|
||||
/**
|
||||
* When we are in a floating stack (Freeform, Pinned, ...) we calculate
|
||||
* insets differently. However if we are animating to the fullscreen stack
|
||||
* we need to begin calculating insets as if we were fullscreen, otherwise
|
||||
* we will have a jump at the end.
|
||||
*/
|
||||
boolean isFloating() {
|
||||
return StackId.tasksAreFloating(mStack.mStackId);
|
||||
return StackId.tasksAreFloating(mStack.mStackId)
|
||||
&& !mStack.isBoundsAnimatingToFullscreen();
|
||||
}
|
||||
|
||||
WindowState getTopVisibleAppMainWindow() {
|
||||
|
||||
@@ -125,6 +125,7 @@ public class TaskStack extends WindowContainer<Task> implements DimLayer.DimLaye
|
||||
// perfectly fit the region it would have been cropped to. We may also avoid certain logic we
|
||||
// would otherwise apply while resizing, while resizing in the bounds animating mode.
|
||||
private boolean mBoundsAnimating = false;
|
||||
private boolean mBoundsAnimatingToFullscreen = false;
|
||||
private Rect mBoundsAnimationTarget = new Rect();
|
||||
|
||||
// Temporary storage for the new bounds that should be used after the configuration change.
|
||||
@@ -1443,9 +1444,10 @@ public class TaskStack extends WindowContainer<Task> implements DimLayer.DimLaye
|
||||
}
|
||||
|
||||
@Override // AnimatesBounds
|
||||
public void onAnimationStart() {
|
||||
public void onAnimationStart(boolean toFullscreen) {
|
||||
synchronized (mService.mWindowMap) {
|
||||
mBoundsAnimating = true;
|
||||
mBoundsAnimatingToFullscreen = toFullscreen;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1491,6 +1493,10 @@ public class TaskStack extends WindowContainer<Task> implements DimLayer.DimLaye
|
||||
return mBoundsAnimating;
|
||||
}
|
||||
|
||||
public boolean isBoundsAnimatingToFullscreen() {
|
||||
return mBoundsAnimating && mBoundsAnimatingToFullscreen;
|
||||
}
|
||||
|
||||
/** Returns true if a removal action is still being deferred. */
|
||||
boolean checkCompleteDeferredRemoval() {
|
||||
if (isAnimating()) {
|
||||
|
||||
Reference in New Issue
Block a user