[Solution] Bypassing Lineage Setup Wizard

Search This thread

Aqq123

Senior Member
Aug 27, 2009
235
293
Google Nexus 4
Nexus 7
The Problem
Installing LineageOS from scratch, every time upon first boot there's the Setup Wizard, which now includes 13 screens to tap through. It would be much better to be able to boot straight into the home screen as any initial setup can be done faster either programmatically or through the menus. Unfortunately, bypassing the Setup Wizard is more cumbersome than one would expect.
  • adb shell echo "ro.setupwizard.mode=DISABLED" >> /system/build.prop used to work but no longer does.
  • Simply deleting /system/priv-app/LineageSetupWizard/LineageSetupWizard.apk before first run leaves the system in an unprovisioned state, where, in particular, the Home button does not work.
The Solution
The workaround I have come up with is to edit the wizard script, which is included as a raw XML file inside the APK, to bypass all the intermediate screens and take you directly to the last one. A patch and a modified APK file based on LineageOS 2018-08-21 build for Whyred is attached. The patch:
Code:
diff -urN LineageSetupWizard.orig/res/raw/lineage_wizard_script.xml LineageSetupWizard/res/raw/lineage_wizard_script.xml
--- LineageSetupWizard.orig/res/raw/lineage_wizard_script.xml	Fri Aug 24 00:36:29 2018
+++ LineageSetupWizard/res/raw/lineage_wizard_script.xml	Fri Aug 24 00:11:49 2018
@@ -21,57 +21,17 @@
     wizard:firstAction="bluetooth_setup">
 
     <WizardAction wizard:uri="intent:#Intent;action=org.lineageos.setupwizard.LINEAGE_BLUETOOTH_SETUP;end" id="bluetooth_setup">
-        <result wizard:action="welcome" />
-    </WizardAction>
-
-    <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="datetime" />
-    </WizardAction>
-
-    <WizardAction wizard:uri="intent:#Intent;action=org.lineageos.setupwizard.LINEAGE_DATETIME;end" id="datetime">
-        <result wizard:action="wifi_setup" />
-    </WizardAction>
-
-    <WizardAction wizard:uri="intent:#Intent;action=org.lineageos.setupwizard.LINEAGE_WIFI_SETUP;end" id="wifi_setup">
-        <result wizard:resultCode="1" wizard:action="sim_missing" wizard:name="no_sim" />
-        <result wizard:action="choose_data_sim" />
-    </WizardAction>
-
-    <WizardAction wizard:uri="intent:#Intent;action=org.lineageos.setupwizard.LINEAGE_SIM_MISSING;end" id="sim_missing">
-        <result wizard:resultCode="1" wizard:action="location_settings" wizard:name="skip_sim" />
-        <result wizard:action="choose_data_sim" />
-    </WizardAction>
-
-    <WizardAction wizard:uri="intent:#Intent;action=org.lineageos.setupwizard.LINEAGE_CHOOSE_DATA_SIM;end" id="choose_data_sim">
-        <result wizard:action="enable_mobile_data" />
-    </WizardAction>
-
-    <WizardAction wizard:uri="intent:#Intent;action=org.lineageos.setupwizard.LINEAGE_ENABLE_MOBILE_DATA;end" id="enable_mobile_data">
-        <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="lineage_settings" />
     </WizardAction>
 
     <WizardAction wizard:uri="intent:#Intent;action=org.lineageos.setupwizard.LINEAGE_SETTINGS;end" id="lineage_settings">
