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

Commit ba3a1233 authored by William Leshner's avatar William Leshner Committed by Android (Google) Code Review
Browse files

Merge "Reduce the jitter offset in dream overlay." into tm-qpr-dev

parents c73df4c5 20c34f3f
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -690,7 +690,7 @@
    <string name="config_communalSourceConnector" translatable="false"></string>

    <!-- How often in milliseconds to jitter the dream overlay in order to avoid burn-in. -->
    <integer name="config_dreamOverlayBurnInProtectionUpdateIntervalMillis">500</integer>
    <integer name="config_dreamOverlayBurnInProtectionUpdateIntervalMillis">1000</integer>

    <!-- How long in milliseconds before full burn-in protection is achieved. -->
    <integer name="config_dreamOverlayMillisUntilFullJitter">240000</integer>
+8 −8
Original line number Diff line number Diff line
@@ -183,22 +183,22 @@ public class DreamOverlayContainerViewController extends ViewController<DreamOve
    }

    private void updateBurnInOffsets() {
        int burnInOffset = mMaxBurnInOffset;

        // Make sure the offset starts at zero, to avoid a big jump in the overlay when it first
        // appears.
        long millisSinceStart = System.currentTimeMillis() - mJitterStartTimeMillis;
        final long millisSinceStart = System.currentTimeMillis() - mJitterStartTimeMillis;
        final int burnInOffset;
        if (millisSinceStart < mMillisUntilFullJitter) {
            float lerpAmount = (float) millisSinceStart / (float) mMillisUntilFullJitter;
            burnInOffset = Math.round(MathUtils.lerp(0f, burnInOffset, lerpAmount));
            burnInOffset = Math.round(MathUtils.lerp(0f, mMaxBurnInOffset, lerpAmount));
        } else {
            burnInOffset = mMaxBurnInOffset;
        }

        // These translation values change slowly, and the set translation methods are idempotent,
        // so no translation occurs when the values don't change.
        int burnInOffsetX = getBurnInOffset(burnInOffset * 2, true)
                - burnInOffset;
        int burnInOffsetY = getBurnInOffset(burnInOffset * 2, false)
                - burnInOffset;
        final int halfBurnInOffset = burnInOffset / 2;
        final int burnInOffsetX = getBurnInOffset(burnInOffset, true) - halfBurnInOffset;
        final int burnInOffsetY = getBurnInOffset(burnInOffset, false) - halfBurnInOffset;
        mView.setTranslationX(burnInOffsetX);
        mView.setTranslationY(burnInOffsetY);