[Galaxy S II Android Development] LeoMar75:
Original Threads (deodexed ROM/Themes)

[MOD] [JVP] Statusbar Tweaks - EDT

[MODS][MORPH] Kahvitahra's mods - EDT TWEAK

How to get it working on an ODEXED ROM!

The only file we are going to modify is /system/app/SystemUI.apk

If you already got this apk deodexed skip to step#2 (you can check for it by opening SystemUI.apk and check if classes.dex is already present)

Step#1 (baksmali)

You need to baksmali SystemUI.apk, i suppose you already know how to do it, if not just use search button!!!

Step#2 (apk-manager)

I am using apk-manager, so before to continue make sure you already have this tool installed and working!

Copy deodexed SystemUI.apk to place-apk-here-for-modding folder

Start Script.bat (don't close this windows we will use it later on)

Select option "19) Select compression level for apk's" and hit 0

Set current project (option 22)

Decompile apk (option 9)

go to projects\SystemUI.apk\res\layout and overwrite status_bar.xml with the file attached

go to projects\SystemUI.apk\smali\com\android\systemui\statusbar and copy the following files from the attached zip file: BatteryText$1.smali, BatteryText$SettingsObserver.smali, BatteryText.smali, Clock$1.smali, Clock.smali, DateView.smali

go to projects\SystemUI.apk\smali\com\android\systemui\statusbar\policy and overwrite StatusBarPolicy.smali with the one inside the zip file attacched

go back to the apk-manager windows (cmd.exe windows started with Script.bat) and select "Compile apk" (option 11)

just answer "yes" to the two questions you will promt!

Now before to go ahead, you will notice that a new folder "keep" has been created, open up that folder and delete "classes.dex" and "resources.arsc" then go to res/layout folder and delete status_bar.xml

Go back to the apk-manager windows and press enter to continue!

At the end you will see in place-apk-here-for-modding folder you modified unsignedSystemUI.apk

Step#3 (odex back)

-Download and copy "dexopt-wrapper" on /system/bin

-In adb just type:

adb shell echo $BOOTCLASSPATH

you should use the above string later on!

-copy "unsignedSystemUI.apk" from your pc to your /sdcard/mod folder (create this folder) and rename it to SystemUI.apk

-copy /sdcard/mod/SystemUI.apk to /sdcard/mod/done/SystemUI.apk, now open without extract it (use 7zip winrar..) and delete classes.dex.

> adb remount
> adb shell
# su
# cd /system/bin
# busybox chmod 755 dexopt-wrapper

Now you have right permission for dexopt-wrapper

Let's create a new .odex file from the SystemUI.apk file

# cd /sdcard/mod
# dexopt-wrapper SystemUI.apk new.odex [BOOTCLASSPATH]

fill in the value of BOOTCLASSPATH, without the []

do NOT continue until this command succeeds!

At this point your new.odex file won't work because dalvik virtual Machine store checksum for each packages which means that your new.odex file cannot pass this check on boot.

We will fix it:

Copy over the "signature" from the current(original one in your /system/app) .odex file into the new .odex file.

# busybox dd if=/system/app/SystemUI.odex of=new.odex bs=1 count=20 skip=52 seek=52 conv=notrunc

now replace the old .odex file with the new .odex file. Also we will copy the apk without classes.dex to /system/app

# cd /system/app
# busybox cp /sdcard/mod/new.odex SystemUI.odex
# busybox chmod 644 SystemUI.odex
# busybox cp /sdcard/mod/done/SystemUI.apk SystemUI.apk
# busybox chmod 644 SystemUI.apk
# sync
# reboot

That's it! :p:p

NOTE:

Remember to backup your system before you start doing it, because some time your phone won't boot, maybe because you made some mistake in the smali code you have changed...

I usualy prepare a zip package with the original file i am going to replace, therefore if something goes wrong i can flash them back via CWM the original one!

Hope it can help!

Thanks to Kahvitahra for source code and every single one in this community.

View attachment 681324