Go Back   Android Forums > Android Phones > Samsung Galaxy S2 (International) > Galaxy S2 (International) - All Things Root

Get excited for the Samsung Galaxy S5! Find everything you need and discuss it in our Galaxy S5 Forum!

test: Reply
 
LinkBack Thread Tools
Old February 29th, 2012, 05:27 PM   #1 (permalink)
Senior Member
Thread Author (OP)
 
Hawker's Avatar
 
Join Date: Aug 2011
Location: UK
Posts: 3,749
 
Device(s): GT-I9505 Firmware: Danvdh GE 4.4.2 Kernel: KT BL: MGA GSM: XXUFNC9 LTE: XXUBMH1
Carrier: EE UK (4G)

Thanks: 536
Thanked 1,712 Times in 1,049 Posts
Default My zipalign restore script

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.


ZipAlignRestore can be downloaded in post#2 below

NOTE:
NeatLite 1.2 correctly zip-aligns, so you will not need to concern yourself over this if on this ROM.

__________________
Device: Samsung GT-I9505 ROM: Danvdh GE 4.4.2 Kernel: KT GSM: XXUFNC9 LTE: XXUBMH1 B/L: MGA

My Scripts
My Web Site
Hawker is online now  
Last edited by Hawker; June 25th, 2012 at 01:02 PM.
Reply With Quote
The Following 4 Users Say Thank You to Hawker For This Useful Post:
ironass (March 1st, 2012), Kuragari (March 2nd, 2012), Shotgun84 (March 1st, 2012), Sydney99 (March 1st, 2012)
sponsored links
Old February 29th, 2012, 05:27 PM   #2 (permalink)
Senior Member
Thread Author (OP)
 
Hawker's Avatar
 
Join Date: Aug 2011
Location: UK
Posts: 3,749
 
Device(s): GT-I9505 Firmware: Danvdh GE 4.4.2 Kernel: KT BL: MGA GSM: XXUFNC9 LTE: XXUBMH1
Carrier: EE UK (4G)

Thanks: 536
Thanked 1,712 Times in 1,049 Posts
Default

Download:

ZipAlignRestore
Hawker is online now  
Last edited by Hawker; January 3rd, 2013 at 11:02 AM.
Reply With Quote
Old March 1st, 2012, 03:37 AM   #3 (permalink)
Senior Member
 
Sydney99's Avatar
 
Join Date: Jul 2011
Location: UK
Posts: 1,570
 
Device(s): Galaxy S4: ECHOE KitKat + Philz + ML6 modem
Carrier: Vodafone

Thanks: 453
Thanked 414 Times in 303 Posts
Default

So this will need to be reapplied after every kernel flash?
Sydney99 is offline  
Reply With Quote
Old March 1st, 2012, 04:26 AM   #4 (permalink)
Senior Member
Thread Author (OP)
 
Hawker's Avatar
 
Join Date: Aug 2011
Location: UK
Posts: 3,749
 
Device(s): GT-I9505 Firmware: Danvdh GE 4.4.2 Kernel: KT BL: MGA GSM: XXUFNC9 LTE: XXUBMH1
Carrier: EE UK (4G)

Thanks: 536
Thanked 1,712 Times in 1,049 Posts
Default

No butty, its an omission of the ROM itself. You will only need to run this after you flash a new ROM.
Hawker is online now  
Reply With Quote
The Following User Says Thank You to Hawker For This Useful Post:
Sydney99 (March 1st, 2012)
Old March 1st, 2012, 09:02 AM   #5 (permalink)
AF Contributor
 
Join Date: Jul 2011
Location: Oxford
Posts: 65
 
Device(s): Nexus 4 Samsung Galaxy S2 iPad 3
Carrier: Not Provided

Thanks: 7
Thanked 8 Times in 7 Posts
Default

Hi Hawker,

this looks great. Forgive me for being a newb but what benefit will this give?

Is it risky? I am currently running AndyX ROM ICS and don't want to brick as I'm in the US on business and wouldn't be able to restore
suparuss is online now  
Reply With Quote
Old March 1st, 2012, 09:53 AM   #6 (permalink)
Senior Member
Thread Author (OP)
 
Hawker's Avatar
 
Join Date: Aug 2011
Location: UK
Posts: 3,749
 
Device(s): GT-I9505 Firmware: Danvdh GE 4.4.2 Kernel: KT BL: MGA GSM: XXUFNC9 LTE: XXUBMH1
Carrier: EE UK (4G)

Thanks: 536
Thanked 1,712 Times in 1,049 Posts
Default

Quote:
Originally Posted by suparuss View Post
Hi Hawker,

this looks great. Forgive me for being a newb but what benefit will this give?

Is it risky? I am currently running AndyX ROM ICS and don't want to brick as I'm in the US on business and wouldn't be able to restore
Included some background information in post #1 that may clear things up.

Only question mark in your case is if the zipalign program is compatible, as you are on a leaked ICS ROM.
Hawker is online now  
Reply With Quote
The Following User Says Thank You to Hawker For This Useful Post:
suparuss (March 1st, 2012)
Old March 1st, 2012, 01:47 PM   #7 (permalink)
AF Contributor
 
Join Date: Jul 2011
Location: Oxford
Posts: 65
 
Device(s): Nexus 4 Samsung Galaxy S2 iPad 3
Carrier: Not Provided

Thanks: 7
Thanked 8 Times in 7 Posts
Default

Thanks Hawker, I understand a bit better now.

I think then I'll wait a couple of days - when an official ICS build is released, in theory it would be possible to get that ZipAlign apk and that would be more likely to work?
suparuss is online now  
Reply With Quote
Reply


Go Back   Android Forums > Android Phones > Samsung Galaxy S2 (International) > Galaxy S2 (International) - All Things Root
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 04:20 PM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.