Loading services/core/java/com/android/server/wm/Dimmer.java +7 −2 Original line number Original line Diff line number Diff line Loading @@ -50,10 +50,15 @@ class Dimmer { } } @Override @Override public SurfaceControl.Transaction getPendingTransaction() { public SurfaceControl.Transaction getSyncTransaction() { return mHost.getSyncTransaction(); return mHost.getSyncTransaction(); } } @Override public SurfaceControl.Transaction getPendingTransaction() { return mHost.getPendingTransaction(); } @Override @Override public void commitPendingTransaction() { public void commitPendingTransaction() { mHost.commitPendingTransaction(); mHost.commitPendingTransaction(); Loading Loading @@ -105,7 +110,7 @@ class Dimmer { void removeSurface() { void removeSurface() { if (mDimLayer != null && mDimLayer.isValid()) { if (mDimLayer != null && mDimLayer.isValid()) { getPendingTransaction().remove(mDimLayer); getSyncTransaction().remove(mDimLayer); } } mDimLayer = null; mDimLayer = null; } } Loading services/core/java/com/android/server/wm/ScreenRotationAnimation.java +1 −0 Original line number Original line Diff line number Diff line Loading @@ -565,6 +565,7 @@ class ScreenRotationAnimation { private SimpleSurfaceAnimatable.Builder initializeBuilder() { private SimpleSurfaceAnimatable.Builder initializeBuilder() { return new SimpleSurfaceAnimatable.Builder() return new SimpleSurfaceAnimatable.Builder() .setSyncTransactionSupplier(mDisplayContent::getSyncTransaction) .setPendingTransactionSupplier(mDisplayContent::getPendingTransaction) .setPendingTransactionSupplier(mDisplayContent::getPendingTransaction) .setCommitTransactionRunnable(mDisplayContent::commitPendingTransaction) .setCommitTransactionRunnable(mDisplayContent::commitPendingTransaction) .setAnimationLeashSupplier(mDisplayContent::makeOverlay); .setAnimationLeashSupplier(mDisplayContent::makeOverlay); Loading services/core/java/com/android/server/wm/SimpleSurfaceAnimatable.java +22 −0 Original line number Original line Diff line number Diff line Loading @@ -41,6 +41,7 @@ public class SimpleSurfaceAnimatable implements SurfaceAnimator.Animatable { private final SurfaceControl mParentSurfaceControl; private final SurfaceControl mParentSurfaceControl; private final Runnable mCommitTransactionRunnable; private final Runnable mCommitTransactionRunnable; private final Supplier<SurfaceControl.Builder> mAnimationLeashFactory; private final Supplier<SurfaceControl.Builder> mAnimationLeashFactory; private final Supplier<SurfaceControl.Transaction> mSyncTransaction; private final Supplier<SurfaceControl.Transaction> mPendingTransaction; private final Supplier<SurfaceControl.Transaction> mPendingTransaction; private final BiConsumer<SurfaceControl.Transaction, SurfaceControl> mOnAnimationLeashCreated; private final BiConsumer<SurfaceControl.Transaction, SurfaceControl> mOnAnimationLeashCreated; private final Consumer<SurfaceControl.Transaction> mOnAnimationLeashLost; private final Consumer<SurfaceControl.Transaction> mOnAnimationLeashLost; Loading @@ -60,10 +61,16 @@ public class SimpleSurfaceAnimatable implements SurfaceAnimator.Animatable { mAnimationLeashFactory = builder.mAnimationLeashFactory; mAnimationLeashFactory = builder.mAnimationLeashFactory; mOnAnimationLeashCreated = builder.mOnAnimationLeashCreated; mOnAnimationLeashCreated = builder.mOnAnimationLeashCreated; mOnAnimationLeashLost = builder.mOnAnimationLeashLost; mOnAnimationLeashLost = builder.mOnAnimationLeashLost; mSyncTransaction = builder.mSyncTransactionSupplier; mPendingTransaction = builder.mPendingTransactionSupplier; mPendingTransaction = builder.mPendingTransactionSupplier; mOnAnimationFinished = builder.mOnAnimationFinished; mOnAnimationFinished = builder.mOnAnimationFinished; } } @Override public SurfaceControl.Transaction getSyncTransaction() { return mSyncTransaction.get(); } @NonNull @NonNull @Override @Override public SurfaceControl.Transaction getPendingTransaction() { public SurfaceControl.Transaction getPendingTransaction() { Loading Loading @@ -159,6 +166,9 @@ public class SimpleSurfaceAnimatable implements SurfaceAnimator.Animatable { @Nullable @Nullable private Consumer<Runnable> mOnAnimationFinished = null; private Consumer<Runnable> mOnAnimationFinished = null; @NonNull private Supplier<SurfaceControl.Transaction> mSyncTransactionSupplier; @NonNull @NonNull private Supplier<SurfaceControl.Transaction> mPendingTransactionSupplier; private Supplier<SurfaceControl.Transaction> mPendingTransactionSupplier; Loading Loading @@ -206,6 +216,15 @@ public class SimpleSurfaceAnimatable implements SurfaceAnimator.Animatable { return this; return this; } } /** * @see SurfaceAnimator.Animatable#getSyncTransaction() */ public Builder setSyncTransactionSupplier( @NonNull Supplier<SurfaceControl.Transaction> syncTransactionSupplier) { mSyncTransactionSupplier = syncTransactionSupplier; return this; } /** /** * @see SurfaceAnimator.Animatable#getPendingTransaction() * @see SurfaceAnimator.Animatable#getPendingTransaction() */ */ Loading Loading @@ -290,6 +309,9 @@ public class SimpleSurfaceAnimatable implements SurfaceAnimator.Animatable { } } public SurfaceAnimator.Animatable build() { public SurfaceAnimator.Animatable build() { if (mSyncTransactionSupplier == null) { throw new IllegalArgumentException("mSyncTransactionSupplier cannot be null"); } if (mPendingTransactionSupplier == null) { if (mPendingTransactionSupplier == null) { throw new IllegalArgumentException("mPendingTransactionSupplier cannot be null"); throw new IllegalArgumentException("mPendingTransactionSupplier cannot be null"); } } Loading services/core/java/com/android/server/wm/SurfaceAnimator.java +10 −4 Original line number Original line Diff line number Diff line Loading @@ -128,7 +128,7 @@ class SurfaceAnimator { } } final OnAnimationFinishedCallback animationFinishCallback = final OnAnimationFinishedCallback animationFinishCallback = mSurfaceAnimationFinishedCallback; mSurfaceAnimationFinishedCallback; reset(mAnimatable.getPendingTransaction(), true /* destroyLeash */); reset(mAnimatable.getSyncTransaction(), true /* destroyLeash */); if (staticAnimationFinishedCallback != null) { if (staticAnimationFinishedCallback != null) { staticAnimationFinishedCallback.onAnimationFinished(type, anim); staticAnimationFinishedCallback.onAnimationFinished(type, anim); } } Loading Loading @@ -234,7 +234,7 @@ class SurfaceAnimator { final boolean delayed = mAnimationStartDelayed; final boolean delayed = mAnimationStartDelayed; mAnimationStartDelayed = false; mAnimationStartDelayed = false; if (delayed && mAnimation != null) { if (delayed && mAnimation != null) { mAnimation.startAnimation(mLeash, mAnimatable.getPendingTransaction(), mAnimation.startAnimation(mLeash, mAnimatable.getSyncTransaction(), mAnimationType, mInnerAnimationFinishedCallback); mAnimationType, mInnerAnimationFinishedCallback); mAnimatable.commitPendingTransaction(); mAnimatable.commitPendingTransaction(); } } Loading Loading @@ -264,7 +264,7 @@ class SurfaceAnimator { * Cancels any currently running animation. * Cancels any currently running animation. */ */ void cancelAnimation() { void cancelAnimation() { cancelAnimation(mAnimatable.getPendingTransaction(), false /* restarting */, cancelAnimation(mAnimatable.getSyncTransaction(), false /* restarting */, true /* forwardCancel */); true /* forwardCancel */); mAnimatable.commitPendingTransaction(); mAnimatable.commitPendingTransaction(); } } Loading Loading @@ -319,7 +319,7 @@ class SurfaceAnimator { return; return; } } endDelayingAnimationStart(); endDelayingAnimationStart(); final Transaction t = mAnimatable.getPendingTransaction(); final Transaction t = mAnimatable.getSyncTransaction(); cancelAnimation(t, true /* restarting */, true /* forwardCancel */); cancelAnimation(t, true /* restarting */, true /* forwardCancel */); mLeash = from.mLeash; mLeash = from.mLeash; mAnimation = from.mAnimation; mAnimation = from.mAnimation; Loading Loading @@ -619,6 +619,12 @@ class SurfaceAnimator { */ */ interface Animatable { interface Animatable { /** * Use this method instead of {@link #getPendingTransaction()} if the transaction should be * synchronized with the client. */ @NonNull Transaction getSyncTransaction(); /** /** * @return The pending transaction that will be committed in the next frame. * @return The pending transaction that will be committed in the next frame. */ */ Loading services/core/java/com/android/server/wm/WindowContainer.java +3 −2 Original line number Original line Diff line number Diff line Loading @@ -1004,7 +1004,7 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer< void onDisplayChanged(DisplayContent dc) { void onDisplayChanged(DisplayContent dc) { if (mDisplayContent != null && mDisplayContent.mChangingContainers.remove(this)) { if (mDisplayContent != null && mDisplayContent.mChangingContainers.remove(this)) { // Cancel any change transition queued-up for this container on the old display. // Cancel any change transition queued-up for this container on the old display. mSurfaceFreezer.unfreeze(getPendingTransaction()); mSurfaceFreezer.unfreeze(getSyncTransaction()); } } mDisplayContent = dc; mDisplayContent = dc; if (dc != null && dc != this) { if (dc != null && dc != this) { Loading Loading @@ -2697,6 +2697,7 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer< * @return {@link #mBLASTSyncTransaction} if available. Otherwise, returns * @return {@link #mBLASTSyncTransaction} if available. Otherwise, returns * {@link #getPendingTransaction()} * {@link #getPendingTransaction()} */ */ @Override public Transaction getSyncTransaction() { public Transaction getSyncTransaction() { if (mSyncTransactionCommitCallbackDepth > 0) { if (mSyncTransactionCommitCallbackDepth > 0) { return mSyncTransaction; return mSyncTransaction; Loading Loading @@ -2767,7 +2768,7 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer< void cancelAnimation() { void cancelAnimation() { doAnimationFinished(mSurfaceAnimator.getAnimationType(), mSurfaceAnimator.getAnimation()); doAnimationFinished(mSurfaceAnimator.getAnimationType(), mSurfaceAnimator.getAnimation()); mSurfaceAnimator.cancelAnimation(); mSurfaceAnimator.cancelAnimation(); mSurfaceFreezer.unfreeze(getPendingTransaction()); mSurfaceFreezer.unfreeze(getSyncTransaction()); } } /** Whether we can start change transition with this window and current display status. */ /** Whether we can start change transition with this window and current display status. */ Loading Loading
services/core/java/com/android/server/wm/Dimmer.java +7 −2 Original line number Original line Diff line number Diff line Loading @@ -50,10 +50,15 @@ class Dimmer { } } @Override @Override public SurfaceControl.Transaction getPendingTransaction() { public SurfaceControl.Transaction getSyncTransaction() { return mHost.getSyncTransaction(); return mHost.getSyncTransaction(); } } @Override public SurfaceControl.Transaction getPendingTransaction() { return mHost.getPendingTransaction(); } @Override @Override public void commitPendingTransaction() { public void commitPendingTransaction() { mHost.commitPendingTransaction(); mHost.commitPendingTransaction(); Loading Loading @@ -105,7 +110,7 @@ class Dimmer { void removeSurface() { void removeSurface() { if (mDimLayer != null && mDimLayer.isValid()) { if (mDimLayer != null && mDimLayer.isValid()) { getPendingTransaction().remove(mDimLayer); getSyncTransaction().remove(mDimLayer); } } mDimLayer = null; mDimLayer = null; } } Loading
services/core/java/com/android/server/wm/ScreenRotationAnimation.java +1 −0 Original line number Original line Diff line number Diff line Loading @@ -565,6 +565,7 @@ class ScreenRotationAnimation { private SimpleSurfaceAnimatable.Builder initializeBuilder() { private SimpleSurfaceAnimatable.Builder initializeBuilder() { return new SimpleSurfaceAnimatable.Builder() return new SimpleSurfaceAnimatable.Builder() .setSyncTransactionSupplier(mDisplayContent::getSyncTransaction) .setPendingTransactionSupplier(mDisplayContent::getPendingTransaction) .setPendingTransactionSupplier(mDisplayContent::getPendingTransaction) .setCommitTransactionRunnable(mDisplayContent::commitPendingTransaction) .setCommitTransactionRunnable(mDisplayContent::commitPendingTransaction) .setAnimationLeashSupplier(mDisplayContent::makeOverlay); .setAnimationLeashSupplier(mDisplayContent::makeOverlay); Loading
services/core/java/com/android/server/wm/SimpleSurfaceAnimatable.java +22 −0 Original line number Original line Diff line number Diff line Loading @@ -41,6 +41,7 @@ public class SimpleSurfaceAnimatable implements SurfaceAnimator.Animatable { private final SurfaceControl mParentSurfaceControl; private final SurfaceControl mParentSurfaceControl; private final Runnable mCommitTransactionRunnable; private final Runnable mCommitTransactionRunnable; private final Supplier<SurfaceControl.Builder> mAnimationLeashFactory; private final Supplier<SurfaceControl.Builder> mAnimationLeashFactory; private final Supplier<SurfaceControl.Transaction> mSyncTransaction; private final Supplier<SurfaceControl.Transaction> mPendingTransaction; private final Supplier<SurfaceControl.Transaction> mPendingTransaction; private final BiConsumer<SurfaceControl.Transaction, SurfaceControl> mOnAnimationLeashCreated; private final BiConsumer<SurfaceControl.Transaction, SurfaceControl> mOnAnimationLeashCreated; private final Consumer<SurfaceControl.Transaction> mOnAnimationLeashLost; private final Consumer<SurfaceControl.Transaction> mOnAnimationLeashLost; Loading @@ -60,10 +61,16 @@ public class SimpleSurfaceAnimatable implements SurfaceAnimator.Animatable { mAnimationLeashFactory = builder.mAnimationLeashFactory; mAnimationLeashFactory = builder.mAnimationLeashFactory; mOnAnimationLeashCreated = builder.mOnAnimationLeashCreated; mOnAnimationLeashCreated = builder.mOnAnimationLeashCreated; mOnAnimationLeashLost = builder.mOnAnimationLeashLost; mOnAnimationLeashLost = builder.mOnAnimationLeashLost; mSyncTransaction = builder.mSyncTransactionSupplier; mPendingTransaction = builder.mPendingTransactionSupplier; mPendingTransaction = builder.mPendingTransactionSupplier; mOnAnimationFinished = builder.mOnAnimationFinished; mOnAnimationFinished = builder.mOnAnimationFinished; } } @Override public SurfaceControl.Transaction getSyncTransaction() { return mSyncTransaction.get(); } @NonNull @NonNull @Override @Override public SurfaceControl.Transaction getPendingTransaction() { public SurfaceControl.Transaction getPendingTransaction() { Loading Loading @@ -159,6 +166,9 @@ public class SimpleSurfaceAnimatable implements SurfaceAnimator.Animatable { @Nullable @Nullable private Consumer<Runnable> mOnAnimationFinished = null; private Consumer<Runnable> mOnAnimationFinished = null; @NonNull private Supplier<SurfaceControl.Transaction> mSyncTransactionSupplier; @NonNull @NonNull private Supplier<SurfaceControl.Transaction> mPendingTransactionSupplier; private Supplier<SurfaceControl.Transaction> mPendingTransactionSupplier; Loading Loading @@ -206,6 +216,15 @@ public class SimpleSurfaceAnimatable implements SurfaceAnimator.Animatable { return this; return this; } } /** * @see SurfaceAnimator.Animatable#getSyncTransaction() */ public Builder setSyncTransactionSupplier( @NonNull Supplier<SurfaceControl.Transaction> syncTransactionSupplier) { mSyncTransactionSupplier = syncTransactionSupplier; return this; } /** /** * @see SurfaceAnimator.Animatable#getPendingTransaction() * @see SurfaceAnimator.Animatable#getPendingTransaction() */ */ Loading Loading @@ -290,6 +309,9 @@ public class SimpleSurfaceAnimatable implements SurfaceAnimator.Animatable { } } public SurfaceAnimator.Animatable build() { public SurfaceAnimator.Animatable build() { if (mSyncTransactionSupplier == null) { throw new IllegalArgumentException("mSyncTransactionSupplier cannot be null"); } if (mPendingTransactionSupplier == null) { if (mPendingTransactionSupplier == null) { throw new IllegalArgumentException("mPendingTransactionSupplier cannot be null"); throw new IllegalArgumentException("mPendingTransactionSupplier cannot be null"); } } Loading
services/core/java/com/android/server/wm/SurfaceAnimator.java +10 −4 Original line number Original line Diff line number Diff line Loading @@ -128,7 +128,7 @@ class SurfaceAnimator { } } final OnAnimationFinishedCallback animationFinishCallback = final OnAnimationFinishedCallback animationFinishCallback = mSurfaceAnimationFinishedCallback; mSurfaceAnimationFinishedCallback; reset(mAnimatable.getPendingTransaction(), true /* destroyLeash */); reset(mAnimatable.getSyncTransaction(), true /* destroyLeash */); if (staticAnimationFinishedCallback != null) { if (staticAnimationFinishedCallback != null) { staticAnimationFinishedCallback.onAnimationFinished(type, anim); staticAnimationFinishedCallback.onAnimationFinished(type, anim); } } Loading Loading @@ -234,7 +234,7 @@ class SurfaceAnimator { final boolean delayed = mAnimationStartDelayed; final boolean delayed = mAnimationStartDelayed; mAnimationStartDelayed = false; mAnimationStartDelayed = false; if (delayed && mAnimation != null) { if (delayed && mAnimation != null) { mAnimation.startAnimation(mLeash, mAnimatable.getPendingTransaction(), mAnimation.startAnimation(mLeash, mAnimatable.getSyncTransaction(), mAnimationType, mInnerAnimationFinishedCallback); mAnimationType, mInnerAnimationFinishedCallback); mAnimatable.commitPendingTransaction(); mAnimatable.commitPendingTransaction(); } } Loading Loading @@ -264,7 +264,7 @@ class SurfaceAnimator { * Cancels any currently running animation. * Cancels any currently running animation. */ */ void cancelAnimation() { void cancelAnimation() { cancelAnimation(mAnimatable.getPendingTransaction(), false /* restarting */, cancelAnimation(mAnimatable.getSyncTransaction(), false /* restarting */, true /* forwardCancel */); true /* forwardCancel */); mAnimatable.commitPendingTransaction(); mAnimatable.commitPendingTransaction(); } } Loading Loading @@ -319,7 +319,7 @@ class SurfaceAnimator { return; return; } } endDelayingAnimationStart(); endDelayingAnimationStart(); final Transaction t = mAnimatable.getPendingTransaction(); final Transaction t = mAnimatable.getSyncTransaction(); cancelAnimation(t, true /* restarting */, true /* forwardCancel */); cancelAnimation(t, true /* restarting */, true /* forwardCancel */); mLeash = from.mLeash; mLeash = from.mLeash; mAnimation = from.mAnimation; mAnimation = from.mAnimation; Loading Loading @@ -619,6 +619,12 @@ class SurfaceAnimator { */ */ interface Animatable { interface Animatable { /** * Use this method instead of {@link #getPendingTransaction()} if the transaction should be * synchronized with the client. */ @NonNull Transaction getSyncTransaction(); /** /** * @return The pending transaction that will be committed in the next frame. * @return The pending transaction that will be committed in the next frame. */ */ Loading
services/core/java/com/android/server/wm/WindowContainer.java +3 −2 Original line number Original line Diff line number Diff line Loading @@ -1004,7 +1004,7 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer< void onDisplayChanged(DisplayContent dc) { void onDisplayChanged(DisplayContent dc) { if (mDisplayContent != null && mDisplayContent.mChangingContainers.remove(this)) { if (mDisplayContent != null && mDisplayContent.mChangingContainers.remove(this)) { // Cancel any change transition queued-up for this container on the old display. // Cancel any change transition queued-up for this container on the old display. mSurfaceFreezer.unfreeze(getPendingTransaction()); mSurfaceFreezer.unfreeze(getSyncTransaction()); } } mDisplayContent = dc; mDisplayContent = dc; if (dc != null && dc != this) { if (dc != null && dc != this) { Loading Loading @@ -2697,6 +2697,7 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer< * @return {@link #mBLASTSyncTransaction} if available. Otherwise, returns * @return {@link #mBLASTSyncTransaction} if available. Otherwise, returns * {@link #getPendingTransaction()} * {@link #getPendingTransaction()} */ */ @Override public Transaction getSyncTransaction() { public Transaction getSyncTransaction() { if (mSyncTransactionCommitCallbackDepth > 0) { if (mSyncTransactionCommitCallbackDepth > 0) { return mSyncTransaction; return mSyncTransaction; Loading Loading @@ -2767,7 +2768,7 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer< void cancelAnimation() { void cancelAnimation() { doAnimationFinished(mSurfaceAnimator.getAnimationType(), mSurfaceAnimator.getAnimation()); doAnimationFinished(mSurfaceAnimator.getAnimationType(), mSurfaceAnimator.getAnimation()); mSurfaceAnimator.cancelAnimation(); mSurfaceAnimator.cancelAnimation(); mSurfaceFreezer.unfreeze(getPendingTransaction()); mSurfaceFreezer.unfreeze(getSyncTransaction()); } } /** Whether we can start change transition with this window and current display status. */ /** Whether we can start change transition with this window and current display status. */ Loading