Merge "Animate divider bar and roottasks along with keyguard-exit" into rvc-dev

This commit is contained in:
Evan Rosky
2020-04-07 23:29:53 +00:00
committed by Android (Google) Code Review
8 changed files with 58 additions and 22 deletions

View File

@@ -76,7 +76,6 @@ import static com.android.server.wm.WindowManagerDebugConfig.TAG_WITH_CLASS_NAME
import static com.android.server.wm.WindowManagerDebugConfig.TAG_WM; import static com.android.server.wm.WindowManagerDebugConfig.TAG_WM;
import static com.android.server.wm.WindowManagerInternal.AppTransitionListener; import static com.android.server.wm.WindowManagerInternal.AppTransitionListener;
import static com.android.server.wm.WindowStateAnimator.STACK_CLIP_AFTER_ANIM; import static com.android.server.wm.WindowStateAnimator.STACK_CLIP_AFTER_ANIM;
import static com.android.server.wm.WindowStateAnimator.STACK_CLIP_BEFORE_ANIM;
import static com.android.server.wm.WindowStateAnimator.STACK_CLIP_NONE; import static com.android.server.wm.WindowStateAnimator.STACK_CLIP_NONE;
import android.annotation.DrawableRes; import android.annotation.DrawableRes;
@@ -1807,15 +1806,11 @@ public class AppTransition implements Dump {
} }
int getAppStackClipMode() { int getAppStackClipMode() {
// When dismiss keyguard animation occurs, clip before the animation to prevent docked
// app from showing beyond the divider
if (mNextAppTransition == TRANSIT_KEYGUARD_GOING_AWAY
|| mNextAppTransition == TRANSIT_KEYGUARD_GOING_AWAY_ON_WALLPAPER) {
return STACK_CLIP_BEFORE_ANIM;
}
return mNextAppTransition == TRANSIT_ACTIVITY_RELAUNCH return mNextAppTransition == TRANSIT_ACTIVITY_RELAUNCH
|| mNextAppTransition == TRANSIT_DOCK_TASK_FROM_RECENTS || mNextAppTransition == TRANSIT_DOCK_TASK_FROM_RECENTS
|| mNextAppTransitionType == NEXT_TRANSIT_TYPE_CLIP_REVEAL || mNextAppTransitionType == NEXT_TRANSIT_TYPE_CLIP_REVEAL
|| mNextAppTransition == TRANSIT_KEYGUARD_GOING_AWAY
|| mNextAppTransition == TRANSIT_KEYGUARD_GOING_AWAY_ON_WALLPAPER
? STACK_CLIP_NONE ? STACK_CLIP_NONE
: STACK_CLIP_AFTER_ANIM; : STACK_CLIP_AFTER_ANIM;
} }

View File

@@ -197,7 +197,6 @@ import android.view.ViewRootImpl;
import android.view.WindowInsets; import android.view.WindowInsets;
import android.view.WindowManager; import android.view.WindowManager;
import android.view.WindowManagerPolicyConstants.PointerEventListener; import android.view.WindowManagerPolicyConstants.PointerEventListener;
import android.window.ITaskOrganizer;
import com.android.internal.annotations.VisibleForTesting; import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.logging.MetricsLogger; import com.android.internal.logging.MetricsLogger;
@@ -3554,6 +3553,10 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo
onWallpaper, goingToShade, subtle)); onWallpaper, goingToShade, subtle));
} }
}, true /* traverseTopToBottom */); }, true /* traverseTopToBottom */);
for (int i = mShellRoots.size() - 1; i >= 0; --i) {
mShellRoots.valueAt(i).startAnimation(policy.createHiddenByKeyguardExit(
onWallpaper, goingToShade, subtle));
}
} }
/** @return {@code true} if there is window to wait before enabling the screen. */ /** @return {@code true} if there is window to wait before enabling the screen. */

View File

@@ -16,12 +16,20 @@
package com.android.server.wm; package com.android.server.wm;
import static android.view.WindowManager.LayoutParams.TYPE_DOCK_DIVIDER;
import static com.android.server.wm.SurfaceAnimator.ANIMATION_TYPE_WINDOW_ANIMATION;
import static com.android.server.wm.WindowManagerService.MAX_ANIMATION_DURATION;
import android.annotation.NonNull; import android.annotation.NonNull;
import android.graphics.Point;
import android.os.IBinder; import android.os.IBinder;
import android.os.RemoteException; import android.os.RemoteException;
import android.util.Slog; import android.util.Slog;
import android.view.DisplayInfo;
import android.view.IWindow; import android.view.IWindow;
import android.view.SurfaceControl; import android.view.SurfaceControl;
import android.view.animation.Animation;
/** /**
* Represents a piece of the hierarchy under which a client Shell can manage sub-windows. * Represents a piece of the hierarchy under which a client Shell can manage sub-windows.
@@ -70,5 +78,29 @@ public class ShellRoot {
IWindow getClient() { IWindow getClient() {
return mClient; return mClient;
} }
void startAnimation(Animation anim) {
// Only do this for the divider
if (mToken.windowType != TYPE_DOCK_DIVIDER) {
return;
}
DisplayInfo displayInfo = mToken.getFixedRotationTransformDisplayInfo();
if (displayInfo == null) {
displayInfo = mDisplayContent.getDisplayInfo();
}
// Mostly copied from WindowState to enable keyguard transition animation
anim.initialize(displayInfo.logicalWidth, displayInfo.logicalHeight,
displayInfo.appWidth, displayInfo.appHeight);
anim.restrictDuration(MAX_ANIMATION_DURATION);
anim.scaleCurrentDuration(mDisplayContent.mWmService.getWindowAnimationScaleLocked());
final AnimationAdapter adapter = new LocalAnimationAdapter(
new WindowAnimationSpec(anim, new Point(0, 0), false /* canSkipFirstFrame */,
0 /* windowCornerRadius */),
mDisplayContent.mWmService.mSurfaceAnimationRunner);
mToken.startAnimation(mToken.getPendingTransaction(), adapter, false /* hidden */,
ANIMATION_TYPE_WINDOW_ANIMATION, null /* animationFinishedCallback */);
}
} }

