[Galaxy S 5 Android Development (Snapdragon)] daxgirl:
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 [MENTION=4948919]xperiacle[/MENTION]. 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:

SecSettings.apk

framework2.jar

Knowledge to decompile/baksmali/compile/smali apks/jars

Text/code editor

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:

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:

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 :

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.

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:

.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):

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:

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:

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 [MENTION=5493353]Wuby986[/MENTION] 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 [MENTION=3026895]DaOldMan[/MENTION] for being my mentor once and teaching me how to decompile my first app. And for listening to me when I have crazy ideas ;)