What is "zipaligning"
The Android SDK includes a tool called zipalign that optimizes the way an application is packaged. Running this zipalign function against your applications enables Android to interact with them more efficiently at run time and thus has the potential to make it, and the overall system run faster. Most custom ROM's come with their apps zipaligned as standard, so you need not worry about anything bundled into the ROM itself.
The difficulty lies in how to zipalign any new .apk files that you subsequently install.
How is this acheived?
Most commonly, zipaligning newly installed applications is done on a boot of the hansdet via a startup script in /system/etc/init.d. It will usually have a file name that logically has "zipalign" included in it. For example, in CheckROM V6, this file is called S96zipalign
. Now each ROM may be different, but typically, this script will look through every .apk file found in /system/app and /data/app folders, and will zipalign each application it finds if it has not been done already. The actual zipalign process is performed by the Android SDK program, /system/xbin/zipalign.
How does ZipAlignRestore fit in?
I have just discovered what may be considered a fairly significant flaw in CRR6, and all its previous versions, and indeed in every other custom ROM that I've looked into (by examining the ROM's installation .zip files). The Android SDK zipalign program itself is NOT bundled in with the ROM. So in essence, the init.d script will try to zipalign your applications, but nothing will actually be done as the important program that performs this task is missing
I have therefore developed a CWM flashable zip to do this. It restores the missing zipalign program into /system/xbin so that the init.d script will actually succeed in zipaligning any non pre-loaded ROM .apk's (ie. the ones you install after the initial flash). It does not
restore an init.d script to perform the zipaligning on bootup, as not all ROMs will have this feature in the startup scripts. As each ROM could be different, I have omitted this intentionally.
After flashing ZipAlignRestore,
all your own, non-ROM apps will then become zipaligned on the next boot, providing of course you have a zipalign script in init.d
If you do not have a file similar to zipalign in /system/etc/init.d then your ROM is not attempting to retrospectively zipalign, so there is no point flashing ZipAlignRestore
as it will have absolutely no effect on you. If you already have a file called /system/xbin/zipalign, then again, there is no point flashing ZipAlignRestore
, as you already have the necessary tools to perform this task.
can be downloaded in post#2 below
NeatLite 1.2 correctly zip-aligns, so you will not need to concern yourself over this if on this ROM.