[Mod][Guide][How to] Increase Toolbox apps number on new Samsung FWs

Search This thread

daxgirl

Senior Member
Jun 30, 2012
4,047
9,169
Jerusalem
Hello guys!

As you probably noticed, few changes have been introduced in the newest FWs that prevent Increasing the number of available apps for displaying toolbox feature. We used to be able to introduce a simple change in one smali in SecSettings and all was good. Or use an amazing app by @xperiacle. Unfortunately, a few things have changed and now we need to tweak things some more to make them alright again.
So let's get crackin':

You're gonna need:
  1. SecSettings.apk
  2. framework2.jar
  3. Knowledge to decompile/baksmali/compile/smali apks/jars
  4. Text/code editor
  5. About 5 minutes of your time

So:


1. Decompile SecSettings.apk or just baksmali the classes.dex
Navigate to smali/com/android/settings/toolbox/ToolboxList.smali
Find the following line in code:
Code:
const/4 v0, 0x5

Basically this is creates an integer that is being used as our maximal toolbox apps number. In this (default stock) case, the number is 5. We are gonna increase that. That is so the settings allow us to CHOOSE more than 5 apps from the list. Now, if we want to have up to 7 apps, we're gonna change the code to this:
Code:
const/4 v0, 0x[COLOR="Blue"]7[/COLOR]
or any number between 5-7 you want...
BUT! if we want more than 7, we need to increase the size of the register (which is now 4 bit). So if we want between 7-9 apps (f.e. for max 8 apps) we change to this :
Code:
const/[COLOR="Blue"]16[/COLOR] v0, 0x[COLOR="Blue"]8[/COLOR]

Now, we know that we're actualy using hexadecimal numbers, so after 9 we're going to switch to a,b,c... and so on. f.e., to increase to max 12 apps we're oging to use 0xc.

How many apps we can add? Well, it's abit tricky, since the feature is dpi dependant. I have managed well with 12 apps on default dpi (480). So I am going to limit my users to that. The reason is double folded:
  1. More than 12 apps on default dpi is gonna cause a crash. Now since it's a framework based feature, the crash is gonna manifest as hot boot.
  2. It's a toolbox, not an app drawer. More than 7-8 apps sounds to me like it defies the purpose. Not to mention more than 12.
There is a way to increase the ammount of apps by reducing the size of app icons and gaps in framework-res.apk dimens. If someone is interested I will append a guide for that. Personally, I am not doing that.

So from now on we will talk about increasing the number of apps to 12 max. meaning we inputed const/16 v0, 0xc into our smali.

Next step - still in this smali - about two lines below you will see the following:
Code:
    .line 83
    sput v0, Lcom/android/settings/toolbox/ToolboxList;->MAX_DEFAULT_APPS:I
Line number may differ or you might not have it id you decompiled without debugging... But what we're going to do is add a line (in blue) above that sput v0, Lcom/android/settings/toolbox/ToolboxList;->MAX_TOOLBOX_APPS:I... so our code will look like this (you add the line in blue):
Code:
    const/16 v0, 0xc

    .line 82
    sput v0, Lcom/android/settings/toolbox/ToolboxList;->MAX_TOOLBOX_APPS:I
    [COLOR="Blue"]const/4 v0, 0x5[/COLOR]

    .line 83
    sput v0, Lcom/android/settings/toolbox/ToolboxList;->MAX_DEFAULT_APPS:I

Now the reason we're doing that, is that by default the same max number of apps is being transfered to the max number of default apps (new addition by samsung). But if we do that, the first 7 apps after the default 5 (in our case) are going to be "considered" as "default" and that causes them to be displayed wrongly inside the list where you choose the apps and also causes settings crash upon repeated entry to the apps editing.

We need to feed a different integer to the max default apps. And since it's 5, we are adding an integer of 5 between max apps and max default apps.

Now you can recompile SecSettings.apk and push back into your phone.

