Where are Android screen lock classes and preferences stored?

590 views Asked by At

I want to write a simple convenience app that allows me to have two locking modes on my phone. By default the phone would just go to the slide lock after a minute or two, but after a longer time or if I activate my app, it should engage a more stringent lock, such as the face unlocking. Basically when I have the phone on me, anything but the slide lock is overkill.

To do this I would have to read/write the preferences for the screen lock or find a list of available locking/unlocking mechanisms so I can select and invoke one of them. Does anybody know where this information can be found/is stored?

I expected the preference keys to be found in the (System.Secure class), but could not immediately find anything related except the LOCK_PATTERN_ENABLED setting, which would not be enough.

I tried searching for references to the FaceDetector class, but none are returned in my Eclipse.

The Device Administration API Sample looks like it might give some leads if I could look at the source code. Unfortunately the page omits the detail of which of the several folders of each of the sample directories for the approx. 10 API levels supporting I need to download and look in, as far as I can see.

1

There are 1 answers

1
Binoy Babu On

You can change lock modes in your app only if it is a device admin. These API are located in class DevicePolicyManager and methods setMaximumTimeToLock() and lockNow() etc. It is only accessible only if your app is a device admin. If you are interested in crating a custom lockscreen app, you can try this.