Merge "Add setting to disable PIN animation and password" into tm-qpr-dev am: ba2410e972
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/21372798 Change-Id: I434fc978e1bca9c0e3b625c148ea39b4ff3abfd1 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -170,6 +170,8 @@ public class LockPatternUtils {
|
|||||||
private static final String LOCK_SCREEN_OWNER_INFO_ENABLED =
|
private static final String LOCK_SCREEN_OWNER_INFO_ENABLED =
|
||||||
Settings.Secure.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 LOCK_SCREEN_DEVICE_OWNER_INFO = "lockscreen.device_owner_info";
|
||||||
|
|
||||||
private static final String ENABLED_TRUST_AGENTS = "lockscreen.enabledtrustagents";
|
private static final String ENABLED_TRUST_AGENTS = "lockscreen.enabledtrustagents";
|
||||||
@@ -998,6 +1000,27 @@ public class LockPatternUtils {
|
|||||||
return getString(Settings.Secure.LOCK_PATTERN_VISIBLE, userId) != null;
|
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.
|
* Set whether the visible password is enabled for cryptkeeper screen.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -182,6 +182,8 @@ public class SettingsBackupAgent extends BackupAgentHelper {
|
|||||||
"visible_pattern_enabled";
|
"visible_pattern_enabled";
|
||||||
private static final String KEY_LOCK_SETTINGS_POWER_BUTTON_INSTANTLY_LOCKS =
|
private static final String KEY_LOCK_SETTINGS_POWER_BUTTON_INSTANTLY_LOCKS =
|
||||||
"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
|
// 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.
|
// stored in the full-backup tarfile as well, so should not be changed.
|
||||||
@@ -709,6 +711,10 @@ public class SettingsBackupAgent extends BackupAgentHelper {
|
|||||||
out.writeUTF(KEY_LOCK_SETTINGS_POWER_BUTTON_INSTANTLY_LOCKS);
|
out.writeUTF(KEY_LOCK_SETTINGS_POWER_BUTTON_INSTANTLY_LOCKS);
|
||||||
out.writeUTF(powerButtonInstantlyLocks ? "1" : "0");
|
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
|
// End marker
|
||||||
out.writeUTF("");
|
out.writeUTF("");
|
||||||
out.flush();
|
out.flush();
|
||||||
@@ -961,6 +967,9 @@ public class SettingsBackupAgent extends BackupAgentHelper {
|
|||||||
case KEY_LOCK_SETTINGS_POWER_BUTTON_INSTANTLY_LOCKS:
|
case KEY_LOCK_SETTINGS_POWER_BUTTON_INSTANTLY_LOCKS:
|
||||||
lockPatternUtils.setPowerButtonInstantlyLocks("1".equals(value), userId);
|
lockPatternUtils.setPowerButtonInstantlyLocks("1".equals(value), userId);
|
||||||
break;
|
break;
|
||||||
|
case KEY_LOCK_SETTINGS_PIN_ENHANCED_PRIVACY:
|
||||||
|
lockPatternUtils.setPinEnhancedPrivacyEnabled("1".equals(value), userId);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
in.close();
|
in.close();
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ import java.util.Map;
|
|||||||
public abstract class KeyguardAbsKeyInputViewController<T extends KeyguardAbsKeyInputView>
|
public abstract class KeyguardAbsKeyInputViewController<T extends KeyguardAbsKeyInputView>
|
||||||
extends KeyguardInputViewController<T> {
|
extends KeyguardInputViewController<T> {
|
||||||
private final KeyguardUpdateMonitor mKeyguardUpdateMonitor;
|
private final KeyguardUpdateMonitor mKeyguardUpdateMonitor;
|
||||||
private final LockPatternUtils mLockPatternUtils;
|
protected final LockPatternUtils mLockPatternUtils;
|
||||||
private final LatencyTracker mLatencyTracker;
|
private final LatencyTracker mLatencyTracker;
|
||||||
private final FalsingCollector mFalsingCollector;
|
private final FalsingCollector mFalsingCollector;
|
||||||
private final EmergencyButtonController mEmergencyButtonController;
|
private final EmergencyButtonController mEmergencyButtonController;
|
||||||
|
|||||||
@@ -71,6 +71,9 @@ public abstract class KeyguardPinBasedInputViewController<T extends KeyguardPinB
|
|||||||
protected void onViewAttached() {
|
protected void onViewAttached() {
|
||||||
super.onViewAttached();
|
super.onViewAttached();
|
||||||
|
|
||||||
|
boolean showAnimations = !mLockPatternUtils
|
||||||
|
.isPinEnhancedPrivacyEnabled(KeyguardUpdateMonitor.getCurrentUser());
|
||||||
|
mPasswordEntry.setShowPassword(showAnimations);
|
||||||
for (NumPadKey button : mView.getButtons()) {
|
for (NumPadKey button : mView.getButtons()) {
|
||||||
button.setOnTouchListener((v, event) -> {
|
button.setOnTouchListener((v, event) -> {
|
||||||
if (event.getActionMasked() == MotionEvent.ACTION_DOWN) {
|
if (event.getActionMasked() == MotionEvent.ACTION_DOWN) {
|
||||||
@@ -78,6 +81,7 @@ public abstract class KeyguardPinBasedInputViewController<T extends KeyguardPinB
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
button.setAnimationEnabled(showAnimations);
|
||||||
}
|
}
|
||||||
mPasswordEntry.setOnKeyListener(mOnKeyListener);
|
mPasswordEntry.setOnKeyListener(mOnKeyListener);
|
||||||
mPasswordEntry.setUserActivityListener(this::onUserInput);
|
mPasswordEntry.setUserActivityListener(this::onUserInput);
|
||||||
@@ -102,13 +106,10 @@ public abstract class KeyguardPinBasedInputViewController<T extends KeyguardPinB
|
|||||||
View okButton = mView.findViewById(R.id.key_enter);
|
View okButton = mView.findViewById(R.id.key_enter);
|
||||||
if (okButton != null) {
|
if (okButton != null) {
|
||||||
okButton.setOnTouchListener(mActionButtonTouchListener);
|
okButton.setOnTouchListener(mActionButtonTouchListener);
|
||||||
okButton.setOnClickListener(new View.OnClickListener() {
|
okButton.setOnClickListener(v -> {
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
if (mPasswordEntry.isEnabled()) {
|
if (mPasswordEntry.isEnabled()) {
|
||||||
verifyPasswordAndUnlock();
|
verifyPasswordAndUnlock();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
});
|
});
|
||||||
okButton.setOnHoverListener(mLiftToActivateListener);
|
okButton.setOnHoverListener(mLiftToActivateListener);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ public class NumPadKey extends ViewGroup implements NumPadAnimationListener {
|
|||||||
private int mDigit = -1;
|
private int mDigit = -1;
|
||||||
private int mTextViewResId;
|
private int mTextViewResId;
|
||||||
private PasswordTextView mTextView;
|
private PasswordTextView mTextView;
|
||||||
|
private boolean mAnimationsEnabled = true;
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
private NumPadAnimator mAnimator;
|
private NumPadAnimator mAnimator;
|
||||||
@@ -164,11 +165,11 @@ public class NumPadKey extends ViewGroup implements NumPadAnimationListener {
|
|||||||
switch(event.getActionMasked()) {
|
switch(event.getActionMasked()) {
|
||||||
case MotionEvent.ACTION_DOWN:
|
case MotionEvent.ACTION_DOWN:
|
||||||
doHapticKeyClick();
|
doHapticKeyClick();
|
||||||
if (mAnimator != null) mAnimator.expand();
|
if (mAnimator != null && mAnimationsEnabled) mAnimator.expand();
|
||||||
break;
|
break;
|
||||||
case MotionEvent.ACTION_UP:
|
case MotionEvent.ACTION_UP:
|
||||||
case MotionEvent.ACTION_CANCEL:
|
case MotionEvent.ACTION_CANCEL:
|
||||||
if (mAnimator != null) mAnimator.contract();
|
if (mAnimator != null && mAnimationsEnabled) mAnimator.contract();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return super.onTouchEvent(event);
|
return super.onTouchEvent(event);
|
||||||
@@ -228,4 +229,11 @@ public class NumPadKey extends ViewGroup implements NumPadAnimationListener {
|
|||||||
mAnimator.setProgress(progress);
|
mAnimator.setProgress(progress);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Controls the animation when a key is pressed
|
||||||
|
*/
|
||||||
|
public void setAnimationEnabled(boolean enabled) {
|
||||||
|
mAnimationsEnabled = enabled;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ import android.graphics.Rect;
|
|||||||
import android.graphics.Typeface;
|
import android.graphics.Typeface;
|
||||||
import android.os.PowerManager;
|
import android.os.PowerManager;
|
||||||
import android.os.SystemClock;
|
import android.os.SystemClock;
|
||||||
import android.provider.Settings;
|
|
||||||
import android.text.InputType;
|
import android.text.InputType;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
@@ -98,7 +97,7 @@ public class PasswordTextView extends View {
|
|||||||
private Interpolator mAppearInterpolator;
|
private Interpolator mAppearInterpolator;
|
||||||
private Interpolator mDisappearInterpolator;
|
private Interpolator mDisappearInterpolator;
|
||||||
private Interpolator mFastOutSlowInInterpolator;
|
private Interpolator mFastOutSlowInInterpolator;
|
||||||
private boolean mShowPassword;
|
private boolean mShowPassword = true;
|
||||||
private UserActivityListener mUserActivityListener;
|
private UserActivityListener mUserActivityListener;
|
||||||
|
|
||||||
public interface UserActivityListener {
|
public interface UserActivityListener {
|
||||||
@@ -152,8 +151,6 @@ public class PasswordTextView extends View {
|
|||||||
mDrawPaint.setTypeface(Typeface.create(
|
mDrawPaint.setTypeface(Typeface.create(
|
||||||
context.getString(com.android.internal.R.string.config_headlineFontFamily),
|
context.getString(com.android.internal.R.string.config_headlineFontFamily),
|
||||||
0));
|
0));
|
||||||
mShowPassword = Settings.System.getInt(mContext.getContentResolver(),
|
|
||||||
Settings.System.TEXT_SHOW_PASSWORD, 1) == 1;
|
|
||||||
mAppearInterpolator = AnimationUtils.loadInterpolator(mContext,
|
mAppearInterpolator = AnimationUtils.loadInterpolator(mContext,
|
||||||
android.R.interpolator.linear_out_slow_in);
|
android.R.interpolator.linear_out_slow_in);
|
||||||
mDisappearInterpolator = AnimationUtils.loadInterpolator(mContext,
|
mDisappearInterpolator = AnimationUtils.loadInterpolator(mContext,
|
||||||
@@ -385,6 +382,13 @@ public class PasswordTextView extends View {
|
|||||||
info.setInputType(InputType.TYPE_NUMBER_VARIATION_PASSWORD);
|
info.setInputType(InputType.TYPE_NUMBER_VARIATION_PASSWORD);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Controls whether the last entered digit is briefly shown after being entered
|
||||||
|
*/
|
||||||
|
public void setShowPassword(boolean enabled) {
|
||||||
|
mShowPassword = enabled;
|
||||||
|
}
|
||||||
|
|
||||||
private class CharState {
|
private class CharState {
|
||||||
char whichChar;
|
char whichChar;
|
||||||
ValueAnimator textAnimator;
|
ValueAnimator textAnimator;
|
||||||
|
|||||||
Reference in New Issue
Block a user