先贴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"