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

Commit e9aa87b2 authored by Robert Snoeberger's avatar Robert Snoeberger
Browse files

Remove burn in offset on lock screen.

Due to the burn in offset applied to the analog clock, it can overlap
with "At a Glance" and the lock screen message. This change helps a
little bit by removing the offset on the lock screen, which hides
more of the clock face under the notifications.

Note also that the burn in offset is removed from the default clock
face on the lock screen. So, this change is consistent with that
behavior.

Fixes: 131122783
Test: visual -- analog clock moves to screen center on lock screen.
Change-Id: Ie57bb0b5a41215d4f1b478aeb691e07eac125614
parent b9a891b7
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -189,6 +189,7 @@ public class AnalogClockController implements ClockPlugin {
    @Override
    public void setDarkAmount(float darkAmount) {
        mClockPosition.setDarkAmount(darkAmount);
        mBigClockView.setDarkAmount(darkAmount);
    }

    @Override
+1 −0
Original line number Diff line number Diff line
@@ -181,6 +181,7 @@ public class BubbleClockController implements ClockPlugin {
    @Override
    public void setDarkAmount(float darkAmount) {
        mClockPosition.setDarkAmount(darkAmount);
        mView.setDarkAmount(darkAmount);
    }

    @Override
+17 −4
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import static com.android.systemui.doze.util.BurnInHelperKt.getBurnInOffset;
import android.content.Context;
import android.content.res.Resources;
import android.util.AttributeSet;
import android.util.MathUtils;
import android.view.View;
import android.widget.FrameLayout;

@@ -43,6 +44,8 @@ public class ClockLayout extends FrameLayout {
    private int mBurnInPreventionOffsetX;
    private int mBurnInPreventionOffsetY;

    private float mDarkAmount;

    public ClockLayout(Context context) {
        this(context, null);
    }
@@ -78,11 +81,21 @@ public class ClockLayout extends FrameLayout {
        positionChildren();
    }

    /**
     * See {@link com.android.systemui.plugins.ClockPlugin#setDarkAmount(float)}.
     */
    void setDarkAmount(float darkAmount) {
        mDarkAmount = darkAmount;
        positionChildren();
    }

    private void positionChildren() {
        final float offsetX = getBurnInOffset(mBurnInPreventionOffsetX * 2, true)
                - mBurnInPreventionOffsetX;
        final float offsetY = getBurnInOffset(mBurnInPreventionOffsetY * 2, false)
                - mBurnInPreventionOffsetY;
        final float offsetX = MathUtils.lerp(0f,
                getBurnInOffset(mBurnInPreventionOffsetX * 2, true) - mBurnInPreventionOffsetX,
                mDarkAmount);
        final float offsetY = MathUtils.lerp(0f,
                getBurnInOffset(mBurnInPreventionOffsetY * 2, false) - mBurnInPreventionOffsetY,
                mDarkAmount);

        // Put the analog clock in the middle of the screen.
        if (mAnalogClock != null) {