1 principle
Android has three kinds of screen unlock protection: pattern unlock, pin password unlock and unlock password.
The interface is as follows:
Diagram 1 Pattern Unlock interface
Chart 2 pin password unlock interface
Chart 3 Password Unlock interface
We can use the subclass Keyguardlock in Java.lang.Object.android.app.KeyguardManger to control the disable out of these screen lock interfaces so that you don't have to enter a password, Directly over the screen lock interface to use the phone mainly using Keyguardlock.disablekeyguard () and Keyguardlock.enablekeyguard () method to disable, enable screen lock interface
2 Code Description
Demo program main code is as follows:
Get Keyguardmanagerkeyguardmanager manager = (Keyguardmanager) getsystemservice (Keyguard_service);
If (Manager.inkeyguardrestrictedinputmode ()) {
In the locked interface, the interface is unlocked by the Keyguardlock class method.
Keyguardlock Keyguard = Manager.newkeyguardlock (Getlocalclassname ());
Keyguard.disablekeyguard ();
}
Permissions Required:
3 Conclusion
1. Pattern Lock interface Use this method
After calling the Disablekeyguard () method Disable the Pattern lock screen, pressing the HOME key triggers the lock screen interface to enable the display of the lock screen interface.
2.Pin Password Lock interface using this method
When you call the Disablekeyguard () method after the disable pattern interface, the splash screen appears when you press the home key. Does not return to the main face
3. The password lock interface uses this method
When you call the Disablekeyguard () method after the disable pattern interface, the splash screen appears when you press the home key. Does not return to the main face
While it is not known why Google provides such an API, developers can use this API to make Android's screen lock protection function virtually nonexistent, and the exception to the home key after calling this method should be a bug.
4 Demo
As a result of screen locking through the computer on the Pea pod and other software can only install APK, and can not start apk, so this demo program written in the boot, that is, when the screen lock screen, through the computer, such as pea pod software installed after the software to restart can be implemented pass off Screen lock interface.
Android 2.2, 2.3,4.0 platform test Pass.