先貼lineage_wizard_script_user.xml的代碼:
<WizardScript xmlns:wizard="http://schemas.android.com/apk/res/com.google.android.setupwizard"wizard:firstAction="welcome"><WizardAction wizard:uri="intent:#Intent;action=org.lineageos.setupwizard.LINEAGE_WELCOME;end" id="welcome"><result wizard:action="locale"/></WizardAction><WizardAction wizard:uri="intent:#Intent;action=org.lineageos.setupwizard.LINEAGE_LOCALE;end" id="locale"><result wizard:action="location_settings" /></WizardAction><WizardAction wizard:uri="intent:#Intent;action=org.lineageos.setupwizard.LINEAGE_LOCATION_SETTINGS;end" id="location_settings"><result wizard:action="biometric_settings"/></WizardAction><WizardAction wizard:uri="intent:#Intent;action=org.lineageos.setupwizard.LINEAGE_BIOMETRIC_SETTINGS;end" id="biometric_settings"><result wizard:action="lockscreen_settings"/></WizardAction><WizardAction wizard:uri="intent:#Intent;action=org.lineageos.setupwizard.LINEAGE_LOCKSCREEN_SETTINGS;end" id="lockscreen_settings"><result wizard:action="restore"/></WizardAction><WizardAction wizard:uri="intent:#Intent;action=org.lineageos.setupwizard.LINEAGE_RESTORE_BACKUP;end" id="restore"><result wizard:action="finish"/></WizardAction><WizardAction wizard:uri="intent:#Intent;action=org.lineageos.setupwizard.LINEAGE_SETUP_COMPLETE;end" id="finish"><result wizard:action="exit" /></WizardAction><WizardAction wizard:uri="intent:#Intent;action=org.lineageos.setupwizard.EXIT;end" id="exit" /></WizardScript>
在SetupWizardActivity后,正式按WizardScript啟動配置向導,wizard:firstAction="welcome",指定第一個要運行的配置向導id,查找WizardAction配置,id="welcome"的intent action是org.lineageos.setupwizard.LINEAGE_WELCOME,打開AndroidManifest.xml,看這個配置:
<activity android:name=".WelcomeActivity"android:label="@string/activity_label_empty"android:excludeFromRecents="true"android:configChanges="mcc|mnc"android:immersive="true"android:exported="false"android:windowSoftInputMode="stateAlwaysHidden"><intent-filter><action android:name="org.lineageos.setupwizard.LINEAGE_WELCOME" /><category android:name="android.intent.category.DEFAULT" /></intent-filter></activity>
看到的是啟動的WelcomeActivity。
<result wizard:action="locale"/>指向下一個配置向導,依次類推,一直到<result wizard:action="exit" />,標志配置結束,進入系統。
? 如果想省去卡機向導的麻煩,直接將wizard:firstAction="welcome",改成wizard:firstAction="exit"