开发者

Android 2.2 Screen Lock Security

Is there a way to find out if a user has the PIN lock or password lock screen security set?

I know that you can check Settings.Secure.PATTERN_LOCK_ENABLED to read if the pattern is set. Even a value to read that shows if ANY security is set would be 开发者_Python百科helpful.


On OS 2.2 you can find out if there is a minimum security policy in place using DevicePolicyManager getPasswordQuality(null). It will return a PASSWORD_QUALITY_* constant indicating the minimum level of security in force, e.g.

PASSWORD_QUALITY_UNSPECIFIED
PASSWORD_QUALITY_SOMETHING 
PASSWORD_QUALITY_NUMERIC        
PASSWORD_QUALITY_ALPHABETIC
PASSWORD_QUALITY_ALPHANUMERIC
PASSWORD_QUALITY_COMPLEX

Unfortunately I don't think that will tell you what quality of password protection the user currently has, i.e it only tells you if there happens to be a security policy in place (which won't be that common unless all your users have e-mail through an Exchange server which implements a security policy).

You can always call setPasswordQuality in your app to enforce a minimum device password though.

If you find an answer for this question that works on OS 2.1 I would be interested to hear it!


Here's what I did:

mDevicePolicyManager.setPasswordMinimumLength(component, 6);

then use:

mDevicePolicyManager.isActivePasswordSufficient())
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