Loading services/core/java/com/android/server/wm/Dimmer.java +7 −3 Original line number Original line Diff line number Diff line Loading @@ -41,7 +41,7 @@ class Dimmer { private static final int DEFAULT_DIM_ANIM_DURATION = 200; private static final int DEFAULT_DIM_ANIM_DURATION = 200; private class DimAnimatable implements SurfaceAnimator.Animatable { private class DimAnimatable implements SurfaceAnimator.Animatable { private final SurfaceControl mDimLayer; private SurfaceControl mDimLayer; private DimAnimatable(SurfaceControl dimLayer) { private DimAnimatable(SurfaceControl dimLayer) { mDimLayer = dimLayer; mDimLayer = dimLayer; Loading Loading @@ -100,6 +100,11 @@ class Dimmer { // See getSurfaceWidth() above for explanation. // See getSurfaceWidth() above for explanation. return mHost.getSurfaceHeight(); return mHost.getSurfaceHeight(); } } void removeSurface() { getPendingTransaction().remove(mDimLayer); mDimLayer = null; } } } @VisibleForTesting @VisibleForTesting Loading Loading @@ -129,8 +134,7 @@ class Dimmer { final DimAnimatable dimAnimatable = new DimAnimatable(dimLayer); final DimAnimatable dimAnimatable = new DimAnimatable(dimLayer); mSurfaceAnimator = new SurfaceAnimator(dimAnimatable, () -> { mSurfaceAnimator = new SurfaceAnimator(dimAnimatable, () -> { if (!mDimming) { if (!mDimming) { dimAnimatable.getPendingTransaction().remove(mDimLayer); dimAnimatable.removeSurface(); mDimLayer = null; } } }, mHost.mWmService); }, mHost.mWmService); } } Loading services/core/java/com/android/server/wm/SurfaceAnimator.java +6 −2 Original line number Original line Diff line number Diff line Loading @@ -286,9 +286,13 @@ class SurfaceAnimator { final boolean destroy = mLeash != null && surface != null && parent != null; final boolean destroy = mLeash != null && surface != null && parent != null; if (destroy) { if (destroy) { if (DEBUG_ANIM) Slog.i(TAG, "Reparenting to original parent"); if (DEBUG_ANIM) Slog.i(TAG, "Reparenting to original parent"); // We shouldn't really need these isValid checks but we do // b/130364451 if (surface.isValid() && parent.isValid()) { t.reparent(surface, parent); t.reparent(surface, parent); scheduleAnim = true; scheduleAnim = true; } } } mService.mAnimationTransferMap.remove(mAnimation); mService.mAnimationTransferMap.remove(mAnimation); if (mLeash != null && destroyLeash) { if (mLeash != null && destroyLeash) { t.remove(mLeash); t.remove(mLeash); Loading Loading
services/core/java/com/android/server/wm/Dimmer.java +7 −3 Original line number Original line Diff line number Diff line Loading @@ -41,7 +41,7 @@ class Dimmer { private static final int DEFAULT_DIM_ANIM_DURATION = 200; private static final int DEFAULT_DIM_ANIM_DURATION = 200; private class DimAnimatable implements SurfaceAnimator.Animatable { private class DimAnimatable implements SurfaceAnimator.Animatable { private final SurfaceControl mDimLayer; private SurfaceControl mDimLayer; private DimAnimatable(SurfaceControl dimLayer) { private DimAnimatable(SurfaceControl dimLayer) { mDimLayer = dimLayer; mDimLayer = dimLayer; Loading Loading @@ -100,6 +100,11 @@ class Dimmer { // See getSurfaceWidth() above for explanation. // See getSurfaceWidth() above for explanation. return mHost.getSurfaceHeight(); return mHost.getSurfaceHeight(); } } void removeSurface() { getPendingTransaction().remove(mDimLayer); mDimLayer = null; } } } @VisibleForTesting @VisibleForTesting Loading Loading @@ -129,8 +134,7 @@ class Dimmer { final DimAnimatable dimAnimatable = new DimAnimatable(dimLayer); final DimAnimatable dimAnimatable = new DimAnimatable(dimLayer); mSurfaceAnimator = new SurfaceAnimator(dimAnimatable, () -> { mSurfaceAnimator = new SurfaceAnimator(dimAnimatable, () -> { if (!mDimming) { if (!mDimming) { dimAnimatable.getPendingTransaction().remove(mDimLayer); dimAnimatable.removeSurface(); mDimLayer = null; } } }, mHost.mWmService); }, mHost.mWmService); } } Loading
services/core/java/com/android/server/wm/SurfaceAnimator.java +6 −2 Original line number Original line Diff line number Diff line Loading @@ -286,9 +286,13 @@ class SurfaceAnimator { final boolean destroy = mLeash != null && surface != null && parent != null; final boolean destroy = mLeash != null && surface != null && parent != null; if (destroy) { if (destroy) { if (DEBUG_ANIM) Slog.i(TAG, "Reparenting to original parent"); if (DEBUG_ANIM) Slog.i(TAG, "Reparenting to original parent"); // We shouldn't really need these isValid checks but we do // b/130364451 if (surface.isValid() && parent.isValid()) { t.reparent(surface, parent); t.reparent(surface, parent); scheduleAnim = true; scheduleAnim = true; } } } mService.mAnimationTransferMap.remove(mAnimation); mService.mAnimationTransferMap.remove(mAnimation); if (mLeash != null && destroyLeash) { if (mLeash != null && destroyLeash) { t.remove(mLeash); t.remove(mLeash); Loading