Loading core/java/com/android/internal/widget/LockPatternUtils.java +23 −0 Original line number Diff line number Diff line Loading @@ -170,6 +170,8 @@ public class LockPatternUtils { private static final String LOCK_SCREEN_OWNER_INFO_ENABLED = Settings.Secure.LOCK_SCREEN_OWNER_INFO_ENABLED; private static final String LOCK_PIN_ENHANCED_PRIVACY = "pin_enhanced_privacy"; private static final String LOCK_SCREEN_DEVICE_OWNER_INFO = "lockscreen.device_owner_info"; private static final String ENABLED_TRUST_AGENTS = "lockscreen.enabledtrustagents"; Loading Loading @@ -1036,6 +1038,27 @@ public class LockPatternUtils { return getString(Settings.Secure.LOCK_PATTERN_VISIBLE, userId) != null; } /** * @return Whether enhanced pin privacy is enabled. */ public boolean isPinEnhancedPrivacyEnabled(int userId) { return getBoolean(LOCK_PIN_ENHANCED_PRIVACY, false, userId); } /** * Set whether enhanced pin privacy is enabled. */ public void setPinEnhancedPrivacyEnabled(boolean enabled, int userId) { setBoolean(LOCK_PIN_ENHANCED_PRIVACY, enabled, userId); } /** * @return Whether enhanced pin privacy was ever chosen. */ public boolean isPinEnhancedPrivacyEverChosen(int userId) { return getString(LOCK_PIN_ENHANCED_PRIVACY, userId) != null; } /** * Set whether the visible password is enabled for cryptkeeper screen. */ Loading packages/SettingsProvider/src/com/android/providers/settings/SettingsBackupAgent.java +9 −0 Original line number Diff line number Diff line Loading @@ -182,6 +182,8 @@ public class SettingsBackupAgent extends BackupAgentHelper { "visible_pattern_enabled"; private static final String KEY_LOCK_SETTINGS_POWER_BUTTON_INSTANTLY_LOCKS = "power_button_instantly_locks"; private static final String KEY_LOCK_SETTINGS_PIN_ENHANCED_PRIVACY = "pin_enhanced_privacy"; // Name of the temporary file we use during full backup/restore. This is // stored in the full-backup tarfile as well, so should not be changed. Loading Loading @@ -709,6 +711,10 @@ public class SettingsBackupAgent extends BackupAgentHelper { out.writeUTF(KEY_LOCK_SETTINGS_POWER_BUTTON_INSTANTLY_LOCKS); out.writeUTF(powerButtonInstantlyLocks ? "1" : "0"); } if (lockPatternUtils.isPinEnhancedPrivacyEverChosen(userId)) { out.writeUTF(KEY_LOCK_SETTINGS_PIN_ENHANCED_PRIVACY); out.writeUTF(lockPatternUtils.isPinEnhancedPrivacyEnabled(userId) ? "1" : "0"); } // End marker out.writeUTF(""); out.flush(); Loading Loading @@ -961,6 +967,9 @@ public class SettingsBackupAgent extends BackupAgentHelper { case KEY_LOCK_SETTINGS_POWER_BUTTON_INSTANTLY_LOCKS: lockPatternUtils.setPowerButtonInstantlyLocks("1".equals(value), userId); break; case KEY_LOCK_SETTINGS_PIN_ENHANCED_PRIVACY: lockPatternUtils.setPinEnhancedPrivacyEnabled("1".equals(value), userId); break; } } in.close(); Loading packages/SystemUI/src/com/android/keyguard/KeyguardAbsKeyInputViewController.java +1 −1 Original line number Diff line number Diff line Loading @@ -44,7 +44,7 @@ import java.util.Map; public abstract class KeyguardAbsKeyInputViewController<T extends KeyguardAbsKeyInputView> extends KeyguardInputViewController<T> { private final KeyguardUpdateMonitor mKeyguardUpdateMonitor; private final LockPatternUtils mLockPatternUtils; protected final LockPatternUtils mLockPatternUtils; private final LatencyTracker mLatencyTracker; private final FalsingCollector mFalsingCollector; private final EmergencyButtonController mEmergencyButtonController; Loading packages/SystemUI/src/com/android/keyguard/KeyguardPinBasedInputViewController.java +9 −8 Original line number Diff line number Diff line Loading @@ -71,6 +71,9 @@ public abstract class KeyguardPinBasedInputViewController<T extends KeyguardPinB protected void onViewAttached() { super.onViewAttached(); boolean showAnimations = !mLockPatternUtils .isPinEnhancedPrivacyEnabled(KeyguardUpdateMonitor.getCurrentUser()); mPasswordEntry.setShowPassword(showAnimations); for (NumPadKey button : mView.getButtons()) { button.setOnTouchListener((v, event) -> { if (event.getActionMasked() == MotionEvent.ACTION_DOWN) { Loading @@ -78,6 +81,7 @@ public abstract class KeyguardPinBasedInputViewController<T extends KeyguardPinB } return false; }); button.setAnimationEnabled(showAnimations); } mPasswordEntry.setOnKeyListener(mOnKeyListener); mPasswordEntry.setUserActivityListener(this::onUserInput); Loading @@ -102,13 +106,10 @@ public abstract class KeyguardPinBasedInputViewController<T extends KeyguardPinB View okButton = mView.findViewById(R.id.key_enter); if (okButton != null) { okButton.setOnTouchListener(mActionButtonTouchListener); okButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { okButton.setOnClickListener(v -> { if (mPasswordEntry.isEnabled()) { verifyPasswordAndUnlock(); } } }); okButton.setOnHoverListener(mLiftToActivateListener); } Loading packages/SystemUI/src/com/android/keyguard/NumPadKey.java +10 −2 Original line number Diff line number Diff line Loading @@ -50,6 +50,7 @@ public class NumPadKey extends ViewGroup implements NumPadAnimationListener { private int mDigit = -1; private int mTextViewResId; private PasswordTextView mTextView; private boolean mAnimationsEnabled = true; @Nullable private NumPadAnimator mAnimator; Loading Loading @@ -164,11 +165,11 @@ public class NumPadKey extends ViewGroup implements NumPadAnimationListener { switch(event.getActionMasked()) { case MotionEvent.ACTION_DOWN: doHapticKeyClick(); if (mAnimator != null) mAnimator.expand(); if (mAnimator != null && mAnimationsEnabled) mAnimator.expand(); break; case MotionEvent.ACTION_UP: case MotionEvent.ACTION_CANCEL: if (mAnimator != null) mAnimator.contract(); if (mAnimator != null && mAnimationsEnabled) mAnimator.contract(); break; } return super.onTouchEvent(event); Loading Loading @@ -228,4 +229,11 @@ public class NumPadKey extends ViewGroup implements NumPadAnimationListener { mAnimator.setProgress(progress); } } /** * Controls the animation when a key is pressed */ public void setAnimationEnabled(boolean enabled) { mAnimationsEnabled = enabled; } } Loading
core/java/com/android/internal/widget/LockPatternUtils.java +23 −0 Original line number Diff line number Diff line Loading @@ -170,6 +170,8 @@ public class LockPatternUtils { private static final String LOCK_SCREEN_OWNER_INFO_ENABLED = Settings.Secure.LOCK_SCREEN_OWNER_INFO_ENABLED; private static final String LOCK_PIN_ENHANCED_PRIVACY = "pin_enhanced_privacy"; private static final String LOCK_SCREEN_DEVICE_OWNER_INFO = "lockscreen.device_owner_info"; private static final String ENABLED_TRUST_AGENTS = "lockscreen.enabledtrustagents"; Loading Loading @@ -1036,6 +1038,27 @@ public class LockPatternUtils { return getString(Settings.Secure.LOCK_PATTERN_VISIBLE, userId) != null; } /** * @return Whether enhanced pin privacy is enabled. */ public boolean isPinEnhancedPrivacyEnabled(int userId) { return getBoolean(LOCK_PIN_ENHANCED_PRIVACY, false, userId); } /** * Set whether enhanced pin privacy is enabled. */ public void setPinEnhancedPrivacyEnabled(boolean enabled, int userId) { setBoolean(LOCK_PIN_ENHANCED_PRIVACY, enabled, userId); } /** * @return Whether enhanced pin privacy was ever chosen. */ public boolean isPinEnhancedPrivacyEverChosen(int userId) { return getString(LOCK_PIN_ENHANCED_PRIVACY, userId) != null; } /** * Set whether the visible password is enabled for cryptkeeper screen. */ Loading
packages/SettingsProvider/src/com/android/providers/settings/SettingsBackupAgent.java +9 −0 Original line number Diff line number Diff line Loading @@ -182,6 +182,8 @@ public class SettingsBackupAgent extends BackupAgentHelper { "visible_pattern_enabled"; private static final String KEY_LOCK_SETTINGS_POWER_BUTTON_INSTANTLY_LOCKS = "power_button_instantly_locks"; private static final String KEY_LOCK_SETTINGS_PIN_ENHANCED_PRIVACY = "pin_enhanced_privacy"; // Name of the temporary file we use during full backup/restore. This is // stored in the full-backup tarfile as well, so should not be changed. Loading Loading @@ -709,6 +711,10 @@ public class SettingsBackupAgent extends BackupAgentHelper { out.writeUTF(KEY_LOCK_SETTINGS_POWER_BUTTON_INSTANTLY_LOCKS); out.writeUTF(powerButtonInstantlyLocks ? "1" : "0"); } if (lockPatternUtils.isPinEnhancedPrivacyEverChosen(userId)) { out.writeUTF(KEY_LOCK_SETTINGS_PIN_ENHANCED_PRIVACY); out.writeUTF(lockPatternUtils.isPinEnhancedPrivacyEnabled(userId) ? "1" : "0"); } // End marker out.writeUTF(""); out.flush(); Loading Loading @@ -961,6 +967,9 @@ public class SettingsBackupAgent extends BackupAgentHelper { case KEY_LOCK_SETTINGS_POWER_BUTTON_INSTANTLY_LOCKS: lockPatternUtils.setPowerButtonInstantlyLocks("1".equals(value), userId); break; case KEY_LOCK_SETTINGS_PIN_ENHANCED_PRIVACY: lockPatternUtils.setPinEnhancedPrivacyEnabled("1".equals(value), userId); break; } } in.close(); Loading
packages/SystemUI/src/com/android/keyguard/KeyguardAbsKeyInputViewController.java +1 −1 Original line number Diff line number Diff line Loading @@ -44,7 +44,7 @@ import java.util.Map; public abstract class KeyguardAbsKeyInputViewController<T extends KeyguardAbsKeyInputView> extends KeyguardInputViewController<T> { private final KeyguardUpdateMonitor mKeyguardUpdateMonitor; private final LockPatternUtils mLockPatternUtils; protected final LockPatternUtils mLockPatternUtils; private final LatencyTracker mLatencyTracker; private final FalsingCollector mFalsingCollector; private final EmergencyButtonController mEmergencyButtonController; Loading
packages/SystemUI/src/com/android/keyguard/KeyguardPinBasedInputViewController.java +9 −8 Original line number Diff line number Diff line Loading @@ -71,6 +71,9 @@ public abstract class KeyguardPinBasedInputViewController<T extends KeyguardPinB protected void onViewAttached() { super.onViewAttached(); boolean showAnimations = !mLockPatternUtils .isPinEnhancedPrivacyEnabled(KeyguardUpdateMonitor.getCurrentUser()); mPasswordEntry.setShowPassword(showAnimations); for (NumPadKey button : mView.getButtons()) { button.setOnTouchListener((v, event) -> { if (event.getActionMasked() == MotionEvent.ACTION_DOWN) { Loading @@ -78,6 +81,7 @@ public abstract class KeyguardPinBasedInputViewController<T extends KeyguardPinB } return false; }); button.setAnimationEnabled(showAnimations); } mPasswordEntry.setOnKeyListener(mOnKeyListener); mPasswordEntry.setUserActivityListener(this::onUserInput); Loading @@ -102,13 +106,10 @@ public abstract class KeyguardPinBasedInputViewController<T extends KeyguardPinB View okButton = mView.findViewById(R.id.key_enter); if (okButton != null) { okButton.setOnTouchListener(mActionButtonTouchListener); okButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { okButton.setOnClickListener(v -> { if (mPasswordEntry.isEnabled()) { verifyPasswordAndUnlock(); } } }); okButton.setOnHoverListener(mLiftToActivateListener); } Loading
packages/SystemUI/src/com/android/keyguard/NumPadKey.java +10 −2 Original line number Diff line number Diff line Loading @@ -50,6 +50,7 @@ public class NumPadKey extends ViewGroup implements NumPadAnimationListener { private int mDigit = -1; private int mTextViewResId; private PasswordTextView mTextView; private boolean mAnimationsEnabled = true; @Nullable private NumPadAnimator mAnimator; Loading Loading @@ -164,11 +165,11 @@ public class NumPadKey extends ViewGroup implements NumPadAnimationListener { switch(event.getActionMasked()) { case MotionEvent.ACTION_DOWN: doHapticKeyClick(); if (mAnimator != null) mAnimator.expand(); if (mAnimator != null && mAnimationsEnabled) mAnimator.expand(); break; case MotionEvent.ACTION_UP: case MotionEvent.ACTION_CANCEL: if (mAnimator != null) mAnimator.contract(); if (mAnimator != null && mAnimationsEnabled) mAnimator.contract(); break; } return super.onTouchEvent(event); Loading Loading @@ -228,4 +229,11 @@ public class NumPadKey extends ViewGroup implements NumPadAnimationListener { mAnimator.setProgress(progress); } } /** * Controls the animation when a key is pressed */ public void setAnimationEnabled(boolean enabled) { mAnimationsEnabled = enabled; } }