Fixed Dimmer test

Updated code so Dimmer test can now run.

Change-Id: Ie6bebede752ff458732d659f63d5e16d95b5e2e7
Fixes: 72450130
Test: atest FrameworksServicesTests:com.android.server.wm.DimmerTests
diff --git a/services/core/java/com/android/server/wm/Dimmer.java b/services/core/java/com/android/server/wm/Dimmer.java
index 1e7cb24..4394a99 100644
--- a/services/core/java/com/android/server/wm/Dimmer.java
+++ b/services/core/java/com/android/server/wm/Dimmer.java
@@ -129,10 +129,24 @@
      */
     private WindowContainer mHost;
     private WindowContainer mLastRequestedDimContainer;
-    private DimState mDimState;
+    @VisibleForTesting
+    DimState mDimState;
+
+    private final SurfaceAnimatorStarter mSurfaceAnimatorStarter;
+
+    @VisibleForTesting
+    interface SurfaceAnimatorStarter {
+        void startAnimation(SurfaceAnimator surfaceAnimator, SurfaceControl.Transaction t,
+                AnimationAdapter anim, boolean hidden);
+    }
 
     Dimmer(WindowContainer host) {
+        this(host, SurfaceAnimator::startAnimation);
+    }
+
+    Dimmer(WindowContainer host, SurfaceAnimatorStarter surfaceAnimatorStarter) {
         mHost = host;
+        mSurfaceAnimatorStarter = surfaceAnimatorStarter;
     }
 
     private SurfaceControl makeDimLayer() {
@@ -285,7 +299,7 @@
 
     private void startAnim(WindowContainer container, SurfaceAnimator animator,
             SurfaceControl.Transaction t, float startAlpha, float endAlpha) {
-        animator.startAnimation(t, new LocalAnimationAdapter(
+        mSurfaceAnimatorStarter.startAnimation(animator, t, new LocalAnimationAdapter(
                 new AlphaAnimationSpec(startAlpha, endAlpha, getDimDuration(container)),
                 mHost.mService.mSurfaceAnimationRunner), false /* hidden */);
     }