系统:安卓7.1.2
问题:平台需要使用VPN功能,但是必须的设置PIN码,这就导致 ,
1.在系统启动的过程中要求用户输入PIN,才能启动系统。
2.系统息屏后锁屏,打开也要求输入PIN码。
有两种思路:
1. 把锁屏界面去掉,不弹出输入pin码的界面。
2. 不设置PIN码锁屏,直接在设置VPN时,去除“您需要先设置锁屏PIN码……”这个弹框。
自己试了一下,第二种方法较简单点,这里就用第二种,去除检查是否设置密码即可。
- private boolean mUnlocking = false;
+ private boolean mUnlocking = true;
public static void show(VpnSettings parent, VpnProfile profile, boolean edit, boolean exists) {
if (!parent.isAdded()) return;
@@ -72,9 +72,10 @@ public class ConfigDialogFragment extends DialogFragment implements
@Override
public void onResume() {
super.onResume();
-
- // Check KeyStore here, so others do not need to deal with it.
- if (!KeyStore.getInstance().isUnlocked()) {
+
+ //del by zhuk 20180109 for not to check pin or password when set VPN
+ // Check KeyStore here, so others do not need to deal with it.
+ /*if (!KeyStore.getInstance().isUnlocked()) {
if (!mUnlocking) {
// Let us unlock KeyStore. See you later!
Credentials.getInstance().unlock(getActivity());
@@ -87,7 +88,8 @@ public class ConfigDialogFragment extends DialogFragment implements
}
// Now KeyStore is always unlocked. Reset the flag.
- mUnlocking = false;
+ mUnlocking = false;*/
总结了一下有二种方法可以清楚锁屏。
1.修改系统默认属性
frameworks/base/packages/SettingsProvider/res/values/defaults.xml
<bool name="def_lockscreen_disabled">true</bool>//设置为true
需恢复出厂设置,才能生效。然后再去设置PIN锁屏,系统还是会有锁屏动作。这种方法针对系统第一次起来后不会去修改锁屏的状态。
2. 经查寻,有人说修改文件:
framework/base/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
private boolean mExternallyEnabled = true;//默认值是true,打开屏锁。修改为false。
在系统5.1和7.1上验证,均出现系统黑屏,无法进入应用,无效,在这个文件修改private void handleShow()函数也无效。