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
This commit is contained in:
Craig Mautner
2012-04-11 09:25:53 -07:00
parent f0cabba38b
commit f8d4fbb9c8
2 changed files with 17 additions and 11 deletions

View File

@ -453,7 +453,7 @@ public class WindowAnimator {
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 @@ public class WindowAnimator {
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);

View File

@ -8021,16 +8021,18 @@ public class WindowManagerService extends IWindowManager.Stub
if (!mInnerFields.mDimming) {
//Slog.i(TAG, "DIM BEHIND: " + w);
mInnerFields.mDimming = true;
final int width, height;
if (attrs.type == WindowManager.LayoutParams.TYPE_BOOT_PROGRESS) {
width = mCurDisplayWidth;
height = mCurDisplayHeight;
} else {
width = innerDw;
height = innerDh;
if (!mAnimator.isDimming()) {
final int width, height;
if (attrs.type == WindowManager.LayoutParams.TYPE_BOOT_PROGRESS) {
width = mCurDisplayWidth;
height = mCurDisplayHeight;
} else {
width = innerDw;
height = innerDh;
}
mAnimator.startDimming(w.mWinAnimator, w.mExiting ? 0 : w.mAttrs.dimAmount,
width, height);
}
mAnimator.startDimming(w.mWinAnimator, w.mExiting ? 0 : w.mAttrs.dimAmount,
width, height);
}
}
}
@ -8180,7 +8182,7 @@ public class WindowManagerService extends IWindowManager.Stub
updateWallpaperVisibilityLocked();
}
}
if (!mInnerFields.mDimming && mAnimator.mDimParams != null) {
if (!mInnerFields.mDimming && mAnimator.isDimming()) {
mAnimator.stopDimming();
}
} catch (RuntimeException e) {