Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f8d4fbb9 authored by Craig Mautner's avatar Craig Mautner
Browse files

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
parent f0cabba3
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -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);
+12 −10
Original line number Diff line number Diff line
@@ -8021,6 +8021,7 @@ public class WindowManagerService extends IWindowManager.Stub
            if (!mInnerFields.mDimming) {
                //Slog.i(TAG, "DIM BEHIND: " + w);
                mInnerFields.mDimming = true;
                if (!mAnimator.isDimming()) {
                    final int width, height;
                    if (attrs.type == WindowManager.LayoutParams.TYPE_BOOT_PROGRESS) {
                        width = mCurDisplayWidth;
@@ -8034,6 +8035,7 @@ public class WindowManagerService extends IWindowManager.Stub
                }
            }
        }
    }

    // "Something has changed!  Let's make it correct now."
    private final void performLayoutAndPlaceSurfacesLockedInner(
@@ -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) {