[DEV] How to add EDT Tweaks support in your odexed ROM/Themes

Search This thread

LeoMar75

Retired Recognized Developer / Retired Forum Mod
Apr 20, 2011
3,102
6,252
48
Pescara
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!
  1. Copy deodexed SystemUI.apk to place-apk-here-for-modding folder
  2. Start Script.bat (don't close this windows we will use it later on)
  3. Select option "19) Select compression level for apk's" and hit 0
  4. Set current project (option 22)
  5. Decompile apk (option 9)
  6. go to projects\SystemUI.apk\res\layout and overwrite status_bar.xml with the file attached
  7. 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
  8. go to projects\SystemUI.apk\smali\com\android\systemui\statusbar\policy and overwrite StatusBarPolicy.smali with the one inside the zip file attacched
  9. go back to the apk-manager windows (cmd.exe windows started with Script.bat) and select "Compile apk" (option 11)
  10. just answer "yes" to the two questions you will promt!
  11. 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
  12. Go back to the apk-manager windows and press enter to continue!
  13. 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:
Code:
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.

Code:
> 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

Code:
# 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.

Code:
# 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

Code:
# 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 EDT_sources.zip
 
Last edited:

ExilHh

Senior Member
Jan 24, 2009
693
135
Nuremberg
OK, after the 1st quick overview i must say...i like my LeoMAR ROM as it is now! ;o)

Never done something like that before and i don´t wanna challenge my luck too much...
 
Last edited:

stefanoccio

Senior Member
Nov 16, 2009
61
1
Napoli
mmmh?

Can i have an italian guide to apply this on my odexed rom? i never use this program...i know only how install a rom! now i have a tweaky rom v2 on my sgs
is it possible to do??? grazie infinite!!!
 

battax

Senior Member
Feb 12, 2008
332
17
Odivelas
Redmi K20 Pro
Code:
.method private final updateClock()V
    .locals 5

    .prologue
    .line 78
    new-instance v0, Ljava/util/Date;

    invoke-direct {v0}, Ljava/util/Date;-><init>()V

    .line 85
    .local v0, now:Ljava/util/Date;
    const/4 v1, 0x2
    const/4 v2, 0x0

    invoke-static {v1, v2}, Ljava/text/DateFormat;->getDateTimeInstance(II)Ljava/text/DateFormat;

    move-result-object v1

    invoke-virtual {v1, v0}, Ljava/text/DateFormat;->format(Ljava/util/Date;)Ljava/lang/String;

    move-result-object v1

    invoke-virtual {p0, v1}, Lcom/android/systemui/statusbar/DateView;->setText(Ljava/lang/CharSequence;)V

    .line 87
    return-void
.end method

Sorry for reviving this thread but i have a question.

With this code in DateView.smali i got an am/pm clock and i use a 24h format.

Anyone knows how to edit DateView.smali or StatusBarPolicy.smali to get a 24H format on the clock in the notification pulldown?

I´ve been searching and found some references but it looks a little "grey" to me, because they only refer on removing the am/pm and not displaying 24h format.

Is there a way to get the correct time format from this line?

Code:
invoke-static {v1, v2}, Ljava/text/DateFormat;->getDateTimeInstance(II)Ljava/text/DateFormat;

Thanks

Edit: If i change system language to Portuguese, the clock displays 24h format, but in english it only displays 12h. Still no go, i want to use english.
 
Last edited:

kahvitahra

Senior Member
Oct 19, 2010
1,022
1,143
Code:
.method private final updateClock()V
    .locals 5

    .prologue
    .line 78
    new-instance v0, Ljava/util/Date;

    invoke-direct {v0}, Ljava/util/Date;-><init>()V

    .line 85
    .local v0, now:Ljava/util/Date;
    const/4 v1, 0x2
    const/4 v2, 0x0

    invoke-static {v1, v2}, Ljava/text/DateFormat;->getDateTimeInstance(II)Ljava/text/DateFormat;

    move-result-object v1

    invoke-virtual {v1, v0}, Ljava/text/DateFormat;->format(Ljava/util/Date;)Ljava/lang/String;

    move-result-object v1

    invoke-virtual {p0, v1}, Lcom/android/systemui/statusbar/DateView;->setText(Ljava/lang/CharSequence;)V

    .line 87
    return-void
.end method

Sorry for reviving this thread but i have a question.

With this code in DateView.smali i got an am/pm clock and i use a 24h format.

Anyone knows how to edit DateView.smali or StatusBarPolicy.smali to get a 24H format on the clock in the notification pulldown?

I´ve been searching and found some references but it looks a little "grey" to me, because they only refer on removing the am/pm and not displaying 24h format.

Is there a way to get the correct time format from this line?

Code:
invoke-static {v1, v2}, Ljava/text/DateFormat;->getDateTimeInstance(II)Ljava/text/DateFormat;

Thanks

Edit: If i change system language to Portuguese, the clock displays 24h format, but in english it only displays 12h. Still no go, i want to use english.

Hi!

Getdatetimeinstance gets time format depending to your locale, like you said. With simpledateformat you can achive that what you are looking for.

Im on phone now so cant paste links, but you can navigate to my thread from my signature. There is edt + custom date format. You can pick code from there or just use that the way its done. There is also moded settings.apk so that you can put any format you like in that notification date/time. Affected files are told in those posts.
 

_JKay_

Retired Recognized Developer
Aug 12, 2010
5,495
14,689
I believe you can have a deodexed app on your odexed rom. Just remember to remove (backup) the 2 odexed files and clear dalvik-cache.

PS: this is true only for files in the app folder! Not in the framework folder!

Pps: I should include some of this mod in my mod :)

Thanks!

Sent from my GT-I9100 using xda premium
 

Top Liked Posts

  • There are no posts matching your filters.
  • 10
    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!
    1. Copy deodexed SystemUI.apk to place-apk-here-for-modding folder
    2. Start Script.bat (don't close this windows we will use it later on)
    3. Select option "19) Select compression level for apk's" and hit 0
    4. Set current project (option 22)
    5. Decompile apk (option 9)
    6. go to projects\SystemUI.apk\res\layout and overwrite status_bar.xml with the file attached
    7. 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
    8. go to projects\SystemUI.apk\smali\com\android\systemui\statusbar\policy and overwrite StatusBarPolicy.smali with the one inside the zip file attacched
    9. go back to the apk-manager windows (cmd.exe windows started with Script.bat) and select "Compile apk" (option 11)
    10. just answer "yes" to the two questions you will promt!
    11. 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
    12. Go back to the apk-manager windows and press enter to continue!
    13. 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:
    Code:
    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.

    Code:
    > 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

    Code:
    # 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.

    Code:
    # 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

    Code:
    # 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 EDT_sources.zip
    1
    Suggestion for thread title:

    How to add EDT Tweaks support in your odexed ROM/Themes. :)