Loading services/core/java/com/android/server/wm/Dimmer.java +24 −12 Original line number Diff line number Diff line Loading @@ -22,7 +22,9 @@ import static com.android.server.wm.AlphaAnimationSpecProto.TO; import static com.android.server.wm.AnimationSpecProto.ALPHA; import android.graphics.Rect; import android.util.Log; import android.util.proto.ProtoOutputStream; import android.view.Surface; import android.view.SurfaceControl; import com.android.internal.annotations.VisibleForTesting; Loading Loading @@ -171,15 +173,19 @@ class Dimmer { */ private DimState getDimState(WindowContainer container) { if (mDimState == null) { try { final SurfaceControl ctl = makeDimLayer(); mDimState = new DimState(ctl); /** * See documentation on {@link #dimAbove} to understand lifecycle management of Dim's * via state resetting for Dim's with containers. * See documentation on {@link #dimAbove} to understand lifecycle management of * Dim's via state resetting for Dim's with containers. */ if (container == null) { mDimState.mDontReset = true; } } catch (Surface.OutOfResourcesException e) { Log.w(TAG, "OutOfResourcesException creating dim surface"); } } mLastRequestedDimContainer = container; Loading @@ -189,6 +195,11 @@ class Dimmer { private void dim(SurfaceControl.Transaction t, WindowContainer container, int relativeLayer, float alpha) { final DimState d = getDimState(container); if (d == null) { return; } if (container != null) { // The dim method is called from WindowState.prepareSurfaces(), which is always called // in the correct Z from lowest Z to highest. This ensures that the dim layer is always Loading @@ -208,10 +219,11 @@ class Dimmer { * @param t A Transaction in which to finish the dim. */ void stopDim(SurfaceControl.Transaction t) { DimState d = getDimState(null); t.hide(d.mDimLayer); d.isVisible = false; d.mDontReset = false; if (mDimState != null) { t.hide(mDimState.mDimLayer); mDimState.isVisible = false; mDimState.mDontReset = false; } } /** Loading services/core/java/com/android/server/wm/SurfaceAnimationRunner.java +3 −2 Original line number Diff line number Diff line Loading @@ -206,6 +206,9 @@ class SurfaceAnimationRunner { } } }); a.mAnim = anim; mRunningAnimations.put(a.mLeash, a); anim.start(); if (a.mAnimSpec.canSkipFirstFrame()) { // If we can skip the first frame, we start one frame later. Loading @@ -215,8 +218,6 @@ class SurfaceAnimationRunner { // Immediately start the animation by manually applying an animation frame. Otherwise, the // start time would only be set in the next frame, leading to a delay. anim.doAnimationFrame(mChoreographer.getFrameTime()); a.mAnim = anim; mRunningAnimations.put(a.mLeash, a); } private void applyTransformation(RunningAnimation a, Transaction t, long currentPlayTime) { Loading Loading
services/core/java/com/android/server/wm/Dimmer.java +24 −12 Original line number Diff line number Diff line Loading @@ -22,7 +22,9 @@ import static com.android.server.wm.AlphaAnimationSpecProto.TO; import static com.android.server.wm.AnimationSpecProto.ALPHA; import android.graphics.Rect; import android.util.Log; import android.util.proto.ProtoOutputStream; import android.view.Surface; import android.view.SurfaceControl; import com.android.internal.annotations.VisibleForTesting; Loading Loading @@ -171,15 +173,19 @@ class Dimmer { */ private DimState getDimState(WindowContainer container) { if (mDimState == null) { try { final SurfaceControl ctl = makeDimLayer(); mDimState = new DimState(ctl); /** * See documentation on {@link #dimAbove} to understand lifecycle management of Dim's * via state resetting for Dim's with containers. * See documentation on {@link #dimAbove} to understand lifecycle management of * Dim's via state resetting for Dim's with containers. */ if (container == null) { mDimState.mDontReset = true; } } catch (Surface.OutOfResourcesException e) { Log.w(TAG, "OutOfResourcesException creating dim surface"); } } mLastRequestedDimContainer = container; Loading @@ -189,6 +195,11 @@ class Dimmer { private void dim(SurfaceControl.Transaction t, WindowContainer container, int relativeLayer, float alpha) { final DimState d = getDimState(container); if (d == null) { return; } if (container != null) { // The dim method is called from WindowState.prepareSurfaces(), which is always called // in the correct Z from lowest Z to highest. This ensures that the dim layer is always Loading @@ -208,10 +219,11 @@ class Dimmer { * @param t A Transaction in which to finish the dim. */ void stopDim(SurfaceControl.Transaction t) { DimState d = getDimState(null); t.hide(d.mDimLayer); d.isVisible = false; d.mDontReset = false; if (mDimState != null) { t.hide(mDimState.mDimLayer); mDimState.isVisible = false; mDimState.mDontReset = false; } } /** Loading
services/core/java/com/android/server/wm/SurfaceAnimationRunner.java +3 −2 Original line number Diff line number Diff line Loading @@ -206,6 +206,9 @@ class SurfaceAnimationRunner { } } }); a.mAnim = anim; mRunningAnimations.put(a.mLeash, a); anim.start(); if (a.mAnimSpec.canSkipFirstFrame()) { // If we can skip the first frame, we start one frame later. Loading @@ -215,8 +218,6 @@ class SurfaceAnimationRunner { // Immediately start the animation by manually applying an animation frame. Otherwise, the // start time would only be set in the next frame, leading to a delay. anim.doAnimationFrame(mChoreographer.getFrameTime()); a.mAnim = anim; mRunningAnimations.put(a.mLeash, a); } private void applyTransformation(RunningAnimation a, Transaction t, long currentPlayTime) { Loading