Check for existing dimming before stop dimming.
Add a test to make sure that we are dimming before we send the message
to stop it. This prevents a CPU consuming loop when dimming is already on.
Fixes bug 6320003.
Change-Id: If26dc5b0800300d8e38c166824651223eded4cfa
diff --git a/services/java/com/android/server/wm/WindowAnimator.java b/services/java/com/android/server/wm/WindowAnimator.java
index 1198a77..0be6612 100644
--- a/services/java/com/android/server/wm/WindowAnimator.java
+++ b/services/java/com/android/server/wm/WindowAnimator.java
@@ -453,7 +453,7 @@
mDimAnimator.updateParameters(mContext.getResources(), mDimParams, mCurrentTime);
}
if (mDimAnimator != null && mDimAnimator.mDimShown) {
- mAnimating |= mDimAnimator.updateSurface(mDimParams != null, mCurrentTime,
+ mAnimating |= mDimAnimator.updateSurface(isDimming(), mCurrentTime,
!mService.okToDisplay());
}
@@ -501,6 +501,10 @@
mService.mH.sendMessage(mService.mH.obtainMessage(SET_DIM_PARAMETERS, null));
}
+ boolean isDimming() {
+ return mDimParams != null;
+ }
+
public void dump(PrintWriter pw, String prefix, boolean dumpAll) {
if (mWindowDetachedWallpaper != null) {
pw.print(" mWindowDetachedWallpaper="); pw.println(mWindowDetachedWallpaper);