This is Google issue, native Android4.4 have this problem. The process is: AMS issued Boot_completed,powermanager received boot_completed after the check Boot animation is complete, if completed, will be the internal member mbootcompleted to True, You then press the Power key to hibernate normally.
Powermanagerservice.java dynamically registers Bootcompletedreceiver monitoring action_boot_completed in the Systemready () method
1 New Intentfilter (); 2 filter.addaction (intent.action_boot_completed); 3 Mcontext.registerreceiver (newnull, Mhandler);
1 Private Final classBootcompletedreceiverextendsBroadcastreceiver {2 @Override3 Public voidOnReceive (Context context, Intent Intent) {4 if(Debug_spew) {5SLOG.D (TAG, "bootcompletedreceiver."));6 }7 //This is our early signal, the system thinks it has finished booting.8 //However, the boot animation may still is running for a few more seconds9 //since it is ultimately in charge of the when it terminates.Ten //Defer transitioning into the boot completed state until the animation exits. One //We do this, the screen does not start to dim prematurely before A //The user has actually had a chance to interact with the device. - startwatchingforbootanimationfinished (); - } the}
Startwatchingforbootanimationfinished () Send broadcast msg_check_if_boot_animation_finished check if the boot animation is complete,
1 @Override2 Public voidhandlemessage (Message msg) {3 Switch(msg.what) {4 ...5 Casemsg_check_if_boot_animation_finished:6 checkifbootanimationfinished ();7 Break;8 }9}
1 Private voidcheckifbootanimationfinished () {2 if(DEBUG) {3SLOG.D (TAG, "Check if boot animation finished ...");4 }5 //Check to see if you're still running Bootanim .6 if(systemservice.isrunning (Boot_animation_service)) {7 mhandler.sendemptymessagedelayed (msg_check_if_boot_animation_finished,8 boot_animation_poll_interval);9 return;Ten } One A synchronized(mLock) { - if(!mbootcompleted) { -SLOG.I (TAG, "Boot Animation finished.")); the handlebootcompletedlocked (); - } - } -}
Here systemservice.isrunning (Boot_animation_service) to determine whether the system boot animation is still running, if isrunning continue check, otherwise, Animation completed handlebootcompletedlocked ();
1 Private voidhandlebootcompletedlocked () {2 Final Longnow =Systemclock.uptimemillis ();3mbootcompleted =true;4Mdirty |=dirty_boot_completed;5 useractivitynoupdatelocked (6Now, Powermanager.user_activity_event_other, 0, process.system_uid);7 if(Mwakefulness = =Wakefulness_awake) {8 mnotifier.onwakeupstarted ();9 }Ten updatepowerstatelocked (); One}
Here the mbootcompleted system is up, notifying update state.
At this point, or just find the reason, there is no good treatment method, I hope the expert guidance, science, communication.
At the moment, the poor method is to set Mbootcompleted=true to True. This method is to let PowerManager do not go to check boot_completed, this may have an impact: just power on the screen after the press, press the Power key again to resume back normally. The main consideration is that AMS may still be in the boot_completed, and press power key to extinguish the screen and the process will require the AMS hair Screen_off, screen_on intent, Worry Activitymanagerservice in boot_completed still not finish the situation to respond to send Screen_off and screen_on.
Android KK power button cannot extinguish the screen, must be later to extinguish the screen