先找到源码设置中安全界面的XML布局文件 \\192.168.1.112\jiangdou_w2\rk3188_5.1_mid\packages\apps\Settings\res\xml\security_settings_misc.xml <PreferenceCategory android:title="@string/security_passwords_title" android:persistent="false">
<SwitchPreference android:key="show_password" android:title="@string/show_password" android:persistent="false"/>
</PreferenceCategory> 复制代码 这个就是是否显示密码的设置处 然后找个安全页面对用的源码 Java类 \\192.168.1.112\jiangdou_w2\rk3188_5.1_mid\packages\apps\Settings\src\com\android\settings\SecuritySettings.java public void onResume() { super.onResume();
// Make sure we reload the preference hierarchy since some of these settings // depend on others... createPreferenceHierarchy();
final LockPatternUtils lockPatternUtils = mChooseLockSettingsHelper.utils(); if (mBiometricWeakLiveliness != null) { mBiometricWeakLiveliness.setChecked( lockPatternUtils.isBiometricWeakLivelinessEnabled()); } if (mVisiblePattern != null) { mVisiblePattern.setChecked(lockPatternUtils.isVisiblePatternEnabled()); } if (mPowerButtonInstantlyLocks != null) { mPowerButtonInstantlyLocks.setChecked(lockPatternUtils.getPowerButtonInstantlyLocks()); }
if (mShowPassword != null) { mShowPassword.setChecked(Settings.System.getInt(getContentResolver(), Settings.System.TEXT_SHOW_PASSWORD, 1) != 0); }
if (mResetCredentials != null) { mResetCredentials.setEnabled(!mKeyStore.isEmpty()); } } 复制代码 从源码上看mShowPassword.setChecked(Settings.System.getInt(getContentResolver(),Settings.System.TEXT_SHOW_PASSWORD, 1) != 0); 如果获取不到默认设置则默认是显示密码回显的 所以我们只需配置一个默认值,默认其不回显密码即可。 在默认配置里加一个配置 \\192.168.1.112\jiangdou_w2\rk3188_5.1_mid\frameworks\base\packages\SettingsProvider\res\values\defaults.xml <integer name="def_show_password">0</integer> 复制代码 int类型默认值为0,这样上面就可以获得默认配置值为0,mShowPassword.setChecked(false)按钮就不会勾选了 然后系统开机加载默认设置的类中加载这个默认属性值 \\192.168.1.112\jiangdou_w2\rk3188_5.1_mid\frameworks\base\packages\SettingsProvider\src\com\android\providers\settings\DatabaseHelper.java loadIntegerSetting(stmt, Settings.System.TEXT_SHOW_PASSWORD, R.integer.def_show_password); 复制代码 Settings.System.TEXT_SHOW_PASSWORD这个字符窜要和系统源码获取属性值的key值对应
最后重新编译系统,就可以实现系统设置默认不回显密码了 |
RK平台修改android系统设置默认密码不回显
最新推荐文章于 2024-09-21 22:11:40 发布