Android development and implementation of methods to eliminate screen lock

This paper describes the method of eliminating screen lock in Android development. Share with you for your reference, as follows:

The screen is unlocked -- > a state in which the screen is unlocked after we turn on the machine, exceed the screen locking time, or press the power key.

After querying many materials and analyzing the code, we can find that the main screen function is still in framework / base / policy / SRC / COM / Android / internal / policy / impl / keyguardviewmediator.java.

There is a handleshow method:

The real unlocking screen implementation has a handlehide method. The real unlocking screen implementation implements the handleshow method:

As long as we comment out the above annotated statements, the execution will be empty, and the real screen locking implementation will be cancelled

Similarly, the handlehide method only needs comments

You can cancel the real implementation of hiding the lock screen.

However, there is still a bug (problem) after the above, that is, after waking up the screen, the screen will turn from light to dark within the specified time. We also need to make the following modifications: press the power key to release the bug that the screen turns from light to dark.

Comment it out under the handlewakewhenread (int keycode) method

You can achieve the effect.

Finally, another method is to have a variable mexternallyenabled in keyguardviewmediator.java. As long as its initial value is changed to false, it will not continue when the interface (dokeyguard()) needs to be displayed, and the effect can also be achieved.

More readers interested in Android related content can view the special topics of this site: introduction and advanced tutorial of Android development, summary of Android debugging skills and common problem solving methods, summary of Android basic component usage, summary of Android view skills, summary of Android layout skills and summary of Android control usage

I hope this article will help you in Android programming.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>