View File

@@ -1612,6 +1612,11 @@ final class TaskDisplayArea extends DisplayArea<ActivityStack> {
} }
} }
@Override
boolean canCreateRemoteAnimationTarget() {
return true;
}
/** /**
* Callback for when the order of the stacks in the display changes. * Callback for when the order of the stacks in the display changes.
*/ */

View File

@@ -379,6 +379,7 @@ class TaskSnapshotSurface implements StartingSurface {
frame = null; frame = null;
mTmpDstFrame.set(mFrame); mTmpDstFrame.set(mFrame);
} }
mTmpDstFrame.offsetTo(0, 0);
// Scale the mismatch dimensions to fill the task bounds // Scale the mismatch dimensions to fill the task bounds
mTmpSnapshotSize.set(0, 0, buffer.getWidth(), buffer.getHeight()); mTmpSnapshotSize.set(0, 0, buffer.getWidth(), buffer.getHeight());

View File

@@ -2295,6 +2295,10 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer<
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.
t.setPosition(mSurfaceControl, 0, 0);
mLastSurfacePosition.set(0, 0);
} }
@Override @Override
@@ -2302,6 +2306,7 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer<
mLastLayer = -1; mLastLayer = -1;
mSurfaceFreezer.unfreeze(t); mSurfaceFreezer.unfreeze(t);
reassignLayer(t); reassignLayer(t);
updateSurfacePosition(t);
} }
/** /**
@@ -2365,11 +2370,15 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer<
} }
} }
void updateSurfacePosition() { final void updateSurfacePosition() {
updateSurfacePosition(getPendingTransaction());
}
void updateSurfacePosition(Transaction t) {
// Avoid fighting with the organizer over Surface position. // Avoid fighting with the organizer over Surface position.
if (isOrganized()) return; if (isOrganized()) return;
if (mSurfaceControl == null) { if (mSurfaceControl == null || mSurfaceAnimator.hasLeash()) {
return; return;
} }
@@ -2378,7 +2387,7 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer<
return; return;
} }
getPendingTransaction().setPosition(mSurfaceControl, mTmpPos.x, mTmpPos.y); t.setPosition(mSurfaceControl, mTmpPos.x, mTmpPos.y);
mLastSurfacePosition.set(mTmpPos.x, mTmpPos.y); mLastSurfacePosition.set(mTmpPos.x, mTmpPos.y);
} }

View File

@@ -5237,23 +5237,14 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
@Override @Override
public void onAnimationLeashCreated(Transaction t, SurfaceControl leash) { public void onAnimationLeashCreated(Transaction t, SurfaceControl leash) {
super.onAnimationLeashCreated(t, leash); super.onAnimationLeashCreated(t, leash);
// Leash is now responsible for position, so set our position to 0.
t.setPosition(mSurfaceControl, 0, 0);
mLastSurfacePosition.set(0, 0);
} }
@Override @Override
public void onAnimationLeashLost(Transaction t) { public void onAnimationLeashLost(Transaction t) {
super.onAnimationLeashLost(t); super.onAnimationLeashLost(t);
updateSurfacePosition(t);
} }
@Override @Override
void updateSurfacePosition() {
updateSurfacePosition(getPendingTransaction());
}
@VisibleForTesting @VisibleForTesting
void updateSurfacePosition(Transaction t) { void updateSurfacePosition(Transaction t) {
if (mSurfaceControl == null) { if (mSurfaceControl == null) {

View File

@@ -535,8 +535,8 @@ class WindowToken extends WindowContainer<WindowState> {
} }
@Override @Override
void updateSurfacePosition() { void updateSurfacePosition(SurfaceControl.Transaction t) {
super.updateSurfacePosition(); super.updateSurfacePosition(t);
if (isFixedRotationTransforming()) { if (isFixedRotationTransforming()) {
// The window is layouted in a simulated rotated display but the real display hasn't // The window is layouted in a simulated rotated display but the real display hasn't
// rotated, so here transforms its surface to fit in the real display. // rotated, so here transforms its surface to fit in the real display.