At this point you will notice that even though you can shoose more than 5 apps, the toolbox is still showing only 5. It becomes short and cut at the bottom.
To fix that we dive into the framework.



2. Baksmali framework2.jar
Navigate to smali/com/samsung/android/toolbox/TWToolBoxFloatingViewer.smali
Find the following code:
Code:
    iget v2, p0, Lcom/samsung/android/toolbox/TwToolBoxFloatingViewer;->FIXED_SHORTCUT_ITEM_GAP:I

    iget v4, p0, Lcom/samsung/android/toolbox/TwToolBoxFloatingViewer;->FIXED_SHORTCUT_ITEM_SIZE:I

    add-int/2addr v2, v4

    mul-int/lit8 v2, v2, 0x4

    add-int/2addr v0, v2

    iget v2, p0, Lcom/samsung/android/toolbox/TwToolBoxFloatingViewer;->FIXED_ROUND_TAIL_SIZE:I

    add-int/2addr v0, v2

    iput v0, p0, Lcom/samsung/android/toolbox/TwToolBoxFloatingViewer;->TOTAL_HEIGHT:I
Note the following line mul-int/lit8 v2, v2, 0x4!!! Basically Samsing introdused a new object in this fragment that's called TOTAL_HEIGHT. That objects takes a value that's a result of multiplying FIXED_SHORTCUT_ITEM_GAP+FIXED_SHORTCUT_ITEM_SIZE by 4. Plus a little round tail but it doesn't concern us...
So let us multiply the FIXED_SHORTCUT_ITEM_GAP+FIXED_SHORTCUT_ITEM_SIZE by 12!!! This is the max height that we need. The feature will resize itself according to the ammount of chosen apps up to that total height.
So our code will become this:
Code:
    iget v2, p0, Lcom/samsung/android/toolbox/TwToolBoxFloatingViewer;->FIXED_SHORTCUT_ITEM_GAP:I

    iget v4, p0, Lcom/samsung/android/toolbox/TwToolBoxFloatingViewer;->FIXED_SHORTCUT_ITEM_SIZE:I

    add-int/2addr v2, v4

    [COLOR="Blue"]mul-int/lit8 v2, v2, 0xc[/COLOR]

    add-int/2addr v0, v2

    iget v2, p0, Lcom/samsung/android/toolbox/TwToolBoxFloatingViewer;->FIXED_ROUND_TAIL_SIZE:I

    add-int/2addr v0, v2

    iput v0, p0, Lcom/samsung/android/toolbox/TwToolBoxFloatingViewer;->TOTAL_HEIGHT:I

That's it, guys! Smali/recompile framework2.jar and install into your device.

I hope this help those of you who were interested in fixing that annoying "innovation" and I hope it explains the logic behind it.
No credits needed, no asking for permission. If this helps you - use and enjoy!!! We're all in open source and sharing knowledge business after all.

I would like to thank my beloved family... that tolerates me AND android, god knows how, but they still love and always support me ;)
And my dear friend @Wuby986 for always being there for me, never letting go and never letting me let go of my little crazy ideas. For loving this feature and fighting for it. Thank you!!!
And special thanks to @DaOldMan for being my mentor once and teaching me how to decompile my first app. And for listening to me when I have crazy ideas ;)
 
Last edited:

talkingmonkeys

Recognized Contributor / Themer
May 15, 2013
2,644
4,413
@daxgirl @Wuby986 This one is confusing me too. In my framework2.jar there is no FIXED_SHORTCUT_ITEM_GAP or FIXED_SHORTCUT_ITEM_SIZE. instead it has FIXED_ITEM_SIZE, FIXED_MAIN_ITEM_SIZE, FIXED_MAIN_ITEM_GAP and FIXED_ITEM_GAP. Also it doesn't have the multiply part added into the code. This is what I believe needs changed instead. And here is the smali file http://pastebin.com/9VsFhAN3

