Android unlock screen Startup Process

Source: Internet
Author: User

Android unlock screen Startup Process
I. boot
The SIM card and status are obtained when the wireless module is initialized during startup. After initialization, call the vm. systemReady () function to notify you to enter the corresponding Lock Screen to unlock.

1. In the hardware/ril/reference-ril/reference-ril.c:
SetRadioState (RADIO_STATE_SIM_NOT_READY) is used to trigger the initialization of the wireless module.
Initialize the wireless module through static void onRadioPowerOn.
First, pollSIMState (Null) is used to poll the SIM card status.
The getSIMStatus () function obtains the SIM card status.

2. After the system initialization is complete, the wm. systemReady () function is called to trigger the unlock interface.
VM: WindowManagerService wm = null;
Because WM is empty, call the function in WindowManagerService:
Public void systemReady (){
MPolicy. systemReady ();
}
MPolicy: final WindowManagerPolicy mPolicy = PolicyManager. makeNewWindowManager ();

(The following files are in frameworks/policies/base/phone/com/android/internal/policy/impl)
3. PolicyManager. makeNewWindowManager (), which calls the function in PolicyManagerer. java:
Public static WindowManagerPolicy makeNewWindowManager (){
Return sPolicy. makeNewWindowManager ();
}

4. sPolicy. makeNewWindowManager calls the function in the file Policy. java:
Public PhoneWindowManager makeNewWindowManager (){
Return new PhoneWindowManagerwv
}

5. PhoneWindowManager inherits from WindowManagerPolicy
MPolicy. systemReady () finally calls the function in the file PhoneWindowManager. java:
Public void systemReady ();
MKeyguardMediator. onSystemReady ();
DoKeyguard ();
ShowLocked ();
Message msg = mHandler. obtainMessage (Show );
MHandler. sendMessage (msg );
Send the SHOW message.

6. public void handleMessage (Message msg) processes the SHOW Message.
If msg. what is equal to SHOW, execute:
HandleShow ();
Private void handleShow ()
...
MCallback. onKeyguardShow ();
MKeyguardViewManag. show ()
7. mKeyguardViewManager. show () calls the functions in the KeyguardViewManager. java file:
Public synchronized void show ()
...
MKeyguardView = mKeyguardViewProperties. createKeyguardView (mContext, mUpdateMonitor, this );
...

8. mKeyguardViewProperties. createKeyguardView
The function in the file LockPatternKeyguardViewProperties. java is called:
Public KeyguardViewBase createKeyguardView (Context context,
KeyguardUpdateMonitor updateMonitor,
KeyguardWindowController controller ){
Return new LockPatternKeyguardView (context, updateMonitor,
MLockPatternUtils, controller );
}

9. new LockPatternKeyguardView calls the constructor of the LockPatternKeyguardView class:
Public LockPatternKeyguardView (
Context context,
KeyguardUpdateMonitor updateMonitor,
LockPatternUtils lockPatternUtils,
KeyguardWindowController controller)
...
MLockScreen = createLockScreen ();
AddView (mLockScreen );
Final UnlockMode unlockMode = getUnlockMode ();
MUnlockScreen = createUnlockScreenFor (unlockMode );
MUnlockScreenMode = unlockMode;
AddView (mUnlockScreen );
UpdateScreen (mMode );

GetUnlockMode obtains the lock type. There are usually three types:
Enum UnlockMode {
Pattern,
SinPIN,
Account
}
CreateUnlockScreenFor (unlockMode) calls the corresponding unlock screen based on the corresponding unlockMode.

2. Press the red key to start
Click the end call key (red key) and follow the action:
TelephonyManager. ACTION_PHONE_STATE_CHANGE and TelephonyManager. EXTRA_STATE_IDLE
Call frameworks/policies/base/phone/com/android/internal/policy/impl/
Functions in KeyguardViewMediator. java:
DoKeyguard ();
Private void showLocked (){
If (DEBUG) Log. d (TAG, "showLocked ");
// Ensure we stay awake until we are finished displaying the keyguard
MShowKeyguardWakeLock. acquire ();
Message msg = mHandler. obtainMessage (SHOW );
MHandler. sendMessage (msg );
}
Send the SHOW message.
Then go to step 6 of "Start Up.
Iii. Other Methods
1. the SIM card status changes when the SIM card status is ABSENT
// Only force lock screen in case of missing sim if user hasn't gone through setup wizard
When the SIM card status is PUK_REQUIRED: that is, the input PIN fails. (Call PUK to unlock the screen)

2. Set the automatic screen lock time out.
All are started through KeyguardViewMediator. java.

Author
; LuoXianXion

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.