Start
The SIM card and status are obtained when the wireless module is initialized during startup. After Initialization is complete, call the VM. systemready () function to notify the corresponding lockscreen to unlock.
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 staticvoid 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: windowmanagerservicewm = NULL;
Because WM is empty, call the function in windowmanagerservice:
Publicvoid 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:
Publicstatic windowmanagerpolicy makenewwindowmanager (){
Returnspolicy. makenewwindowmanager ();
}
4. spolicy. makenewwindowmanager calls the function in the file policy. Java:
Publicphonewindowmanager makenewwindowmanager (){
Returnnew phonewindowmanagerwv
}
5. phonewindowmanager inherits from windowmanagerpolicy
Mpolicy. systemready () finally calls the function in the file phonewindowmanager. Java:
Publicvoid systemready ();
Mkeyguardmediator. onsystemready ();
Dokeyguard ();
Showlocked ();
Messagemsg = 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 ();
Privatevoid handleshow ()
...
Mcallback. onkeyguardshow ();
Mkeyguardviewmanag. Show ()
7. mkeyguardviewmanager. Show () calls the functions in the keyguardviewmanager. Java file:
Publicsynchronized void show ()
...
Mkeyguardview = mkeyguardviewproperties. createkeyguardview (mcontext, mupdatemonitor, this );
...
8. mkeyguardviewproperties. createkeyguardview
The function in the file lockpatternkeyguardviewproperties. Java is called:
Publickeyguardviewbase createkeyguardview (context,
Keyguardupdatemonitorupdatemonitor,
Keyguardwindowcontrollercontroller ){
Returnnew lockpatternkeyguardview (context, updatemonitor,
Mlockpatternutils, Controller );
}
9. New lockpatternkeyguardview calls the constructor of the lockpatternkeyguardview class:
Publiclockpatternkeyguardview (
Contextcontext,
Keyguardupdatemonitorupdatemonitor,
Lockpatternutilslockpatternutils,
Keyguardwindowcontrollercontroller)
...
Mlockscreen = createlockscreen ();
Addview (mlockscreen );
Finalunlockmode unlockmode = getunlockmode ();
Munlockscreen = createunlockscreenfor (unlockmode );
Munlockscreenmode = unlockmode;
Addview (munlockscreen );
Updatescreen (mmode );
Getunlockmode obtains the lock type. There are usually three types:
Enumunlockmode {
Pattern,
Sinpin,
Account
}
Createunlockscreenfor (unlockmode) calls the corresponding unlock screen based on the corresponding unlockmode.
Press red 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 ();
Privatevoid showlocked (){
If (Debug) log. D (TAG, "showlocked ");
// Ensure we stay awake until we are finished displaying the keyguard
Mshowkeyguardwakelock. Acquire ();
Messagemsg = mhandler. obtainmessage (show );
Mhandler. sendmessage (MSG );
}
Send the show message.
Then go to step 6 of "Start Up.
Other methods
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 gonethrough Setup Wizard
When the SIM card status is puk_required: that is, the input pin fails. (Call Puk to unlock the screen)
The Set automatic lock time is out.
All are started through keyguardviewmediator. java.