private void testWallpaperAndBackgroundLocked() {
    if (mWindowDetachedWallpaper != mDetachedWallpaper) {
      if (WindowManagerService.DEBUG_WALLPAPER)
        Slog.v(
            TAG,
            "Detached wallpaper changed from "
                + mWindowDetachedWallpaper
                + " to "
                + mDetachedWallpaper);
      mWindowDetachedWallpaper = mDetachedWallpaper;
      mBulkUpdateParams |= SET_WALLPAPER_MAY_CHANGE;
    }

    if (mWindowAnimationBackgroundColor != 0) {
      // If the window that wants black is the current wallpaper
      // target, then the black goes *below* the wallpaper so we
      // don't cause the wallpaper to suddenly disappear.
      WindowState target = mWindowAnimationBackground;
      if (mService.mWallpaperTarget == target
          || mService.mLowerWallpaperTarget == target
          || mService.mUpperWallpaperTarget == target) {
        final int N = mService.mWindows.size();
        for (int i = 0; i < N; i++) {
          WindowState w = mService.mWindows.get(i);
          if (w.mIsWallpaper) {
            target = w;
            break;
          }
        }
      }
      if (mWindowAnimationBackgroundSurface == null) {
        mWindowAnimationBackgroundSurface = new DimSurface(mService.mFxSession);
      }
      /**
       * Author: Onskreen Date: 11/23/2012
       *
       * <p>Sets the DimSurface width and height as per panel rect's width/height to restrict the
       * DimSurface anim by not applying the screen width/height.
       */
      final int dw = target.mFrame.width(); // mDw;
      final int dh = target.mFrame.height(); // mDh;
      mWindowAnimationBackgroundSurface.mDimX = target.mFrame.left;
      mWindowAnimationBackgroundSurface.mDimY = target.mFrame.top;

      mWindowAnimationBackgroundSurface.show(
          dw,
          dh,
          target.mWinAnimator.mAnimLayer - WindowManagerService.LAYER_OFFSET_DIM,
          mWindowAnimationBackgroundColor);
    } else if (mWindowAnimationBackgroundSurface != null) {
      mWindowAnimationBackgroundSurface.hide();
    }
  }
 public void dump(PrintWriter pw, String prefix, boolean dumpAll) {
   if (dumpAll) {
     if (mWindowDetachedWallpaper != null) {
       pw.print(prefix);
       pw.print("mWindowDetachedWallpaper=");
       pw.println(mWindowDetachedWallpaper);
     }
     pw.print(prefix);
     pw.print("mAnimTransactionSequence=");
     pw.println(mAnimTransactionSequence);
     if (mWindowAnimationBackgroundSurface != null) {
       pw.print(prefix);
       pw.print("mWindowAnimationBackgroundSurface:");
       mWindowAnimationBackgroundSurface.printTo(prefix + "  ", pw);
     }
     if (mDimAnimator != null) {
       pw.print(prefix);
       pw.print("mDimAnimator:");
       mDimAnimator.printTo(prefix + "  ", pw);
     } else {
       pw.print(prefix);
       pw.print("no DimAnimator ");
     }
   }
 }