Android Security PIN 相关代码

2023-12-27 16:58:28

开发项目遇到一个问题,具体描述及复制步骤如下:

就是开启"Enhanced PIN privacy"(增强的PIN隐私)的时候输入秘密的时候还是会显示数字
如下图,应该是直接是“.” 不应该出现PIN 密码

想要的效果如下图:

设置的步骤如下图:

其中涉及到的部分code如下:

/frameworks/base/core/java/com/android/internal/widget/LockPatternUtils.java
/frameworks/base/packages/SystemUI/src/com/android/keyguard/KeyguardPinBasedInputViewController.java

/frameworks/base/packages/SystemUI/src/com/android/keyguard/PasswordTextView.java

/frameworks/base/services/core/java/com/android/server/locksettings/LockSettingsStorage.java

I.LockPatternUtils.java:

/**
     * @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);
    }

private boolean getBoolean(String secureSettingKey, boolean defaultValue, int userId) {
        Log.i("TD","LockPatternUtils----->getBoolean: "+secureSettingKey);
        try {
            return getLockSettings().getBoolean(secureSettingKey, defaultValue, userId);
        } catch (RemoteException re) {
            return defaultValue;
        }
    }

    private void setBoolean(String secureSettingKey, boolean enabled, int userId) {
        Log.i("TD","LockPatternUtils----->setsetBoolean: "+secureSettingKey);
        try {
            getLockSettings().setBoolean(secureSettingKey, enabled, userId);
        } catch (R

文章来源:https://blog.csdn.net/Leif_dong/article/details/135246625
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。