The Samsung Galaxy S4 and the HTC One have a lot in common. Both these devices represent the very best in terms of both hardware and software that the Android smartphone industry has to offer, and are the pride of their manufacturers. Also, both these devices come in two variants: the standard version running the respective manufacturer’s tweaked OS (Samsung’s Touchwiz and HTC Sense), and the Google Play editions that run stock Android the way it’s built by Google and shipped on Nexus devices. Though what if a user wants to experience both variants of the OS on the same device? We recently took a look at dual-booting HTC Sense and Google Play Edition stock Android on HTC One, and the same is also possible on the Galaxy S4 now, thanks to Grarak’s Rom Switcher.

Brought to us by XDA-Developers Senior Member Grarak, this nifty tweak lets you dual-boot not just the Google Play edition ROM, but any AOSP-based ROM on your Galaxy S4 that’s already on the stock Samsung TouchWiz ROM. The AOSP ROM basically runs from the cache partition, and the location for the cache partition of the TouchWiz ROM has been changed to accommodate it. Do note that the ROM is currently in alpha state, though it’s working fine as a daily driver according to the developer and the users who have tried it so far.

So, without any further ado, let’s get the whole thing up and running on your Galaxy S4.

Disclaimer: Please follow this guide at your own risk. AddictiveTips will not be liable if your device gets damaged or bricked during the process.

Requirements

International Samsung Galaxy S4 I9500 running the latest stock TouchWiz ROM. Do NOT attempt to use this method with any other variant of the S4, or any other phone.

Root access and a custom recovery such as TWRP or ClockworkMod installed on the phone

Procedure

Open the AOSP ROM that you downloaded in 7-zip (or an archiving utility of your choice).

Go to META-INF/com/google/android/ and drag out the updater-script file to your desktop or any Windows Explorer window.

Open the updater-script file in Notepad++ (or the editor of your choice).

Find this line:

mount("ext4", "EMMC", "/dev/block/mmcblk0p20", "/system");

and replace it with this:

mount("ext4", "EMMC", "/dev/block/mmcblk0p19", "/system");

Now find these two lines (that may or may not be together) and delete them:

format("ext4", "EMMC", "/dev/block/mmcblk0p20", "0", "/system");

and

package_extract_file("boot.img", "/dev/block/mmcblk0p9");

Save the updater-script file and drag it back onto 7-zip with the ROM still open in it in the same location where you dragged the file out from. Confirm when asked if you want to replace the file.

Similarly open the zip file of the gapps package in 7-zip and drag out the same updater-script file from the same location in it to your desktop or any Windows Explorer window, opening it in Notepad++ the same way.

Find this line:

run_program("/sbin/busybox", "mount", "/system");

and replace it with this:

mount("ext4", "EMMC", "/dev/block/mmcblk0p19", "/system");

Save this updater-script file the same way as well, and drag it back into 7-zip with the gapps zip file still open in it at the same location, confirming when prompted to replace the file.

Transfer both the ROM as well as the gapps package to your phone’s internal storage.

Reboot your S4 into recovery.

Flash the ROM followed by the gapps package, and make sure NOT to wipe anything.

Reboot your phone. You should be back into your stock TouchWiz ROM.

Now install Grarak’s Rom Switcher app from its APK file and open the app once installed.

The app will then set everything else up for you; just follow any steps it shows you.

You should now be able to use the Rom Switcher app for rebooting your phone into the AOSP ROM. While this is all you need for this dual-boot mod to work, there are a few things you need to keep in mind. Since the default partitioning structure has been altered in order to make dual-booting possible, you’ll need to wipe partitions and reinstall the AOSP ROM if you need, accordingly. You can find instructions by the developer for these in the second post at the forum thread linked at the end of this post.

For bug reports, help with issues, feature requests and staying up-to-date with further developments, visit the XDA-Developers forum thread linked below.