Code:
iget v0, v0, Lcom/samsung/android/toolbox/TwToolBoxFloatingViewer;->FIXED_MAIN_ITEM_WIDTH:I

    move/from16 v23, v0

    div-int/lit8 v11, v23, 0x2

    move-object/from16 v0, p0

    iget v0, v0, Lcom/samsung/android/toolbox/TwToolBoxFloatingViewer;->FIXED_MAIN_ITEM_HEIGHT:I

    move/from16 v23, v0

    div-int/lit8 v10, v23, 0x2

    iget-object v0, v14, Lcom/samsung/android/toolbox/TwToolBoxFloatingViewer$ToolBoxMenu;->bounds:Landroid/graphics/Rect;

Code:
iget v0, v0, Lcom/samsung/android/toolbox/TwToolBoxFloatingViewer;->FIXED_ITEM_SIZE:I

    move/from16 v23, v0

    div-int/lit8 v11, v23, 0x2

    move-object/from16 v0, p0

    iget v0, v0, Lcom/samsung/android/toolbox/TwToolBoxFloatingViewer;->FIXED_ITEM_SIZE:I

    move/from16 v23, v0

    div-int/lit8 v10, v23, 0x2

    iget-object v0, v14,
 
Last edited:

Wuby986

Senior Member
Oct 18, 2013
2,144
2,440
@daxgirl @Wuby986

Hi, I am using Note 3 N9005 Lollipop.
Poland firmware.
I can't find framework2.jar file in framework.
And I guess my framework is odexed.

yeah it could be.. !! as long as you didn't deodexed it is odex... it is odex if you see the boot.oat file ( or at least that's how it should, based on s5 i have).. anyway it is most likely that you don't have the framework2.jar.. there isn't anymore on L ;)
 
  • Like
Reactions: amk19 and daxgirl

amk19

Senior Member
Jul 3, 2014
278
707
Bangalore
yeah it could be.. !! as long as you didn't deodexed it is odex... it is odex if you see the boot.oat file ( or at least that's how it should, based on s5 i have).. anyway it is most likely that you don't have the framework2.jar.. there isn't anymore on L ;)

In order to make it odex there should be framework.odex file. But I can't find any.
All I can see is framework.jar which is around 300 bytes...
How can make required changes to obtain 12 Apps in Toolbox?
 

Wuby986

Senior Member
Oct 18, 2013
2,144
2,440
In order to make it odex there should be framework.odex file. But I can't find any.

All I can see is framework.jar which is around 300 bytes...

How can make required changes to obtain 12 Apps in Toolbox?


As i told you, you have the boot.oat, which now contains the old odex files for framework..
Try searching google for guides on how to deodex roms ;)
 
  • Like
Reactions: daxgirl

daxgirl

Senior Member
Jun 30, 2012
4,047
9,169
Jerusalem
In order to make it odex there should be framework.odex file. But I can't find any.
All I can see is framework.jar which is around 300 bytes...
How can make required changes to obtain 12 Apps in Toolbox?
You can use this tool http://forum.xda-developers.com/galaxy-s5/general/tool-deodex-tool-android-l-t2972025
To deodex your entire rom and then you need to flash it ALL in recovery. I suggest taking a dev base by @_alexndr for n900, replacing app priv-app and framework folders in system of his zip and flashing. You will have a flashable deodex with correct permissions and aroma.
 

