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, "