Android lockNow() fails on HTC Desire

2019-07-30 23:52发布

问题:

I have created an app that can lock the phone with a pin code using DevicePolicyManager, resetPassword and lockNow(). It works perfectly on my Galaxy S and on all other phones but not on HTC Desire.

On a Desire the pin code screen appears but you can simply press the ok button without entering the pin code and the phone will still unlock.

A user says that the lock works if he does not use the phone for about 5 minutes. Does anyone have a hint of what could be wrong, or any suggestion of what to do?

回答1:

It sound like the password value is being cached, allowing him to bypass the entry code. After a few minutes, the app is removed from memory (clearing the cached credentials) and forces the user to re-enter the phone. A possible solution is to clear every field that handles the password after the user has entered the correct password.

This may not be the actual problem/solution but hopefully it helps.



回答2:

I consider this a bug on the Desire but I found a way around it by setting the lock timeout to 1 second, locking the device and then set the lock timeout back up again.