diff options
5 files changed, 25 insertions, 5 deletions
diff --git a/services/core/java/com/android/server/wm/AppWindowThumbnail.java b/services/core/java/com/android/server/wm/AppWindowThumbnail.java index b86cd50dc922..c16a5315060f 100644 --- a/services/core/java/com/android/server/wm/AppWindowThumbnail.java +++ b/services/core/java/com/android/server/wm/AppWindowThumbnail.java @@ -139,7 +139,7 @@ class AppWindowThumbnail implements Animatable { @Override public Builder makeAnimationLeash() { - return mAppToken.makeSurface().setParent(mAppToken.getAppAnimationLayer()); + return mAppToken.makeSurface(); } @Override @@ -148,6 +148,11 @@ class AppWindowThumbnail implements Animatable { } @Override + public SurfaceControl getAnimationLeashParent() { + return mAppToken.getAppAnimationLayer(); + } + + @Override public SurfaceControl getParentSurfaceControl() { return mAppToken.getParentSurfaceControl(); } diff --git a/services/core/java/com/android/server/wm/AppWindowToken.java b/services/core/java/com/android/server/wm/AppWindowToken.java index 44d7948b12b6..3f9959148a0f 100644 --- a/services/core/java/com/android/server/wm/AppWindowToken.java +++ b/services/core/java/com/android/server/wm/AppWindowToken.java @@ -1512,9 +1512,8 @@ class AppWindowToken extends WindowToken implements WindowManagerService.AppFree } @Override - public SurfaceControl.Builder makeAnimationLeash() { - return super.makeAnimationLeash() - .setParent(getAppAnimationLayer()); + public SurfaceControl getAnimationLeashParent() { + return getAppAnimationLayer(); } boolean applyAnimationLocked(WindowManager.LayoutParams lp, int transit, boolean enter, diff --git a/services/core/java/com/android/server/wm/SurfaceAnimator.java b/services/core/java/com/android/server/wm/SurfaceAnimator.java index bf2c85d6591e..a32e711df534 100644 --- a/services/core/java/com/android/server/wm/SurfaceAnimator.java +++ b/services/core/java/com/android/server/wm/SurfaceAnimator.java @@ -219,7 +219,7 @@ class SurfaceAnimator { return; } final SurfaceControl surface = mAnimatable.getSurfaceControl(); - final SurfaceControl parent = mAnimatable.getParentSurfaceControl(); + final SurfaceControl parent = mAnimatable.getAnimationLeashParent(); if (surface == null || parent == null) { Slog.w(TAG, "Unable to transfer animation, surface or parent is null"); cancelAnimation(); @@ -293,6 +293,7 @@ class SurfaceAnimator { int height, boolean hidden) { if (DEBUG_ANIM) Slog.i(TAG, "Reparenting to leash"); final SurfaceControl.Builder builder = mAnimatable.makeAnimationLeash() + .setParent(mAnimatable.getAnimationLeashParent()) .setName(surface + " - animation-leash") .setSize(width, height); final SurfaceControl leash = builder.build(); @@ -361,6 +362,11 @@ class SurfaceAnimator { SurfaceControl.Builder makeAnimationLeash(); /** + * @return The parent that should be used for the animation leash. + */ + @Nullable SurfaceControl getAnimationLeashParent(); + + /** * @return The surface of the object to be animated. */ @Nullable SurfaceControl getSurfaceControl(); diff --git a/services/core/java/com/android/server/wm/WindowContainer.java b/services/core/java/com/android/server/wm/WindowContainer.java index b251b53bc051..5d445eff0c92 100644 --- a/services/core/java/com/android/server/wm/WindowContainer.java +++ b/services/core/java/com/android/server/wm/WindowContainer.java @@ -1088,6 +1088,11 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer< return makeSurface(); } + @Override + public SurfaceControl getAnimationLeashParent() { + return getParentSurfaceControl(); + } + /** * @return The layer on which all app animations are happening. */ diff --git a/services/tests/servicestests/src/com/android/server/wm/SurfaceAnimatorTest.java b/services/tests/servicestests/src/com/android/server/wm/SurfaceAnimatorTest.java index 3da560705ef4..6e57f47997fc 100644 --- a/services/tests/servicestests/src/com/android/server/wm/SurfaceAnimatorTest.java +++ b/services/tests/servicestests/src/com/android/server/wm/SurfaceAnimatorTest.java @@ -246,6 +246,11 @@ public class SurfaceAnimatorTest extends WindowTestsBase { } @Override + public SurfaceControl getAnimationLeashParent() { + return mParent; + } + + @Override public SurfaceControl getSurfaceControl() { return mSurface; } |