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

Commit 698f7f24 authored by Michael Bestas's avatar Michael Bestas Committed by Gerrit Code Review
Browse files

Fix pattern visibility settings (1/2)

Change-Id: Ic627953c5df854c442671a98b5da539b994da18b
parent 22869c18
Loading
Loading
Loading
Loading
+8 −8
Original line number Diff line number Diff line
@@ -1097,20 +1097,20 @@ public class LockPatternUtils {
        setLong(Settings.Secure.LOCK_PATTERN_SIZE, size, UserHandle.USER_CURRENT);
    }

    public void setVisibleDotsEnabled(boolean enabled) {
        setBoolean(Settings.Secure.LOCK_DOTS_VISIBLE, enabled, UserHandle.USER_CURRENT);
    public void setVisibleDotsEnabled(boolean enabled, int userId) {
        setBoolean(Settings.Secure.LOCK_DOTS_VISIBLE, enabled, userId);
    }

    public boolean isVisibleDotsEnabled() {
        return getBoolean(Settings.Secure.LOCK_DOTS_VISIBLE, true, UserHandle.USER_CURRENT);
    public boolean isVisibleDotsEnabled(int userId) {
        return getBoolean(Settings.Secure.LOCK_DOTS_VISIBLE, true, userId);
    }

    public void setShowErrorPath(boolean enabled) {
        setBoolean(Settings.Secure.LOCK_SHOW_ERROR_PATH, enabled, UserHandle.USER_CURRENT);
    public void setShowErrorPath(boolean enabled, int userId) {
        setBoolean(Settings.Secure.LOCK_SHOW_ERROR_PATH, enabled, userId);
    }

    public boolean isShowErrorPath() {
        return getBoolean(Settings.Secure.LOCK_SHOW_ERROR_PATH, true, UserHandle.USER_CURRENT);
    public boolean isShowErrorPath(int userId) {
        return getBoolean(Settings.Secure.LOCK_SHOW_ERROR_PATH, true, userId);
    }

    /**
+18 −17
Original line number Diff line number Diff line
@@ -1149,6 +1149,7 @@ public class LockPatternView extends View {
        currentPath.rewind();

        // draw the circles
        if (mVisibleDots) {
            for (int i = 0; i < mPatternSize; i++) {
                float centerY = getCenterYForRow(i);
                for (int j = 0; j < mPatternSize; j++) {
@@ -1162,7 +1163,7 @@ public class LockPatternView extends View {
                    } else {
                        drawCircle(canvas, (int) centerX, (int) centerY + translationY,
                                cellState.radius, drawLookup[i][j], cellState.alpha);

                    }
                }
            }
        }
@@ -1170,8 +1171,6 @@ public class LockPatternView extends View {
        // TODO: the path should be created and cached every time we hit-detect a cell
        // only the last segment of the path should be computed here
        // draw the path of the pattern (unless we are in stealth mode)
        // draw the path of the pattern (unless the user is in progress, and
        // we are in stealth mode)
        final boolean drawPath = ((!mInStealthMode && mPatternDisplayMode != DisplayMode.Wrong)
                || (mPatternDisplayMode == DisplayMode.Wrong && mShowErrorPath));
        if (drawPath) {
@@ -1231,7 +1230,9 @@ public class LockPatternView extends View {
    }

    private int getCurrentColor(boolean partOfPattern) {
        if (!partOfPattern || mInStealthMode || mPatternInProgress) {
        if (!partOfPattern || (mInStealthMode && mPatternDisplayMode != DisplayMode.Wrong)
                || (mPatternDisplayMode == DisplayMode.Wrong && !mShowErrorPath)
                || mPatternInProgress) {
            // unselected circle
            return mRegularColor;
        } else if (mPatternDisplayMode == DisplayMode.Wrong) {
+4 −2
Original line number Diff line number Diff line
@@ -135,8 +135,10 @@ public class KeyguardPatternView extends LinearLayout implements KeyguardSecurit
        mLockPatternView.setLockPatternUtils(mLockPatternUtils);
        mLockPatternView.setLockPatternSize(mLockPatternUtils.getLockPatternSize());

        mLockPatternView.setVisibleDots(mLockPatternUtils.isVisibleDotsEnabled());
        mLockPatternView.setShowErrorPath(mLockPatternUtils.isShowErrorPath());
        mLockPatternView.setVisibleDots(mLockPatternUtils.isVisibleDotsEnabled(
                KeyguardUpdateMonitor.getCurrentUser()));
        mLockPatternView.setShowErrorPath(mLockPatternUtils.isShowErrorPath(
                KeyguardUpdateMonitor.getCurrentUser()));

        // stealth mode will be the same for the life of this screen
        mLockPatternView.setInStealthMode(!mLockPatternUtils.isVisiblePatternEnabled(