Keyguard is responsible for:
Keyguard is the first screen available when turning on the device, as long as the user has not specified a security method of NONE.
The journeys below generally refer to Keyguard's portion of the overall flow, especially regarding use of the power button. Power button key interpretation (short press, long press, very long press, multi press) is done in PhoneWindowManager, with calls to PowerManagerService to sleep or wake up, if needed.
Begins with the device in low power mode, with the display active for AOD or inactive. PowerManagerService can be directed to wake up on various user-configurable signals, such as lift to wake, screen taps, among others. AOD, whether visibly enabled or not, handles these signals to transition AOD to full Lockscreen content. See more in AOD.
An indication to power off the device most likely comes from one of two signals: the user presses the power button or the screen timeout has passed. This may lock the device
More coming