How can I enable the backlight of the home/menu/back virtual buttons on the touchpad when pressing the power key on the JB2?

Source: Internet
Author: User

In android 4.2, google defautl has removed the backlight function of the virtual buttons on the touchpad. If you want to press the power key to highlight the screen, please refer to the following implementation method to light up the backlight of the home/menu/back keys:
KeyguardViewMediator. java
1,
Public KeyguardViewMediator (Context context, LockPatternUtils lockPatternUtils ){
MContext = context;
MPM = (PowerManager) context. getSystemService (Context. POWER_SERVICE );
MUserManager = (UserManager) mContext. getSystemService (Context. USER_SERVICE );
// Add code here ========================
MButtonWakelock = mPM. newWakeLock (PowerManager. FULL_WAKE_LOCK | PowerManager. ACQUIRE_CAUSES_WAKEUP, "button backlight ");
// Add code here ========================
 
2,
Private void handleWakeWhenReady (int keyCode, int wakeMSGId ){
If (DBG_WAKE) KeyguardUtils. xlogD (TAG, ">>> handleWakeWhenReady (" + keyCode + ") Before -- synchronized (KeyguardViewMediator. this) wakeMSGId = "+ wakeMSGId); // M:
Synchronized (KeyguardViewMediator. this ){
If (DBG_WAKE) KeyguardUtils. xlogD (TAG, "handleWakeWhenReady (" + keyCode + ") wakeMSGId =" + wakeMSGId );
 
// This shoshould result in a call to 'poke wakelock 'which will set a timeout
// On releasing the wakelock
If (! MKeyguardViewManager. wakeWhenReadyTq (keyCode )){
// Poke wakelock ourselves if keyguard is no longer active
KeyguardUtils. xlogD (TAG, "mKeyguardViewManager. wakeWhenReadyTq did not poke wake lock, so poke it ourselves ");
UserActivity ();
}
 
/**
* Now that the keyguard is ready and has poked the wake lock, we can
* Release the handoff wakelock
*/
MWakeAndHandOff. release ();
// Add code here ==================
MButtonWakelock. acquire (3000 );
// Add code here ==================
If (DBG_WAKE) KeyguardUtils. xlogD (TAG, "

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.