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

Commit 0fbe37c1 authored by Steve Kondik's avatar Steve Kondik
Browse files

power: Fix power animation toggles

Screen lights should fade if the option for the animation is not set.
Also make the defaults configurable for devices which have issues with
this.

Change-Id: Ib1fe8fa6207b3e843f06c8753ef2948f9fd8f0a5
parent a12f587d
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -381,4 +381,10 @@
    <!-- Allows the light sensor to be ignored when flashlight is on -->
    <bool name="config_flashlight_affects_lightsensor">false</bool>

    <!-- Enable the screen-on animation -->
    <bool name="config_enableScreenOnAnimation">false</bool>

    <!-- Enable the screen-off animation -->
    <bool name="config_enableScreenOffAnimation">true</bool>

</resources>
+11 −3
Original line number Diff line number Diff line
@@ -508,9 +508,13 @@ class PowerManagerService extends IPowerManager.Stub
                setScreenOffTimeoutsLocked();

                mElectronBeamAnimationOn = Settings.System.getInt(mContext.getContentResolver(),
                                                          ELECTRON_BEAM_ANIMATION_ON, 0) == 1;
                            ELECTRON_BEAM_ANIMATION_ON,
                            mContext.getResources().getBoolean(
                                    com.android.internal.R.bool.config_enableScreenOnAnimation) ? 1 : 0) == 1;
                mElectronBeamAnimationOff = Settings.System.getInt(mContext.getContentResolver(),
                                                          ELECTRON_BEAM_ANIMATION_OFF, 1) == 1;
                            ELECTRON_BEAM_ANIMATION_OFF,
                            mContext.getResources().getBoolean(
                                    com.android.internal.R.bool.config_enableScreenOffAnimation) ? 1 : 0) == 1;

                final float windowScale = getFloat(WINDOW_ANIMATION_SCALE, 1.0f);
                final float transitionScale = getFloat(TRANSITION_ANIMATION_SCALE, 1.0f);
@@ -2112,7 +2116,11 @@ class PowerManagerService extends IPowerManager.Stub
        }

        public void run() {
            if (mAnimateScreenLights) {
            if (mAnimateScreenLights ||
                    (!mAnimateScreenLights && Settings.System.getInt(mContext.getContentResolver(),
                            ELECTRON_BEAM_ANIMATION_OFF,
                            mContext.getResources().getBoolean(
                                    com.android.internal.R.bool.config_enableScreenOffAnimation) ? 1 : 0) == 0)) {
                synchronized (mLocks) {
                    long now = SystemClock.uptimeMillis();
                    boolean more = mScreenBrightness.stepLocked();