Top Liked Posts

  • There are no posts matching your filters.
  • 47
    Hello guys!

    As you probably noticed, few changes have been introduced in the newest FWs that prevent Increasing the number of available apps for displaying toolbox feature. We used to be able to introduce a simple change in one smali in SecSettings and all was good. Or use an amazing app by @xperiacle. Unfortunately, a few things have changed and now we need to tweak things some more to make them alright again.
    So let's get crackin':

    You're gonna need:
    1. SecSettings.apk
    2. framework2.jar
    3. Knowledge to decompile/baksmali/compile/smali apks/jars
    4. Text/code editor
    5. About 5 minutes of your time

    So:


    1. Decompile SecSettings.apk or just baksmali the classes.dex
    Navigate to smali/com/android/settings/toolbox/ToolboxList.smali
    Find the following line in code:
    Code:
    const/4 v0, 0x5

    Basically this is creates an integer that is being used as our maximal toolbox apps number. In this (default stock) case, the number is 5. We are gonna increase that. That is so the settings allow us to CHOOSE more than 5 apps from the list. Now, if we want to have up to 7 apps, we're gonna change the code to this:
    Code:
    const/4 v0, 0x[COLOR="Blue"]7[/COLOR]
    or any number between 5-7 you want...
    BUT! if we want more than 7, we need to increase the size of the register (which is now 4 bit). So if we want between 7-9 apps (f.e. for max 8 apps) we change to this :
    Code:
    const/[COLOR="Blue"]16[/COLOR] v0, 0x[COLOR="Blue"]8[/COLOR]

    Now, we know that we're actualy using hexadecimal numbers, so after 9 we're going to switch to a,b,c... and so on. f.e., to increase to max 12 apps we're oging to use 0xc.

    How many apps we can add? Well, it's abit tricky, since the feature is dpi dependant. I have managed well with 12 apps on default dpi (480). So I am going to limit my users to that. The reason is double folded:
    1. More than 12 apps on default dpi is gonna cause a crash. Now since it's a framework based feature, the crash is gonna manifest as hot boot.
    2. It's a toolbox, not an app drawer. More than 7-8 apps sounds to me like it defies the purpose. Not to mention more than 12.
    There is a way to increase the ammount of apps by reducing the size of app icons and gaps in framework-res.apk dimens. If someone is interested I will append a guide for that. Personally, I am not doing that.

    So from now on we will talk about increasing the number of apps to 12 max. meaning we inputed const/16 v0, 0xc into our smali.

    Next step - still in this smali - about two lines below you will see the following:
    Code:
        .line 83
        sput v0, Lcom/android/settings/toolbox/ToolboxList;->MAX_DEFAULT_APPS:I
    Line number may differ or you might not have it id you decompiled without debugging... But what we're going to do is add a line (in blue) above that sput v0, Lcom/android/settings/toolbox/ToolboxList;->MAX_TOOLBOX_APPS:I... so our code will look like this (you add the line in blue):
    Code:
        const/16 v0, 0xc
    
        .line 82
        sput v0, Lcom/android/settings/toolbox/ToolboxList;->MAX_TOOLBOX_APPS:I
        [COLOR="Blue"]const/4 v0, 0x5[/COLOR]
    
        .line 83
        sput v0, Lcom/android/settings/toolbox/ToolboxList;->MAX_DEFAULT_APPS:I

    Now the reason we're doing that, is that by default the same max number of apps is being transfered to the max number of default apps (new addition by samsung). But if we do that, the first 7 apps after the default 5 (in our case) are going to be "considered" as "default" and that causes them to be displayed wrongly inside the list where you choose the apps and also causes settings crash upon repeated entry to the apps editing.

    We need to feed a different integer to the max default apps. And since it's 5, we are adding an integer of 5 between max apps and max default apps.

    Now you can recompile SecSettings.apk and push back into your phone.

    At this point you will notice that even though you can shoose more than 5 apps, the toolbox is still showing only 5. It becomes short and cut at the bottom.
    To fix that we dive into the framework.



    2. Baksmali framework2.jar
    Navigate to smali/com/samsung/android/toolbox/TWToolBoxFloatingViewer.smali
    Find the following code:
    Code:
        iget v2, p0, Lcom/samsung/android/toolbox/TwToolBoxFloatingViewer;->FIXED_SHORTCUT_ITEM_GAP:I
    
        iget v4, p0, Lcom/samsung/android/toolbox/TwToolBoxFloatingViewer;->FIXED_SHORTCUT_ITEM_SIZE:I
    
        add-int/2addr v2, v4
    
        mul-int/lit8 v2, v2, 0x4
    
        add-int/2addr v0, v2
    
        iget v2, p0, Lcom/samsung/android/toolbox/TwToolBoxFloatingViewer;->FIXED_ROUND_TAIL_SIZE:I
    
        add-int/2addr v0, v2
    
        iput v0, p0, Lcom/samsung/android/toolbox/TwToolBoxFloatingViewer;->TOTAL_HEIGHT:I
    Note the following line mul-int/lit8 v2, v2, 0x4!!! Basically Samsing introdused a new object in this fragment that's called TOTAL_HEIGHT. That objects takes a value that's a result of multiplying FIXED_SHORTCUT_ITEM_GAP+FIXED_SHORTCUT_ITEM_SIZE by 4. Plus a little round tail but it doesn't concern us...
    So let us multiply the FIXED_SHORTCUT_ITEM_GAP+FIXED_SHORTCUT_ITEM_SIZE by 12!!! This is the max height that we need. The feature will resize itself according to the ammount of chosen apps up to that total height.
    So our code will become this:
    Code:
        iget v2, p0, Lcom/samsung/android/toolbox/TwToolBoxFloatingViewer;->FIXED_SHORTCUT_ITEM_GAP:I
    
        iget v4, p0, Lcom/samsung/android/toolbox/TwToolBoxFloatingViewer;->FIXED_SHORTCUT_ITEM_SIZE:I
    
        add-int/2addr v2, v4
    
        [COLOR="Blue"]mul-int/lit8 v2, v2, 0xc[/COLOR]
    
        add-int/2addr v0, v2
    
        iget v2, p0, Lcom/samsung/android/toolbox/TwToolBoxFloatingViewer;->FIXED_ROUND_TAIL_SIZE:I
    
        add-int/2addr v0, v2
    
        iput v0, p0, Lcom/samsung/android/toolbox/TwToolBoxFloatingViewer;->TOTAL_HEIGHT:I

    That's it, guys! Smali/recompile framework2.jar and install into your device.

    I hope this help those of you who were interested in fixing that annoying "innovation" and I hope it explains the logic behind it.
    No credits needed, no asking for permission. If this helps you - use and enjoy!!! We're all in open source and sharing knowledge business after all.

    I would like to thank my beloved family... that tolerates me AND android, god knows how, but they still love and always support me ;)
    And my dear friend @Wuby986 for always being there for me, never letting go and never letting me let go of my little crazy ideas. For loving this feature and fighting for it. Thank you!!!
    And special thanks to @DaOldMan for being my mentor once and teaching me how to decompile my first app. And for listening to me when I have crazy ideas ;)
    4
    In order to make it odex there should be framework.odex file. But I can't find any.
    All I can see is framework.jar which is around 300 bytes...
    How can make required changes to obtain 12 Apps in Toolbox?
    You can use this tool http://forum.xda-developers.com/galaxy-s5/general/tool-deodex-tool-android-l-t2972025
    To deodex your entire rom and then you need to flash it ALL in recovery. I suggest taking a dev base by @_alexndr for n900, replacing app priv-app and framework folders in system of his zip and flashing. You will have a flashable deodex with correct permissions and aroma.
    4
    This thread has been added as a great addition to my GALAXY S5 UNIFIED MODS THREAD - GUIDES & LINKS thread.
    Thank you for the great work! :)
    3
    Sure mate! Only that on the new firmwares it doesn't work. It states so at the top of the guide [emoji106] [emoji106] [emoji106]
    Read the last pages of the thread you're referring us to

    Sent from my SM-G900F using Tapatalk
Our Apps
Get our official app!
The best way to access XDA on your phone
Nav Gestures
Add swipe gestures to any Android
One Handed Mode
Eases uses one hand with your phone