Android Standby process

Source: Internet
Author: User




The following analysis is based on android2.2 's Google source code.


At boot start, Phonewindowmanager.systemready () is executed first (this process is not analyzed before). Call Keyguardviewmediator.onsystemready () for the standby lock screen and unlock logic.


?Keyguardviewmediator is the entire standby solution/Lock Screen Service Scheduler, responsible for scheduling lock screen interface related actions and query Shing status, including some of the following:

Check the lock screen status, and is currently in the lock screen state or unlocked state, Phonewindowmanager holds keyguardviewmediator reference, when the user touches the screen or press a key is, Phonewindowmanager will perform different response processing by querying the lock screen status (lock/unlock) through Keyguardviewmediator. If locked, system input events are restricted.

? Respond to power events (black/light screen). Determine what state (display or reset) the lock screen should be in. After the screen is black, the lock screen will be displayed immediately so that the lock screen can be displayed immediately after the next light screen without blinking or delay.

Other applications or services can also request a disable lock screen (by calling Keyguardviewmediator's Setkeyguardenabled (Boolean) method). For example, answer the incoming call interface.

? The Keyguardviewmediator class is created when Windowmanagerpolicy (which is an instance of Phonewindowmanager in the phone system) is initialized and runs on its thread, and the UI interface of the lock screen is created and displayed on this thread. The status query API provided by the Keyguardviewmediator class can be used by the Android.view.WindowManager, Other threads such as Com.android.server.InputManager are called, so the API methods on the Keyguardviewmediator class are thread-synchronized (synchronized).

? The scheduling operations that Keyguardviewmediator can perform include:
1) Lit screen pokewakelock ();
2) Report The lock screen permission verification is successful Keyguarddone (Boolean);
3) respond to the SIM card status changes and adjust the lock screen interface accordingly onsimstatechanged ().
4) Scheduling the management of the standby Lock screen UI interface, including displaying handleshow (), hiding handlehide (), resetting handlereset (), Lighting the screen handlewakewhenready (), etc. Keyguardviewmediator implementation of this part of the schedule is achieved by holding a keyguardviewmanager.



?Keyguardupdatemonitor is the monitor for all events that affect the entire standby solution/lock screen business. (Besides being a monitor, it also plays a contextual role, perhaps we should name this class (Keyguardcontext).) It monitors events such as time changes, battery status changes, time zone changes, SIM status changes, phone status changes, phone signal changes, and more. It is the observed object of an observer pattern. Observers by calling Keyguardupdatemonitor's Registerinfocallback (Infocallback) and Registersimstatecallback (SimStateCallback) method to register and observe the changes you are interested in. Keyguardupdatemonitor's observers include Keyguardviewmediator, Lockscreen, Patternunlockscreen, Accountunlockscreen, Passwordunlockscreen, Simunlockscreen and so on. The observer cancels the observation by calling Keyguardupdatemonitor's Removecallback (Object).


?Keyguardviewmanager is responsible for managing the creation, display, hiding, resetting of the Standby screen UI interface, as well as the scheduling associated with a callback Keyguardviewcallback notification scheduler Keyguardviewmediator


?Lockpatternkeyguardview (Keyguardviewbase) is the host of all lock screen and unlock UI interfaces。 It has 2 modes of mode. Lockscreen and Mode. Unlockscreen. It is responsible for switching the standby screen that should currently be displayed based on the current context. It provides a callback to the currently displayed standby screen and processes its callback, and if the callback action is not handled by itself, continue reporting to keyguardviewmediator for processing.
? The lock screen interface is lockscreen, and the Unlocking interface includes SIM unlock simunlockscreen, pattern unlock patternunlockscreen, password unlock passwordunlockscreen, Account Unlocked Accountunlockscreen
?

After unlocking successfully, the lock screen process goes to Keyguardviewmediator's Keyguarddone (Boolean, Boolean) for subsequent processes (such as going to the launcher desktop).

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.