[Galaxy S 4 i9505 Android Development] hawkerpaul:
All the Boring In-Depth Details

ROMBlitz clears any unnecessary files it encounters on your device, wiping the internal SD card, keeping any files/folders that you have defined in /sdcard/tmp/Hawker/ROMBlitz_Keep.txt

Known temporary files are removed, along with ALL cache areas (which unlike a generic cache wipe, includes ALL individual application cache.), media thumbnails+database areas.

ROMBlitz will do all the work necessary for you to get your ROM as clean and clutter-free as possible!

ROMBlitz can be used to attempt to fix any minor problems your current ROM may have and possibly speed things up a little due to the space it frees up. Its worth giving this a try first before biting the bullet and performing a Factory Reset. You've got nothing to lose. However, ROMBlitz is not a cure for all evils, so don't expect miracles. Just remember its primary function, first and foremost, is to free up space on your device by removing unnecessary files and removing cache so that it gets regenerated.

Background Information - Remember Your First Boot?

When you booted your ROM up for the very first time, you would have noticed that it spent a very long time on the boot animation screen. During this time, your new ROM was generating individual application cache, and building all the necessary Android folders on Internal+External SD Cards for the applications in the new ROM to use.

After the initial boot animation screen completed, you would have seen the Android is upgrading, Optimising app xxx of xxx message. This is where Android builds up its all its Dalvik-cache area for the apps.

Once the ROM had settled down after this first boot (after the initial media scanner operations completed) you probably would have noticed that your new ROM was lovely and crisp and snappy.

ROMBlitz wipes all these areas, giving your ROM this fresh start again

The next power-up of your device after running ROMBlitz you will notice your device will take a long time to boot, as it has to perform all of the things that it did on your very first boot again. The boot animation screen will be running for quite some time, followed by the Android is upgrading, Optimising app xxx of xxx message.

Don't forget that known media areas will have also been wiped, so the Media Scanner will need to do far more work than usual on the next boot after a ROMBlitz, so expect the device to be quite laggy for a period of time afterwards.

You may also notice many applications are slower opening the first time you use them after a ROMBlitz. This is just the application re-initializing the any areas that may have been wiped.

When Should I Flash ROMBlitz?

If you frequently jump from ROM to ROM using Nandroid backup/restores, or are constantly flashing different ROMs, then you can very quickly gather tons of clutter on both your Internal and external SD cards. Every ROM you use creates its own folders on both SD Cards (TW ROMS especially!) thereby leaving large amounts of unnecessary files/folders on the cards between ROM-jumps. (unless of course you format the Internal SD Card, and remove /Android folder from the External SD manually each time before changing your ROM)

ROMBlitz will remove all this accumulated clutter on your Internal+External SD cards for you and deep-clean all the built up cache areas, giving your current/restored/new ROM the cleanest base possible to work from.

1. ROMBlitz before by a Nandroid Restore

Your SD Cards will be cleaned up, so expect a longer wait on the subsequent boot animation screen. All cache/media areas will be as of the time of the Nandroid backup, so you shouldn't expect to see the Android is upgrading, Optimising app xxx of xxx message.

2. ROMBlitz after a Nandroid Restore

All the cache and media areas previously mentioned will be cleared on your just-restored ROM, along with the areas described on both SD Cards. On the next boot you will see boot animation screen for a long time whilst the SD Card and application cache areas get rebuilt, followed by the Android is upgrading, Optimising app xxx of xxx message, as the Dalvik areas get regenerated.

3. ROMBlitz before you flash a new ROM

Regardless of if you are flashing a custom ROM through CWM or stock firmware with Odin, it's always a good idea to do a ROMBlitz beforehand. Doing so will clear the SD Card areas for you giving your new ROM the freshest, cleanest possible start.

4. ROMBlitz at any time on your current ROM

Flash ROMBlitz at any time if you just want to free up space and deep-clean your cache. Just expect a long boot next time.

5. ROMBlitz when you are experiencing problems

If you are experiencing problems with some applications behaving erratically or FC'ing, or perhaps you have a bootloop and you are contemplating a Factory Reset, then consider flashing ROMBlitz first. It may help you out, you never know. It's well worth a try before going the whole-hog, and jumping into a Factory Reset. You won't have anything to lose!

ROMBlitz Steps

Removes [int-sd]/Android and [ext-sd]/Android folders

Remove ALL files+folders from Internal SD card, except for any defined in /sdcard/tmp/Hawker/ROMBlitz_Keep.txt

Delete ALL known temporary files found on the entire device

Remove ALL known media cache, databases, thumbnails etc. found on the entire device, and create .nomedia file in known areas that do not require media files, in order to speed up the Media Scanner process

Wipe dalvik cache from /data and /cache areas

Wipe all known cache areas from /cache, /data/system/cache and all individual application cache

Defining What You Want To Keep On Internal-SD

On the very first run of ROMBlitz, /sdcard/tmp/Hawker/ROMBlitz_Keep.txt will get automatically generated and the script then exits immediately, allowing you to reboot and edit this file to you own requirements.

This file's initial contents of areas to keep are:

snap_settings.bin

clockworkmod

data

DCIM

GravityBox

HawkerCore

IMEIBackup

Llama

LightManager

TitaniumBackup

TWRP

TopNTP

ViPER4Android

You MUST manually edit this file so that the files YOU want to keep on your Internal SD Card do not get wiped!

If you want to, you can manually create this file before the first run of ROMBlitz. Doing so would allow the script to run as normal on its very first run without the need to exit to edit. If you want to do this, then use a text editor on your device, or if done on your PC, use Notepad++ and ensure EOL is set to UNIX (LF). Create a folder called /sdcard/tmp/Hawker and copy this file into there.

Notes

If you always want ROMBlitz to wipe the ENTIRE Internal SD, you can do so by manually creating /sdcard/tmp/Hawker/ROMBlitz_KeepNone

[int-sd]/0 and [int-sd]/tmp folders will never be deleted by the script, even if the above file has been created

[int-sd]/Android and [ext-sd]/Android will always be deleted, even if included in the list of files to keep

Test Mode

You can call ROMBlitz.sh (which is in the tmp folder of the zip file) in Test Mode. This goes through all the motions as per a standard Recovery run, but it does not remove any files/folders in any way, and merely shows the commands that would have been executed. If you want to do this, then simply extract ROMBlitz.sh from the zip onto your device, and run it from there through a script manager type of application, through a terminal emulator, or adb shell.

Log File

A lot goes on during a ROMBlitz run, so everything that happens gets logged in /sdcard/tmp/Hawker/ROMBlitz.log for you subsequently examine if you need to.