[Galaxy Note 3 Themes and Apps] Eleo:
"How-To" Post​

In this post you will see some examples of what can be done using flashable zips. The examples mostly will be provided as singular usage, but you can also mix the method in one flashable zip (for example make an aroma-flashable zip, that acts as deleting some folders/files, extracting files into root folder, before changing an xml value after changing an apk via vrtheme method). These are not golden rules, I just brought up what I can remember. If I can be helpful, this will give a smile on my face

:)

1.

How to Prepare a simple Flashable Zip

​

All MODs (at least for now) are zips that are flashable in recovery. To build a flashable zip, you need to:

1. Download an example simple flashable zip

2. Download and install Notepad ++ or Atom Editor

3. Download and install 7zip File Manager

Now, every flashable zip has to have "META-INF" folder. Inside "META-INF\com\google\android" folder you will find "update-binary" and "updater-script" (other than in aroma-flashable zips, where you will find aroma files too). Update-binary should stay as it is. But "updater-script" can be changed depending on need.

An example updater-script has been provided as:

ui_print("Starting");
unmount("/system");
unmount("/data");
unmount("/preload");
unmount("/cache");
ui_print("Mounting Partitions");
run_program("/sbin/busybox", "mount", "/system");
run_program("/sbin/busybox", "mount", "/data");
run_program("/sbin/busybox", "mount", "/dalvik");
ui_print("Placing files");
package_extract_dir("system", "/system");
package_extract_dir("data", "/data");
ui_print("Unmounting Partitions");
unmount("/system");
unmount("/data");
unmount("/cache");
ui_print("Done!");

This script has important parts that can be explaines as shown below:

- ui_print("..."); --> What is written in screen while flashing is going on. You can put explanatory stuff as "

Flashing Circle checkbox MOD

" or "

Flashing Nougat Gallery

" and etc inside quotes (").

- unmount and mount --> Before flashing a zip, it is important to mount required partition. If files to be flashed are inside "

/data

" then you have to mount "

data

" firstly, then afterwards unmount "

data

"

- package_extract_dir --> This shows where the files will be extracted to. If you have files to be flashed in "

/system

" folder, then you need to have a line saying "

package_extract_dir("system", "/system")

". Here, it means that the files inside "system" folder of zip will be placed into "/system" folder in the root folder of phone.

By modifying these regions you can assign which files will be sent to which folder while flashing. To learn more, feel free to look at the zips shared in this thread.

When you need to change a flashable zip, dont extract it. You need to get used to work with 7zip file manager. Open the flashable zip with 7zip, then select a file that you want to edit. For example let's say you want to edit updater-script. Open zip with 7zip, go to META-INF\com\google\android folder inside zip and locate updater-script. You can see that it has no extension. Now, select it and drag it outside the zip (for example to desktop or any other folder inside computer). After finishing editing, use same principle for placing file inside the zip; as in, select the file outside the zip, then drag it inside the zip. There will be a prompt saying "Are you sure you want to copy files into archive?", click "yes".

Now, any changes done in updater-script or any other text file (for example scripts with ".sh" extension) has to be done using "Notepad++" (or similar neat text editor like "Atom Editor"). Never use "Notepad", "Wordpad", "Office Word" or other text editors (I have done that mistake, believe me). I try to drag any file that will be changed outside zip, edit it, then drag it back. I don't edit files that are opened from inside the zip.

2.

How to Prepare a File/Folder Cleaner Flashable Zip

​

File/Folder Cleaner is an easier version of flashable zip. Mostly, such zips contain lines for deleting folders/files in META-INF/com/google/android/updater-script file. Two main deleting lines in updater-script are "delete" and "delete-recursive". Delete command removes a file, whereas delete_recursive removes a folder. An example provided below is showing both delete commands.

As always, you firstly need to mount the folder which you will edit. As default, /system, /data and /cache are mounted even if not all of them are changed. Then, the delete and/or delete_recursive lines. And lastly, obviously you need to unmount mounted folders.

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

delete_recursive("/system/priv-app/SamsungBilling");
delete("system/app/AdvSoundDetector_2015/AdvSoundDetector_2015.apk");

run_program("/sbin/busybox", "unmount", "/system");
run_program("/sbin/busybox", "unmount", "/data");
run_program("/sbin/busybox", "unmount", "/cache");

3.

How To Prepare an XML Editor Zip

​

These zips require an sh script. For example, a script to change a line from "bikemode|globalaction" to false is as follows:

#!/sbin/sh
sed -i 's/ConfigBikeMode>bikemode|globalaction/ConfigBikeMode>FALSE/g' /system/csc/feature.xml