-        <result wizard:action="fingerprint_settings" />
-    </WizardAction>
-
-    <WizardAction wizard:uri="intent:#Intent;action=org.lineageos.setupwizard.LINEAGE_FINGERPRINT_SETTINGS;end" id="fingerprint_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="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>
How It Works
  • The modified process leaves the first step, the Bluetooth Setup, intact as this part happens automatically in the background, and does not require any user action.
  • It then proceeds directly to the Lineage Settings screen, as this is actually the only remotely useful part of the Setup Wizard, where you have the chance to opt out of being tracked (the box is checked by default).
  • Once you uncheck the box, you are then taken straight to the final screen. This way, the whole setup is completed in 3 taps (or 2 if you don't opt-out).
How To Apply
The process is fairly standard. Here's one way to do it, step by step. Adjust to your environment:
  • adb shell mount /system (in Recovery) - or -
    adb shell mount -o remount,rw /system (from within the OS)
  • apktool2 d -b LineageSetupWizard.apk.orig -o LineageSetupWizard
  • patch --binary --no-backup-if-mismatch -E -i reduce_setup_wizard_to_minimum.diff -p0
  • apktool2 b -c -o LineageSetupWizard-unaligned.apk LineageSetupWizard
  • zipalign -f 4 LineageSetupWizard-unaligned.apk LineageSetupWizard.apk
  • adb shell rm -f /system/priv-app/LineageSetupWizard/LineageSetupWizard.apk (in Recovery)
  • adb push LineageSetupWizard.apk /system/priv-app/LineageSetupWizard/
  • adb shell chown root.root /system/priv-app/LineageSetupWizard/LineageSetupWizard.apk
  • adb shell chmod 644 /system/priv-app/LineageSetupWizard/LineageSetupWizard.apk
  • adb reboot
How It Can Be Improved
The above solution is a bit crude, a better workaround could be one of these:
  • It should be possible to remove the APK and reproduce the steps it does to set the device as provisioned programmatically. The following discussion, which describes how to trigger the Setup Wizard (AOSP, not LineageOS) when it has already run, could be useful: https://android.stackexchange.com/q...-setup-wizard-at-next-boot-using-command-line
  • Alternatively, it should be possible to preload a simple APK that includes a customized wizard script, which then runs in place of the stock one. Thus, the equivalent result could be obtained without decompiling the stock APK. I could only find two articles in Chinese describing this process but it's more or less clear what the steps are: https://blog.csdn.net/Aaron121314/article/details/78355652 and http://lib.csdn.net/article/android/6988. In fact, the Lineage Setup Wizard APK already includes a "user" wizard script that just goes straight to the finish, although it's not obvious how to trigger it.
Related Material
Hope some of this helps someone running into the same issue.
 

Attachments

  • reduce_setup_wizard_to_minimum.diff.zip
    810 bytes · Views: 336
  • LineageSetupWizard.apk
    2.6 MB · Views: 387

y0va

Member
Sep 12, 2021
16
3
yay, thats nice, but I prefer to set some defaults, so less clicks are needed for the setup wizard not only during engineering ;)

 
  • Like
Reactions: Aqq123

AndreyAleks

Senior Member
Sep 14, 2019
53
8
Yes, it's actual. Especially in 19.1 where there's no way to skip step of internet connection (offline setup).
 

