Merge "Support shell rotation transition on general window container" into tm-qpr-dev
This commit is contained in:
@@ -154,8 +154,6 @@ public class DefaultTransitionHandler implements Transitions.TransitionHandler {
|
|||||||
|
|
||||||
private final int mCurrentUserId;
|
private final int mCurrentUserId;
|
||||||
|
|
||||||
private ScreenRotationAnimation mRotationAnimation;
|
|
||||||
|
|
||||||
private Drawable mEnterpriseThumbnailDrawable;
|
private Drawable mEnterpriseThumbnailDrawable;
|
||||||
|
|
||||||
private BroadcastReceiver mEnterpriseResourceUpdatedReceiver = new BroadcastReceiver() {
|
private BroadcastReceiver mEnterpriseResourceUpdatedReceiver = new BroadcastReceiver() {
|
||||||
@@ -340,12 +338,6 @@ public class DefaultTransitionHandler implements Transitions.TransitionHandler {
|
|||||||
|
|
||||||
final Runnable onAnimFinish = () -> {
|
final Runnable onAnimFinish = () -> {
|
||||||
if (!animations.isEmpty()) return;
|
if (!animations.isEmpty()) return;
|
||||||
|
|
||||||
if (mRotationAnimation != null) {
|
|
||||||
mRotationAnimation.kill();
|
|
||||||
mRotationAnimation = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
mAnimations.remove(transition);
|
mAnimations.remove(transition);
|
||||||
finishCallback.onTransitionFinished(null /* wct */, null /* wctCB */);
|
finishCallback.onTransitionFinished(null /* wct */, null /* wctCB */);
|
||||||
};
|
};
|
||||||
@@ -365,11 +357,8 @@ public class DefaultTransitionHandler implements Transitions.TransitionHandler {
|
|||||||
isSeamlessDisplayChange = isRotationSeamless(info, mDisplayController);
|
isSeamlessDisplayChange = isRotationSeamless(info, mDisplayController);
|
||||||
final int anim = getRotationAnimation(info);
|
final int anim = getRotationAnimation(info);
|
||||||
if (!(isSeamlessDisplayChange || anim == ROTATION_ANIMATION_JUMPCUT)) {
|
if (!(isSeamlessDisplayChange || anim == ROTATION_ANIMATION_JUMPCUT)) {
|
||||||
mRotationAnimation = new ScreenRotationAnimation(mContext, mSurfaceSession,
|
startRotationAnimation(startTransaction, change, info, anim, animations,
|
||||||
mTransactionPool, startTransaction, change, info.getRootLeash(),
|
onAnimFinish);
|
||||||
anim);
|
|
||||||
mRotationAnimation.startAnimation(animations, onAnimFinish,
|
|
||||||
mTransitionAnimationScaleSetting, mMainExecutor, mAnimExecutor);
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -413,6 +402,13 @@ public class DefaultTransitionHandler implements Transitions.TransitionHandler {
|
|||||||
startTransaction.setWindowCrop(change.getLeash(),
|
startTransaction.setWindowCrop(change.getLeash(),
|
||||||
change.getEndAbsBounds().width(), change.getEndAbsBounds().height());
|
change.getEndAbsBounds().width(), change.getEndAbsBounds().height());
|
||||||
}
|
}
|
||||||
|
// Rotation change of independent non display window container.
|
||||||
|
if (change.getParent() == null
|
||||||
|
&& change.getStartRotation() != change.getEndRotation()) {
|
||||||
|
startRotationAnimation(startTransaction, change, info,
|
||||||
|
ROTATION_ANIMATION_ROTATE, animations, onAnimFinish);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Don't animate anything that isn't independent.
|
// Don't animate anything that isn't independent.
|
||||||
@@ -543,6 +539,31 @@ public class DefaultTransitionHandler implements Transitions.TransitionHandler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void startRotationAnimation(SurfaceControl.Transaction startTransaction,
|
||||||
|
TransitionInfo.Change change, TransitionInfo info, int animHint,
|
||||||
|
ArrayList<Animator> animations, Runnable onAnimFinish) {
|
||||||
|
final ScreenRotationAnimation anim = new ScreenRotationAnimation(mContext, mSurfaceSession,
|
||||||
|
mTransactionPool, startTransaction, change, info.getRootLeash(), animHint);
|
||||||
|
// The rotation animation may consist of 3 animations: fade-out screenshot, fade-in real
|
||||||
|
// content, and background color. The item of "animGroup" will be removed if the sub
|
||||||
|
// animation is finished. Then if the list becomes empty, the rotation animation is done.
|
||||||
|
final ArrayList<Animator> animGroup = new ArrayList<>(3);
|
||||||
|
final ArrayList<Animator> animGroupStore = new ArrayList<>(3);
|
||||||
|
final Runnable finishCallback = () -> {
|
||||||
|
if (!animGroup.isEmpty()) return;
|
||||||
|
anim.kill();
|
||||||
|
animations.removeAll(animGroupStore);
|
||||||
|
onAnimFinish.run();
|
||||||
|
};
|
||||||
|
anim.startAnimation(animGroup, finishCallback, mTransitionAnimationScaleSetting,
|
||||||
|
mMainExecutor, mAnimExecutor);
|
||||||
|
for (int i = animGroup.size() - 1; i >= 0; i--) {
|
||||||
|
final Animator animator = animGroup.get(i);
|
||||||
|
animGroupStore.add(animator);
|
||||||
|
animations.add(animator);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void edgeExtendWindow(TransitionInfo.Change change,
|
private void edgeExtendWindow(TransitionInfo.Change change,
|
||||||
Animation a, SurfaceControl.Transaction startTransaction,
|
Animation a, SurfaceControl.Transaction startTransaction,
|
||||||
SurfaceControl.Transaction finishTransaction) {
|
SurfaceControl.Transaction finishTransaction) {
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ class ScreenRotationAnimation {
|
|||||||
private final Context mContext;
|
private final Context mContext;
|
||||||
private final TransactionPool mTransactionPool;
|
private final TransactionPool mTransactionPool;
|
||||||
private final float[] mTmpFloats = new float[9];
|
private final float[] mTmpFloats = new float[9];
|
||||||
/** The leash of display. */
|
/** The leash of the changing window container. */
|
||||||
private final SurfaceControl mSurfaceControl;
|
private final SurfaceControl mSurfaceControl;
|
||||||
private final Rect mStartBounds = new Rect();
|
private final Rect mStartBounds = new Rect();
|
||||||
private final Rect mEndBounds = new Rect();
|
private final Rect mEndBounds = new Rect();
|
||||||
|
|||||||
@@ -356,7 +356,7 @@ public class Transitions implements RemoteCallable<Transitions> {
|
|||||||
// Put all the OPEN/SHOW on top
|
// Put all the OPEN/SHOW on top
|
||||||
if ((change.getFlags() & FLAG_IS_WALLPAPER) != 0) {
|
if ((change.getFlags() & FLAG_IS_WALLPAPER) != 0) {
|
||||||
// Wallpaper is always at the bottom.
|
// Wallpaper is always at the bottom.
|
||||||
layer = 0;
|
layer = -zSplitLine;
|
||||||
} else if (mode == TRANSIT_OPEN || mode == TRANSIT_TO_FRONT) {
|
} else if (mode == TRANSIT_OPEN || mode == TRANSIT_TO_FRONT) {
|
||||||
if (isOpening) {
|
if (isOpening) {
|
||||||
// put on top
|
// put on top
|
||||||
|
|||||||
@@ -2453,8 +2453,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
|
|||||||
dc.setImeLayeringTarget(null);
|
dc.setImeLayeringTarget(null);
|
||||||
dc.computeImeTarget(true /* updateImeTarget */);
|
dc.computeImeTarget(true /* updateImeTarget */);
|
||||||
}
|
}
|
||||||
if (dc.getImeInputTarget() == this
|
if (dc.getImeInputTarget() == this && !inRelaunchingActivity()) {
|
||||||
&& (mActivityRecord == null || !mActivityRecord.isRelaunching())) {
|
|
||||||
dc.updateImeInputAndControlTarget(null);
|
dc.updateImeInputAndControlTarget(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2581,7 +2580,10 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
|
|||||||
// usually unnoticeable (e.g. covered by rotation animation) and the animation
|
// usually unnoticeable (e.g. covered by rotation animation) and the animation
|
||||||
// bounds could be inconsistent, such as depending on when the window applies
|
// bounds could be inconsistent, such as depending on when the window applies
|
||||||
// its draw transaction with new rotation.
|
// its draw transaction with new rotation.
|
||||||
final boolean allowExitAnimation = !getDisplayContent().inTransition();
|
final boolean allowExitAnimation = !getDisplayContent().inTransition()
|
||||||
|
// There will be a new window so the exit animation may not be visible or
|
||||||
|
// look weird if its orientation is changed.
|
||||||
|
&& !inRelaunchingActivity();
|
||||||
|
|
||||||
if (wasVisible) {
|
if (wasVisible) {
|
||||||
final int transit = (!startingWindow) ? TRANSIT_EXIT : TRANSIT_PREVIEW_DONE;
|
final int transit = (!startingWindow) ? TRANSIT_EXIT : TRANSIT_PREVIEW_DONE;
|
||||||
@@ -3871,7 +3873,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
|
|||||||
// If the activity is scheduled to relaunch, skip sending the resized to ViewRootImpl now
|
// If the activity is scheduled to relaunch, skip sending the resized to ViewRootImpl now
|
||||||
// since it will be destroyed anyway. This also prevents the client from receiving
|
// since it will be destroyed anyway. This also prevents the client from receiving
|
||||||
// windowing mode change before it is destroyed.
|
// windowing mode change before it is destroyed.
|
||||||
if (mActivityRecord != null && mActivityRecord.isRelaunching()) {
|
if (inRelaunchingActivity()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// If this is an activity or wallpaper and is invisible or going invisible, don't report
|
// If this is an activity or wallpaper and is invisible or going invisible, don't report
|
||||||
@@ -3957,6 +3959,10 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
|
|||||||
Trace.traceEnd(TRACE_TAG_WINDOW_MANAGER);
|
Trace.traceEnd(TRACE_TAG_WINDOW_MANAGER);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean inRelaunchingActivity() {
|
||||||
|
return mActivityRecord != null && mActivityRecord.isRelaunching();
|
||||||
|
}
|
||||||
|
|
||||||
boolean isClientLocal() {
|
boolean isClientLocal() {
|
||||||
return mClient instanceof IWindow.Stub;
|
return mClient instanceof IWindow.Stub;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ import android.view.DisplayInfo;
|
|||||||
import android.view.InsetsState;
|
import android.view.InsetsState;
|
||||||
import android.view.Surface;
|
import android.view.Surface;
|
||||||
import android.view.SurfaceControl;
|
import android.view.SurfaceControl;
|
||||||
|
import android.view.WindowManager;
|
||||||
import android.view.WindowManager.LayoutParams.WindowType;
|
import android.view.WindowManager.LayoutParams.WindowType;
|
||||||
import android.window.WindowContext;
|
import android.window.WindowContext;
|
||||||
|
|
||||||
@@ -558,6 +559,12 @@ class WindowToken extends WindowContainer<WindowState> {
|
|||||||
// The window may be detached or detaching.
|
// The window may be detached or detaching.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (mTransitionController.isShellTransitionsEnabled()
|
||||||
|
&& asActivityRecord() != null && isVisible()) {
|
||||||
|
// Trigger an activity level rotation transition.
|
||||||
|
mTransitionController.requestTransitionIfNeeded(WindowManager.TRANSIT_CHANGE, this);
|
||||||
|
mTransitionController.setReady(this);
|
||||||
|
}
|
||||||
final int originalRotation = getWindowConfiguration().getRotation();
|
final int originalRotation = getWindowConfiguration().getRotation();
|
||||||
onConfigurationChanged(parent.getConfiguration());
|
onConfigurationChanged(parent.getConfiguration());
|
||||||
onCancelFixedRotationTransform(originalRotation);
|
onCancelFixedRotationTransform(originalRotation);
|
||||||
|
|||||||
Reference in New Issue
Block a user