These were used for example in S8 TWHome zip. To have a working S8 TWHome on MagMa-NX without FC you have to change "support_nfc_hw_keyboard" from "true" to "false" in floating_feature.xml. For that case you need following script:

#!/sbin/sh
sed -i 's/SUPPORT_NFC_HW_KEYBOARD>TRUE/SUPPORT_NFC_HW_KEYBOARD>FALSE/g' /system/etc/floating_feature.xml

Such script editors are mostly beneficial for users that dont have root access to change files in root folder.

To run such scripts, you also need extra lines in updater_script. Firstly, you need to copy the script to phone to be able to run it. So, you require a package_extract_dir function to copy files from zip to phone. For sh scripts, the de facto rule is to copy it into /tmp folder, since it will be removed after being executed. After copying file, you obviously need to give the correct permissions, which are set_perm(0, 0, 0777, "/tmp/xxx.sh"). Then, you execute the script with run_program line. Lastly, you remove the whole /tmp folder with delete_recursive. It looks like this:

package_extract_dir("nxteam/script", "/tmp");
set_perm(0, 0, 0777, "/tmp/feature.sh");
run_program("/tmp/feature.sh");
delete_recursive("/tmp");

For our example, the feature.sh was taken from S8 TWHome script, where the support_nfc_hw_keyboard was turned from "true" to "false".

4.

How to Prepare a VRTheme-Flashable Zip

​

"Original VRTheme engine is copyright VillainROM 2011"​

To build a VRTheme flashable zip, you need to:

1. Download an example VRTheme flashable zip

2. Download and install Notepad ++ or Atom Editor

3. Download and install 7zip File Manager

VR in VRTheme, is abbreviation of Villain Rom, but not virtual reality. Now, in vrtheme engine, the developer has written a code that can directly change the files inside apk. As you know, apk is in a zipped format, as in, you can explore inside of it using a zip-folder viewing program. You can do it on android too. I am using Mixplorer file manager for android with its archive add-on for that case.

Let's turn back to topic. As you can see, there are differences inside a decompiled apk and an apk opened via file/zip manager. Depending on app type, you can see

classes.dex, classes2.dex, resources.arsc

and etc in apk opened via file/zip manager. These include smali folder and values folder (for details, reader is referred to google). Other folders inside /res directory (like layout, anim and drawable) are open to editing via this method. Basically, this engine enters apk using zip archive, does editing inside it and then exits apk.

I told above that the layout, anim and drawable folders are prone to changes via this method (examples are "Circle Checkbox MOD", "Hidden Button MOD" and "Center Clock MOD"). But dont think only they can be changed. No. If the changes are only inside smali or values folder, you can again use this method. But now, instead of changing some images in drawable or xml files in layout, you will have to replace whole that file (classes.dex, classes2.dex, resources.arsc and etc). This method was also used, in "Enable NavBar MOD" (explained in further below the paragraph).

Differences in files flashed via vrtheme is that you have to use files extracted from inside apk, not use decompiled files. For example if you need to replace an xml inside an apk, you cannot use an edited xml decompiled from apk. You have to firstly compile the edited apk, then take that file out of that zip and place inside vrtheme zip. That is the only way for vrtheme edited apk to function normally.

Inside the zip you will find nxteam folder, where you will see "icons" and "vrtheme" folders. You shouldnt touch vrtheme folder. You will place the files inside "icons" folder. Inside vrtheme folder, you will find installtheme.sh script, where you will see lines starting like these:

# start with /system/app
...
# repeat for /system/priv-app
...
# repeat for /system/framework
...
# create restore zip from backup apks
...

This means, the vrtheme can change apks inside these folders. When placing a file from inside an apk, you should not put a zipped or apk file. You have to put the file as extracted from compiled apk. An example from "Enable NavBar MOD":

- Here, I needed to replace resources.arsc from edited framework (bools.xml inside values folder was edited) into framework-res.apk inside system/framework and replace icons of navbar from marshmallow with the ones from S8 inside systemUI.apk. So what I did was, I edited those apk, replaced in my phone, checked that they are working, then I extracted those files from inside compiled apk (since changes in framework-res were in values folder (vlaues/bools.xml), I had to replace whole resourses.arsc; whereas for systemUI the changes were only in drawable fikes inside /res/drawable which can be changed directly) and put inside required folders. I placed both framework folder and priv-app folder inside a "system" folder, then replaced the files that needed to be changed.

Lastly, I dont advise changing updater-script inside META-INF folder of vrtheme flashable zips.

5.

How to Prepare an Aroma-Flashable Zip

​

For this part, you can head to Flashable zip creator thread maintained by [MENTION=4867515]Nikhil[/MENTION] and [MENTION=1852653]RajatPatel[/MENTION]

:o