Top Liked Posts

  • There are no posts matching your filters.
  • 4
    The Problem
    Installing LineageOS from scratch, every time upon first boot there's the Setup Wizard, which now includes 13 screens to tap through. It would be much better to be able to boot straight into the home screen as any initial setup can be done faster either programmatically or through the menus. Unfortunately, bypassing the Setup Wizard is more cumbersome than one would expect.
    • adb shell echo "ro.setupwizard.mode=DISABLED" >> /system/build.prop used to work but no longer does.
    • Simply deleting /system/priv-app/LineageSetupWizard/LineageSetupWizard.apk before first run leaves the system in an unprovisioned state, where, in particular, the Home button does not work.
    The Solution
    The workaround I have come up with is to edit the wizard script, which is included as a raw XML file inside the APK, to bypass all the intermediate screens and take you directly to the last one. A patch and a modified APK file based on LineageOS 2018-08-21 build for Whyred is attached. The patch:
    Code:
    diff -urN LineageSetupWizard.orig/res/raw/lineage_wizard_script.xml LineageSetupWizard/res/raw/lineage_wizard_script.xml
    --- LineageSetupWizard.orig/res/raw/lineage_wizard_script.xml	Fri Aug 24 00:36:29 2018
    +++ LineageSetupWizard/res/raw/lineage_wizard_script.xml	Fri Aug 24 00:11:49 2018
    @@ -21,57 +21,17 @@
         wizard:firstAction="bluetooth_setup">
     
         <WizardAction wizard:uri="intent:#Intent;action=org.lineageos.setupwizard.LINEAGE_BLUETOOTH_SETUP;end" id="bluetooth_setup">
    -        <result wizard:action="welcome" />
    -    </WizardAction>
    -
    -    <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="datetime" />
    -    </WizardAction>
    -
    -    <WizardAction wizard:uri="intent:#Intent;action=org.lineageos.setupwizard.LINEAGE_DATETIME;end" id="datetime">
    -        <result wizard:action="wifi_setup" />
    -    </WizardAction>
    -
    -    <WizardAction wizard:uri="intent:#Intent;action=org.lineageos.setupwizard.LINEAGE_WIFI_SETUP;end" id="wifi_setup">
    -        <result wizard:resultCode="1" wizard:action="sim_missing" wizard:name="no_sim" />
    -        <result wizard:action="choose_data_sim" />
    -    </WizardAction>
    -
    -    <WizardAction wizard:uri="intent:#Intent;action=org.lineageos.setupwizard.LINEAGE_SIM_MISSING;end" id="sim_missing">
    -        <result wizard:resultCode="1" wizard:action="location_settings" wizard:name="skip_sim" />
    -        <result wizard:action="choose_data_sim" />
    -    </WizardAction>
    -
    -    <WizardAction wizard:uri="intent:#Intent;action=org.lineageos.setupwizard.LINEAGE_CHOOSE_DATA_SIM;end" id="choose_data_sim">
    -        <result wizard:action="enable_mobile_data" />
    -    </WizardAction>
    -
    -    <WizardAction wizard:uri="intent:#Intent;action=org.lineageos.setupwizard.LINEAGE_ENABLE_MOBILE_DATA;end" id="enable_mobile_data">
    -        <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="lineage_settings" />
         </WizardAction>
     
         <WizardAction wizard:uri="intent:#Intent;action=org.lineageos.setupwizard.LINEAGE_SETTINGS;end" id="lineage_settings">
    -        <result wizard:action="fingerprint_settings" />
    -    </WizardAction>
    -
    -    <WizardAction wizard:uri="intent:#Intent;action=org.lineageos.setupwizard.LINEAGE_FINGERPRINT_SETTINGS;end" id="fingerprint_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="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>
    How It Works
    • The modified process leaves the first step, the Bluetooth Setup, intact as this part happens automatically in the background, and does not require any user action.
    • It then proceeds directly to the Lineage Settings screen, as this is actually the only remotely useful part of the Setup Wizard, where you have the chance to opt out of being tracked (the box is checked by default).
    • Once you uncheck the box, you are then taken straight to the final screen. This way, the whole setup is completed in 3 taps (or 2 if you don't opt-out).
    How To Apply
    The process is fairly standard. Here's one way to do it, step by step. Adjust to your environment:
    • adb shell mount /system (in Recovery) - or -
      adb shell mount -o remount,rw /system (from within the OS)
    • apktool2 d -b LineageSetupWizard.apk.orig -o LineageSetupWizard
    • patch --binary --no-backup-if-mismatch -E -i reduce_setup_wizard_to_minimum.diff -p0
    • apktool2 b -c -o LineageSetupWizard-unaligned.apk LineageSetupWizard
    • zipalign -f 4 LineageSetupWizard-unaligned.apk LineageSetupWizard.apk
    • adb shell rm -f /system/priv-app/LineageSetupWizard/LineageSetupWizard.apk (in Recovery)
    • adb push LineageSetupWizard.apk /system/priv-app/LineageSetupWizard/
    • adb shell chown root.root /system/priv-app/LineageSetupWizard/LineageSetupWizard.apk
    • adb shell chmod 644 /system/priv-app/LineageSetupWizard/LineageSetupWizard.apk
    • adb reboot
    How It Can Be Improved
    The above solution is a bit crude, a better workaround could be one of these:
    • It should be possible to remove the APK and reproduce the steps it does to set the device as provisioned programmatically. The following discussion, which describes how to trigger the Setup Wizard (AOSP, not LineageOS) when it has already run, could be useful: https://android.stackexchange.com/q...-setup-wizard-at-next-boot-using-command-line
    • Alternatively, it should be possible to preload a simple APK that includes a customized wizard script, which then runs in place of the stock one. Thus, the equivalent result could be obtained without decompiling the stock APK. I could only find two articles in Chinese describing this process but it's more or less clear what the steps are: https://blog.csdn.net/Aaron121314/article/details/78355652 and http://lib.csdn.net/article/android/6988. In fact, the Lineage Setup Wizard APK already includes a "user" wizard script that just goes straight to the finish, although it's not obvious how to trigger it.
    Related Material
    Hope some of this helps someone running into the same issue.
    1
    yay, thats nice, but I prefer to set some defaults, so less clicks are needed for the setup wizard not only during engineering ;)