diff options
author | Ricardo Cerqueira <cyanogenmod@cerqueira.org> | 2013-03-04 10:34:23 -0800 |
---|---|---|
committer | Gerrit Code Review <gerrit@cyanogenmod.org> | 2013-03-04 10:34:23 -0800 |
commit | c9b0de8a7fce5948d2e7aabecfcd392f6eaddcec (patch) | |
tree | fdc6b88cba6b153162d6f06ae50d5acd434d9885 | |
parent | b58457906bc916e367f50c537f65bdd6dc28b429 (diff) | |
parent | 949758a060bf9c710b2696bdc9859d236f1167d2 (diff) | |
download | frameworks_base-c9b0de8a7fce5948d2e7aabecfcd392f6eaddcec.zip frameworks_base-c9b0de8a7fce5948d2e7aabecfcd392f6eaddcec.tar.gz frameworks_base-c9b0de8a7fce5948d2e7aabecfcd392f6eaddcec.tar.bz2 |
Merge "LockscreenPattern : Toggle dots/error pattern visibility (1/2)" into cm-10.1
6 files changed, 83 insertions, 6 deletions
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java index 2a38376..1df6048 100644 --- a/core/java/android/provider/Settings.java +++ b/core/java/android/provider/Settings.java @@ -900,6 +900,8 @@ public final class Settings { MOVED_TO_SECURE.add(Secure.LOCK_BIOMETRIC_WEAK_FLAGS); MOVED_TO_SECURE.add(Secure.LOCK_PATTERN_ENABLED); MOVED_TO_SECURE.add(Secure.LOCK_PATTERN_VISIBLE); + MOVED_TO_SECURE.add(Secure.LOCK_SHOW_ERROR_PATH); + MOVED_TO_SECURE.add(Secure.LOCK_DOTS_VISIBLE); MOVED_TO_SECURE.add(Secure.LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED); MOVED_TO_SECURE.add(Secure.LOGGING_ID); MOVED_TO_SECURE.add(Secure.PARENTAL_CONTROL_ENABLED); @@ -3367,6 +3369,8 @@ public final class Settings { MOVED_TO_LOCK_SETTINGS = new HashSet<String>(3); MOVED_TO_LOCK_SETTINGS.add(Secure.LOCK_PATTERN_ENABLED); MOVED_TO_LOCK_SETTINGS.add(Secure.LOCK_PATTERN_VISIBLE); + MOVED_TO_LOCK_SETTINGS.add(Secure.LOCK_SHOW_ERROR_PATH); + MOVED_TO_LOCK_SETTINGS.add(Secure.LOCK_DOTS_VISIBLE); MOVED_TO_LOCK_SETTINGS.add(Secure.LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED); MOVED_TO_GLOBAL = new HashSet<String>(); @@ -4004,6 +4008,16 @@ public final class Settings { LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED = "lock_pattern_tactile_feedback_enabled"; /** + * Whether lock pattern will show dots (0 = false, 1 = true) + */ + public static final String LOCK_DOTS_VISIBLE = "lock_pattern_dotsvisible"; + + /** + * Whether lockscreen error pattern is visible (0 = false, 1 = true) + */ + public static final String LOCK_SHOW_ERROR_PATH = "lock_pattern_show_error_path"; + + /** * This preference allows the device to be locked given time after screen goes off, * subject to current DeviceAdmin policy limits. * @hide diff --git a/core/java/com/android/internal/widget/LockPatternUtils.java b/core/java/com/android/internal/widget/LockPatternUtils.java index a381ae9..8961150 100644 --- a/core/java/com/android/internal/widget/LockPatternUtils.java +++ b/core/java/com/android/internal/widget/LockPatternUtils.java @@ -986,6 +986,22 @@ public class LockPatternUtils { setLong(Settings.Secure.LOCK_PATTERN_SIZE, size); } + public void setVisibleDotsEnabled(boolean enabled) { + setBoolean(Settings.Secure.LOCK_DOTS_VISIBLE, enabled); + } + + public boolean isVisibleDotsEnabled() { + return getBoolean(Settings.Secure.LOCK_DOTS_VISIBLE, true); + } + + public void setShowErrorPath(boolean enabled) { + setBoolean(Settings.Secure.LOCK_SHOW_ERROR_PATH, enabled); + } + + public boolean isShowErrorPath() { + return getBoolean(Settings.Secure.LOCK_SHOW_ERROR_PATH, true); + } + /** * Set and store the lockout deadline, meaning the user can't attempt his/her unlock * pattern until the deadline has passed. diff --git a/core/java/com/android/internal/widget/LockPatternView.java b/core/java/com/android/internal/widget/LockPatternView.java index 703f544..3a1bc92 100644 --- a/core/java/com/android/internal/widget/LockPatternView.java +++ b/core/java/com/android/internal/widget/LockPatternView.java @@ -101,6 +101,8 @@ public class LockPatternView extends View { private boolean mInStealthMode = false; private boolean mEnableHapticFeedback = true; private boolean mPatternInProgress = false; + private boolean mVisibleDots = true; + private boolean mShowErrorPath = true; private float mDiameterFactor = 0.10f; // TODO: move to attrs private final int mStrokeAlpha = 128; @@ -329,6 +331,22 @@ public class LockPatternView extends View { mInStealthMode = inStealthMode; } + public void setVisibleDots(boolean visibleDots) { + mVisibleDots = visibleDots; + } + + public boolean isVisibleDots() { + return mVisibleDots; + } + + public void setShowErrorPath(boolean showErrorPath) { + mShowErrorPath = showErrorPath; + } + + public boolean isShowErrorPath() { + return mShowErrorPath; + } + /** * Set whether the view will use tactile feedback. If true, there will be * tactile feedback as the user enters the pattern. @@ -964,7 +982,8 @@ public class LockPatternView extends View { // only the last segment of the path should be computed here // 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); + final boolean drawPath = ((!mInStealthMode && mPatternDisplayMode != DisplayMode.Wrong) + || (mPatternDisplayMode == DisplayMode.Wrong && mShowErrorPath)); // draw the arrows associated with the path (unless the user is in progress, and // we are in stealth mode) @@ -1067,8 +1086,11 @@ public class LockPatternView extends View { private void drawCircle(Canvas canvas, int leftX, int topY, boolean partOfPattern) { Bitmap outerCircle; Bitmap innerCircle; - - if (!partOfPattern || (mInStealthMode && mPatternDisplayMode != DisplayMode.Wrong)) { + if (!partOfPattern || (mInStealthMode && mPatternDisplayMode != DisplayMode.Wrong) + || (mPatternDisplayMode == DisplayMode.Wrong && !mShowErrorPath)) { + if (!mVisibleDots) { + return; + } // unselected circle outerCircle = mBitmapCircleDefault; innerCircle = mBitmapBtnDefault; @@ -1117,7 +1139,7 @@ public class LockPatternView extends View { return new SavedState(superState, mLockPatternUtils.patternToString(mPattern), mPatternDisplayMode.ordinal(), mPatternSize, - mInputEnabled, mInStealthMode, mEnableHapticFeedback); + mInputEnabled, mInStealthMode, mEnableHapticFeedback, mVisibleDots, mShowErrorPath); } @Override @@ -1132,6 +1154,8 @@ public class LockPatternView extends View { mInputEnabled = ss.isInputEnabled(); mInStealthMode = ss.isInStealthMode(); mEnableHapticFeedback = ss.isTactileFeedbackEnabled(); + mVisibleDots = ss.isVisibleDots(); + mShowErrorPath = ss.isShowErrorPath(); } /** @@ -1145,13 +1169,15 @@ public class LockPatternView extends View { private final boolean mInputEnabled; private final boolean mInStealthMode; private final boolean mTactileFeedbackEnabled; + private final boolean mVisibleDots; + private final boolean mShowErrorPath; /** * Constructor called from {@link LockPatternView#onSaveInstanceState()} */ private SavedState(Parcelable superState, String serializedPattern, int displayMode, byte patternSize, boolean inputEnabled, boolean inStealthMode, - boolean tactileFeedbackEnabled) { + boolean tactileFeedbackEnabled, boolean visibleDots, boolean showErrorPath) { super(superState); mSerializedPattern = serializedPattern; mDisplayMode = displayMode; @@ -1159,6 +1185,8 @@ public class LockPatternView extends View { mInputEnabled = inputEnabled; mInStealthMode = inStealthMode; mTactileFeedbackEnabled = tactileFeedbackEnabled; + mVisibleDots = visibleDots; + mShowErrorPath = showErrorPath; } /** @@ -1172,6 +1200,8 @@ public class LockPatternView extends View { mInputEnabled = (Boolean) in.readValue(null); mInStealthMode = (Boolean) in.readValue(null); mTactileFeedbackEnabled = (Boolean) in.readValue(null); + mVisibleDots = (Boolean) in.readValue(null); + mShowErrorPath = (Boolean) in.readValue(null); } public String getSerializedPattern() { @@ -1198,6 +1228,14 @@ public class LockPatternView extends View { return mTactileFeedbackEnabled; } + public boolean isVisibleDots() { + return mVisibleDots; + } + + public boolean isShowErrorPath() { + return mShowErrorPath; + } + @Override public void writeToParcel(Parcel dest, int flags) { super.writeToParcel(dest, flags); @@ -1207,6 +1245,8 @@ public class LockPatternView extends View { dest.writeValue(mInputEnabled); dest.writeValue(mInStealthMode); dest.writeValue(mTactileFeedbackEnabled); + dest.writeValue(mVisibleDots); + dest.writeValue(mShowErrorPath); } public static final Parcelable.Creator<SavedState> CREATOR = diff --git a/core/java/com/android/internal/widget/LockSettingsService.java b/core/java/com/android/internal/widget/LockSettingsService.java index 4973627..cae772e 100644 --- a/core/java/com/android/internal/widget/LockSettingsService.java +++ b/core/java/com/android/internal/widget/LockSettingsService.java @@ -427,6 +427,8 @@ public class LockSettingsService extends ILockSettings.Stub { Secure.LOCK_PATTERN_ENABLED, Secure.LOCK_BIOMETRIC_WEAK_FLAGS, Secure.LOCK_PATTERN_VISIBLE, - Secure.LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED + Secure.LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED, + Secure.LOCK_SHOW_ERROR_PATH, + Secure.LOCK_DOTS_VISIBLE }; } diff --git a/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java b/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java index 7309958..289f9cc 100644 --- a/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java +++ b/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java @@ -678,6 +678,8 @@ public class DatabaseHelper extends SQLiteOpenHelper { String[] settingsToMove = { Secure.LOCK_PATTERN_ENABLED, Secure.LOCK_PATTERN_VISIBLE, + Secure.LOCK_SHOW_ERROR_PATH, + Secure.LOCK_DOTS_VISIBLE, Secure.LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED, "lockscreen.password_type", "lockscreen.lockoutattemptdeadline", diff --git a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardPatternView.java b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardPatternView.java index 8f4414e..14ef93e 100644 --- a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardPatternView.java +++ b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardPatternView.java @@ -123,6 +123,9 @@ public class KeyguardPatternView extends LinearLayout implements KeyguardSecurit mLockPatternView.setOnPatternListener(new UnlockPatternListener()); mLockPatternView.setLockPatternUtils(mLockPatternUtils); + mLockPatternView.setVisibleDots(mLockPatternUtils.isVisibleDotsEnabled()); + mLockPatternView.setShowErrorPath(mLockPatternUtils.isShowErrorPath()); + // stealth mode will be the same for the life of this screen mLockPatternView.setInStealthMode(!mLockPatternUtils.isVisiblePatternEnabled()); |