[GUIDE]How to add customizable 14 statusbar toggle buttons for samsung ROM

Search This thread

lidroid

Senior Member
May 5, 2011
207
860
Xi'an
I rebuild status bar power button in samsung rom in my national day holiday, now it has 14 buttons now, include all samsung buttons, wifi, data connection, gps, flashlight, sound, auto rotation, bluetooth, brightness, screen timeout, lock screen, sync, reboot and power down. Actually early time I coded some of those function in LidroidToolbox, but not included them in status bar. I actually rebuilt it with java, not just mod of samli.

This code can adapt to samsung i9000/i9100/i897/t959/m110s etc. I will port this in my new rom. The flashflight will display a white and brightest activity when the camera without flashlight, for example i9000/i897/t959/m110s etc.

Next I will explain how to adapt it to samsung 2.3 rom. There are 3 attachments QuickPanelSettings.apk, LidroidSystemUI.apk and lidroid-res.apk.

1. Download LidroidSystemUI.apk and decompile it whit apktool, then you get LidroidSystemUI dir.

2. Decompile SystemUI.apk, copy LidroidSystemUI/smali/* into SystemUI/smali.

3. Modify SystemUI/AndroidManifeset.xml, add this code before </Application>
Code:
      <activity android:name="com.lidroid.systemui.quickpanel.FlashlightActivity"
		android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
		android:clearTaskOnLaunch="true"
		android:configChanges="orientation|keyboardHidden"
		android:launchMode="singleTask" />
if your model has flashlight, you can skip this step.

4. Open SystemUI/smali/com/android/systemui/status/StatusBarService.smali. Find(Ctrl + F) QuickSettingsView, locate fellow codes
Code:
    const v7, 0x7f030002

    invoke-static {p1, v7, v9}, Landroid/view/View;->inflate(Landroid/content/Context;ILandroid/view/ViewGroup;)Landroid/view/View;

    move-result-object v3

    check-cast v3, Lcom/android/systemui/statusbar/quickpanel/QuickSettingsView;

    .line 379
    .local v3, qsv:Lcom/android/systemui/statusbar/quickpanel/QuickSettingsView;

modify

Code:
    const v7, 0x3030003

    invoke-static {p1, v7, v9}, Landroid/view/View;->inflate(Landroid/content/Context;ILandroid/view/ViewGroup;)Landroid/view/View;

    move-result-object v3

    check-cast v3, Lcom/lidroid/systemui/quickpanel/PowerWidget;

    .line 394
    .local v3, qsv:Lcom/lidroid/systemui/quickpanel/PowerWidget;
    invoke-virtual {v3}, Lcom/lidroid/systemui/quickpanel/PowerWidget;->setupWidget()V

5. Compile SystemUI with apktool, Sign it if you have modify AndroidManifest.xml. Push it into /system/app/

6. push lidroid-res.apk in /system/framework/, push QuickPanelSettings.apk in /system/app, reboot.


Simplicity, no need to modify layout, id and Strings which is painful. If you know how to do it, you will know how simple it is. Any android/rom developer can download this code and add more buttons.

Enjoy!
 

Attachments

  • 20111005114101.jpg
    20111005114101.jpg
    52.1 KB · Views: 73,118
  • 20111005114110.jpg
    20111005114110.jpg
    53 KB · Views: 57,346
  • 20111005114118.jpg
    20111005114118.jpg
    52.6 KB · Views: 55,189
  • lidroid-res.apk
    1,019.4 KB · Views: 20,844
  • SC20111015-145333.jpg
    SC20111015-145333.jpg
    18.6 KB · Views: 28,815
  • SC20111015-145344.jpg
    SC20111015-145344.jpg
    29 KB · Views: 35,177
  • SC20111015-145358.jpg
    SC20111015-145358.jpg
    23.4 KB · Views: 44,578
  • LidroidSystemUI.apk
    34.2 KB · Views: 19,002
  • QuickPanelSettings.apk
    54.4 KB · Views: 20,371
Last edited:

89luca89

Retired Recognized Developer
Apr 18, 2010
1,186
1,342
34
Terracina (LT)
thank you very much for this work!
I will study the code and try to develop also new toggles :D

Little question, the java source (god bless you! I HATE Smali! xD) is about systemUI, what about lildroid-res.apk?
Is it only a "complementar" framework for icons and string for the toggles? Or whatelse?
Just curiosity and little question to better understand the project!

Thx!
 

lidroid

Senior Member
May 5, 2011
207
860
Xi'an
thank you very much for this work!
I will study the code and try to develop also new toggles :D

Little question, the java source (god bless you! I HATE Smali! xD) is about systemUI, what about lildroid-res.apk?
Is it only a "complementar" framework for icons and string for the toggles? Or whatelse?
Just curiosity and little question to better understand the project!

Thx!

I compiled all required images, strings and layout that toggle buttons into lidroid-res.apk to make the future ROM transplant work easier and finish the new ROM's mod work faster.
 

89luca89

Retired Recognized Developer
Apr 18, 2010
1,186
1,342
34
Terracina (LT)
Ok understood thx that was only what I need to know :D
Maybe with a little more work can try to fuse it with framework.apk or twframework.apk but for now just knowing that will make things clearer to me :D
 

kolo200

Member
Jan 17, 2008
31
1
This way you can add a shortcut to the application?
I know silly question :D

thank you very much :)
sorry for my English
 
Last edited:

gcrutchr

Senior Member
Jun 11, 2009
1,573
739
73
Bangkok
my newest ROM was just based of XXKI3, maybe you missed some works.

Thanks for the reply.

Could you be a little more specific about what to copy and where to copy the files/folders from your lidroidSystemUI.apk to the stock SystemUI.apk.

I followed the steps multiple times using a stock, deodexed SystemUI.apk and all times no statusbar showed.

Or...could you post your SystemUI.apk so I can a look at how you inserted the folders into it.

Thanks.
 

Top Liked Posts

  • There are no posts matching your filters.
  • 275
    I rebuild status bar power button in samsung rom in my national day holiday, now it has 14 buttons now, include all samsung buttons, wifi, data connection, gps, flashlight, sound, auto rotation, bluetooth, brightness, screen timeout, lock screen, sync, reboot and power down. Actually early time I coded some of those function in LidroidToolbox, but not included them in status bar. I actually rebuilt it with java, not just mod of samli.

    This code can adapt to samsung i9000/i9100/i897/t959/m110s etc. I will port this in my new rom. The flashflight will display a white and brightest activity when the camera without flashlight, for example i9000/i897/t959/m110s etc.

    Next I will explain how to adapt it to samsung 2.3 rom. There are 3 attachments QuickPanelSettings.apk, LidroidSystemUI.apk and lidroid-res.apk.

    1. Download LidroidSystemUI.apk and decompile it whit apktool, then you get LidroidSystemUI dir.

    2. Decompile SystemUI.apk, copy LidroidSystemUI/smali/* into SystemUI/smali.

    3. Modify SystemUI/AndroidManifeset.xml, add this code before </Application>
    Code:
          <activity android:name="com.lidroid.systemui.quickpanel.FlashlightActivity"
    		android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
    		android:clearTaskOnLaunch="true"
    		android:configChanges="orientation|keyboardHidden"
    		android:launchMode="singleTask" />
    if your model has flashlight, you can skip this step.

    4. Open SystemUI/smali/com/android/systemui/status/StatusBarService.smali. Find(Ctrl + F) QuickSettingsView, locate fellow codes
    Code:
        const v7, 0x7f030002
    
        invoke-static {p1, v7, v9}, Landroid/view/View;->inflate(Landroid/content/Context;ILandroid/view/ViewGroup;)Landroid/view/View;
    
        move-result-object v3
    
        check-cast v3, Lcom/android/systemui/statusbar/quickpanel/QuickSettingsView;
    
        .line 379
        .local v3, qsv:Lcom/android/systemui/statusbar/quickpanel/QuickSettingsView;

    modify

    Code:
        const v7, 0x3030003
    
        invoke-static {p1, v7, v9}, Landroid/view/View;->inflate(Landroid/content/Context;ILandroid/view/ViewGroup;)Landroid/view/View;
    
        move-result-object v3
    
        check-cast v3, Lcom/lidroid/systemui/quickpanel/PowerWidget;
    
        .line 394
        .local v3, qsv:Lcom/lidroid/systemui/quickpanel/PowerWidget;
        invoke-virtual {v3}, Lcom/lidroid/systemui/quickpanel/PowerWidget;->setupWidget()V

    5. Compile SystemUI with apktool, Sign it if you have modify AndroidManifest.xml. Push it into /system/app/

    6. push lidroid-res.apk in /system/framework/, push QuickPanelSettings.apk in /system/app, reboot.


    Simplicity, no need to modify layout, id and Strings which is painful. If you know how to do it, you will know how simple it is. Any android/rom developer can download this code and add more buttons.

    Enjoy!
    13
    thank you very much for this work!
    I will study the code and try to develop also new toggles :D

    Little question, the java source (god bless you! I HATE Smali! xD) is about systemUI, what about lildroid-res.apk?
    Is it only a "complementar" framework for icons and string for the toggles? Or whatelse?
    Just curiosity and little question to better understand the project!

    Thx!

    I compiled all required images, strings and layout that toggle buttons into lidroid-res.apk to make the future ROM transplant work easier and finish the new ROM's mod work faster.
    12
    [GUIDE] How to add customizable 15 statusbar toggle buttons on a Stock ICS LPQ ROM

    Hi every one,

    As promised, here is a guide on how to add the Wanam customizable 15 toggle buttons statusbar to a Samsung Stock Android 4.0.3 ICS LPQ ROM

    I have made it on a LPQ rom, but I suppose that this will work on any ICS rom, even on custom roms.

    Please, if you like this information, don't forget to give thanks to (go to each link and click on thanks button to the author):
    - lidroid for making this thread and make possible this wonderful statusbar http://xdaforums.com/showthread.php?t=1289896
    - sicopat for making the tutorial for deodexing and re-odexing http://xdaforums.com/showthread.php?t=1208320
    - wanam for his help and for the 15 toggle button statusbar from his rom http://xdaforums.com/showthread.php?t=1436817
    - sileshnair for his help http://xdaforums.com/showpost.php?p=23686975&postcount=605
    - M_J_Nazari for his help http://xdaforums.com/showpost.php?p=24059374&postcount=651
    - LegendK95 for his help http://xdaforums.com/showpost.php?p=24081656&postcount=655
    If I forgot to mention anyone please pm and I will edit


    First of all you need your phone rooted. Please don't ask how to root. Use search function.

    MAKE A BACKUP OF YOUR PHONE
    DO IT AT YOUR OWN RISK
    I AM NOT RESPONSABLE IF YOU BREAK YOUR DEVICE OR DROP YOUR COFEE !


    I will detail steps to make it on a Windows PC. On a linux or mac should be similar.

    Summarized steps are:
    - Deodex stock LPQ SystemUI.apk
    - Decompile wanam SystemUI.apk
    - Copied wanam 15 toggle button statusbar files to deodexed LPQ system folder
    - Copied "important" lines from wanam "PhoneStatusBar.smali" file
    - Created "classes.dex" file with smali
    - Opened original stock "SystemUI.apk" with 7zip and copied file "classes.dex" in root directory
    - Zipaligned the new SystemUI.apk
    - Decompile the new SystemUI.apk with Wanam APK Manager
    - Copied "important" lines from wanam "tw_status_bar_expanded.xml", "ids.xml" and "public.xml" files
    - Compile again with Wanam APK Manager
    - Zipaligned the new compiled SystemUI.apk
    - Deleted on the phone the file "/system/app/SystemUI.odex" (make a backup before)
    - Copied to the phone the new compiled and zipaligned file "SystemUI.apk" to "/system/app/"
    - Copied to the phone the file "QuickPanelSettings.apk" to "/system/app/"
    - Copied to the phone the file "lidroid-res.apk" to "/system/framework/"
    - Re-Odex SystemUI.apk if you want
    - Reboot into recovery
    - Clear dalvik cache
    - Reboot


    Ok, now I will detail all these steps:
    - Make a directory on your PC named "Working Directory"
    - Use "RootExplorer" or "ES Explorador de Archivos" to copy your entite "/system/framework/" directory to your "/sdcard/"
    - Use "RootExplorer" or "ES Explorador de Archivos" to copy "/system/app/SystemUI.apk" and "/system/app/SystemUI.odex" directory to your "/sdcard/framework/" directory
    - Copy your "/sdcard/framework/" from your phone to your "Working Directory" on your PC

    - Download "all_for_deodexing_reodexing.zip" from sicopat's thread http://xdaforums.com/showthread.php?t=1208320
    - Unzip "all_for_deodexing_reodexing.zip" to your "Working Directory" folder

    - Download the Wanam APK Manager from http://xdaforums.com/showpost.php?p=23935070&postcount=14
    - Unzip the Wanam APK Manager to "Working Directory\Wanam APK Manager"

    - Download and unzip WanamLite ROM from http://xdaforums.com/showthread.php?t=1436817
    - Copy WanamLite/system/app/SystemUI.apk as SystemUI.wanam.apk to "Working Directory\Wanam APK Manager\place-apk-here-for-modding\" folder

    - Run "Script.bat" from "Working Directory\Wanam APK Manager\"
    - Choose option 22 (set current project)
    - Choose "SystemUI.wanam.apk"
    - Choose option 9 (decompile)
    - Close script

    If your SystemUi.apk is odexed follow this steps:
    - Open a cmd window (Start --> Run --> cmd.exe)
    - Go to your "Working Directory"
    - To deodex SystemUI.apk run command "java -Xmx1024m -jar baksmali.jar -c :core.jar:bouncycastle.jar:ext.jar:framework.jar:android.policy.jar:services.jar:core-junit.jar -x SystemUI.odex"

    If your SystemUI.apk is deodexed (normal on custom ROMs) follow this steps:
    - Copy "Working Directory\SystemUI.apk" to "Working Directory\Wanam APK Manager\place-apk-here-for-modding\" folder
    - Run "Script.bat" from "Working Directory\Wanam APK Manager\"
    - Choose option 22 (set current project)
    - Choose "SystemUI.apk"
    - Choose option 9 (decompile)
    - Close script
    - Delete "Working Directory\Wanam APK Manager\place-apk-here-for-modding\SystemUI.apk"
    - Rename folder "Working Directory\Wanam APK Manager\projects\SystemUI.apk\smali" as ""Working Directory\Wanam APK Manager\projects\SystemUI.apk\out"
    - Move folder "Working Directory\Wanam APK Manager\projects\SystemUI.apk\out" to "Working Directory"
    - Delete folder"Working Directory\Wanam APK Manager\projects\SystemUI.apk"

    - Copy "Working Directory\Wanam APK Manager\projects\SystemUI.wanam.apk\smali\wanam" folder to "Working Directory\out\" folder
    - Copy "Working Directory\Wanam APK Manager\projects\SystemUI.wanam.apk\smali\com\android\wanam" folder to "Working Directory\out\com\android\" folder
    - Compare files "Working Directory\out\com\android\systemui\statusbar\phone\PhoneStatusBar.smali" with file "Working Directory\Wanam APK Manager\projects\SystemUI.wanam.apk\smali\com\android\systemui\statusbar\phone\PhoneStatusBar.smali". Ignore lines like ".registers...", ".prologue", ".locals...", ".line...", ignore "superficial" modifications like "goto_4" in one file and "goto_0" in the other file, etc. Copy only blocks related to the wanam 15 toggle button statusbar (tip: look for "wanam" word). At this moment (wanam 9.8) there are no lines to replace, all are lines to copy from wanam version to stock version. This blocks of lines to copy are:

    Code:
    .field mPowerWidget:Lcom/android/wanam/systemui/StBar/PowerWidget;

    Code:
    iget-object v1, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mPowerWidget:Lcom/android/wanam/systemui/StBar/PowerWidget;
    
    invoke-virtual {v1}, Lcom/android/wanam/systemui/StBar/PowerWidget;->updateWidget()V

    Code:
    const v0, 0x7f0e00bc
    
    invoke-virtual {v1, v0}, Lcom/android/systemui/statusbar/phone/ExpandedView;->findViewById(I)Landroid/view/View;
    
    move-result-object v0
    
    check-cast v0, Lcom/android/wanam/systemui/StBar/PowerWidget;
    
    iput-object v0, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mPowerWidget:Lcom/android/wanam/systemui/StBar/PowerWidget;

    Code:
    iget-object v0, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar;->mPowerWidget:Lcom/android/wanam/systemui/StBar/PowerWidget;
    
    move-object/from16 v1, v0
    
    invoke-virtual {v1}, Lcom/android/wanam/systemui/StBar/PowerWidget;->setupWidget()V

    Attached are the stock LPQ version, modified version and wanam version of this file.


    - Run command "java -Xmx1024m -jar smali.jar out -o classes.dex"
    - Open "Working Directory\SystemUI.apk" with 7zip
    - Drag and drop "Working Directory\classes.dex" into the 7zip window to add this file to the SystemUI.apk
    - Run command "zipalign -v 4 SystemUI.apk zip_SystemUI.apk"
    - Delete "SystemUI.apk" and rename "zip_SystemUI.apk" as "SystemUI.apk"
    - Now we have a deodexed and zipaligned SystemUI.apk with the first part of the modification done

    - Copy the new deodexed and zipaligned "Working Directory\SystemUI.apk" to "Working Directory\Wanam APK Manager\place-apk-here-for-modding\" folder
    - Run "Script.bat" from "Working Directory\Wanam APK Manager\"
    - Choose option 22 (set current project)
    - Choose "SystemUI.apk"
    - Choose option 9 (decompile)
    - Close script

    - Compare files "Working Directory\Wanam APK Manager\projects\SystemUI.wanam.apk\res\layout\tw_status_bar_expanded.xml" with file "Working Directory\Wanam APK Manager\projects\SystemUI.apk\res\layout\tw_status_bar_expanded.xml". Copy the line
    Code:
    <com.android.wanam.systemui.StBar.PowerWidget android:id="@id/exp_power_stat" android:layout_width="fill_parent" android:layout_height="wrap_content" />
    from wanam file to our modified file
    - Compare files "Working Directory\Wanam APK Manager\projects\SystemUI.wanam.apk\res\values\ids.xml" with file "Working Directory\Wanam APK Manager\projects\SystemUI.apk\res\values\ids.xml". Copy the line
    Code:
    <item type="id" name="exp_power_stat">false</item>
    from wanam file to our modified file
    - Compare files "Working Directory\Wanam APK Manager\projects\SystemUI.wanam.apk\res\values\public.xml" with file "Working Directory\Wanam APK Manager\projects\SystemUI.apk\res\values\public.xml". Copy the line
    Code:
    <public type="id" name="exp_power_stat" id="0x7f0e00bc" />
    from wanam file to our modified file


    - Run "Script.bat" from "Working Directory\Wanam APK Manager\"
    - Choose option 22 (set current project)
    - Choose "SystemUI.apk"
    - Choose option 11 (compile)
    - Close script

    - Delete "Working Directory\SystemUI.apk" (or rename it as SystemUI.deodexed.zipaligned.apk)
    - Copy "Working Directory\Wanam APK Manager\place-apk-here-for-modding\unsignedSystemUI.apk" to "Working Directory"
    - Run command "zipalign -v 4 unsignedSystemUI.apk SystemUI.apk"

    - Ok, now we have our new SystemUI.apk deodexed, zipaligned and ready to be copied to our phone
    - Now copy the following files to your phone, to /sdcard/15tbsb/:
    * "Working Directory\SystemUI.apk"
    * From the WanamLite ROM "WanamLite\system\app\QuickPanelSettings.apk"
    * From the WanamLite ROM "WanamLite\system\framework\lidroid-res.apk"
    * "Working Directory\dexopt-wrapper"

    - Then only left to copy each file to the right phone system folder with "Root Explorer" or "ES Explorador de Archivos":
    * Copy "/sdcard/15tbsb/SystemUI.apk" to "/system/app/" folder
    * Move "/system/app/SystemUI.odex" to "/sdcard/15tbsb/SystemUI.original.odex"
    * Copy "/sdcard/15tbsb/QuickPanelSettings.apk" to "/system/app/" folder
    * Copy "/sdcard/15tbsb/lidroid-res.apk" to "/system/framework/" folder

    - Now reboot and we should have the 15 toggle buttons statusbar in our phone :)


    At this moment we have a deodexed SystemUI.apk, if we want to re-odex it follow this steps (very summarized, if you have doubts look at http://xdaforums.com/showthread.php?t=1208320):
    - Run adb shell and put the following commands (you should have activated "USB Debug"):
    * su
    * mount -o rw,remount -t yaffs2, /dev/block/mtdblock /system (this should mount /system as read/write, you can also use "RootExplorer" or "ES Explorador de Archivos" to mount /system as r/w)
    * cp /system/app/SystemUI.apk /system/framework/
    * cp /sdcard/15tbsb/SystemUI.original.odex /system/framework/
    * dexopt-wrapper /system/framework/SystemUI.apk /system/framework/SystemUI.patched.odex /system/framework/core.jar:/system/framework/bouncycastle.jar:/system/framework/ext.jar:/system/framework/framework.jar:/system/framework/android.policy.jar:/system/framework/services.jar:/system/framework/core-junit.jar (this create our own odex file)
    * chmod 777 /system/framework/SystemUI.original.odex
    * chmod 777 /system/framework/SystemUI.patched.odex
    * busybox dd if=/system/framework/SystemUI.original.odex of=/system/framework/SystemUI.patched.odex bs=1 count=20 skip=52 seek=52 conv=notrunc (this copy signature from original odex to new odex file)
    * cp /system/framework/SystemUI.apk /system/app/
    * cp /system/framework/SystemUI.patched.odex /system/app/SystemUI.odex
    * cp /system/framework/SystemUI.patched.odex /sdcard/15tbsb/
    * rm /system/framework/SystemUI.apk
    * rm /system/framework/SystemUI.original.odex
    * rm /system/framework/SystemUI.patched.odex
    - Now reboot and you should have all working with SystemUI odexed

    At this point I had problems (no statusbar, but no error messages), I don't know why. I solved it downloading a CWM zip file from sileshnair (I can't find the link now) and copying and replacing the files inside with the new ones we need.
    I have attached this CWM file and you only need to open it with 7zip and drag and drop the files "SystemUI.apk", "SystemUI.odex" (the one generated as SystemUI.patched.odex) and "QuickPanelSettings.apk" into the "/system/app/" folder of the zip, and the file "lidroid-res.apk" into the "/system/framework/" folder of the zip
    Once you have the modified "15BarStatus.zip" copy it to your phone to "/sdcard/15tbsb/", then reboot into CWM recovery, install custom zip, select "/sdcard/15tbsb/15BarStatus.zip" file. Then reboot and all should work ok XD

    Hope this help to everyone that need it :D

    If you have questions post reply and if you see that I do not reply you in two or three days you can pm me to ask me for look the forum.


    Have a nice day, thanks to all from who I have learned and best regards to everyone XD
    8
    Screenshots please...

    I have uploaded screenshots as attachment.
    5
    you were right about the signature! It worked by following these steps: http://xdaforums.com/showpost.php?p=20785880&postcount=16
    I only had to copy SystemUI.odex to /system/app (NOT the apk)
    Thank you so much for your help! I'll try to make an update package and post it here maybe someone else needs it.

    after many tries I've made the CWM zips for installing and uninstalling this mod for Galaxy S I9000 JVZ ODEXED. Once again, thank you sileshnair, Pantrif13 and, of course, LIDROID for this great mod!