[Samsung Galaxy SL i9003] loSconosciuto:
Go to the end of the post for the flashable zips.

===================================

By default the user can set as minimum brightness level 30 (over 255) from the settings, 20 sliding the finger on the status bar.

Files changed:

/system/framework/services.jar

/system/app/Settings.apk

/system/app/SystemUI.apk (UPDATE 5. I completely forgot to add this in the guide)

(I used KPU as reference)

How to mod services.jar:

You need java installed and smali.jar/baksmali.jar. There are probably tools that can help you or you can look for a better explanation on how to do it. (this tutorial is not about smali/baksmali).

Here what I usually do:

1) Extract classes.dex from it (jar files are simply zip files, use any file archiver to do that)

2) Decompile classes.dex with this command (from cmd/shell etc):

java -jar baksmali.jar classes.dex -o classout

This will create a directory (classout) with all the .smali files in it. Make all the changes you need to do.

3) Recompile classes.dex with this command:

java -Xmx512M -jar smali.jar classout -o new-classes.dex

This command will recreate the .dex file (named new-classes.dex).

4) Rename new-classes.dex to classes.dex and put it back inside services.jar (overwrite the existing one).

services.jar

1) Decompile services.jar and open com/android/server/PowerManagerService.smali

2) Look for:

const/16 v4, 0x14

(line 10727). 0x14 is the hexadecimal of 20. This is the minimum brightness level achievable. You should use something greater than or equal to 1.

const/16 v4, [B]0x1[/B]

If you want, you can test some values. You simply need to run:

echo 1 > /sys/class/backlight/omap_bl/brightness

where 1 is the backlight value (1/255):

3) Look for:

const/16 v2, 0x14

(line 2189).

If you don't change this value you'll be able to decrease your backlight below 20, but if you turn the screen off and then on, it is automatically set to this value. Use the same value above.

const/16 v2, [B]0x1[/B]

UPDATE 1:

When the phone is inactive, before the screen is switched off, the backlight value is automatically set to 20. The problem is that if you can go lower to that value, when inactive, instead of decreasing, the brightness increase. To avoid this

4) Look for:

UPDATE 4: (if current brightness is higher than 20/255, use the default dim value):

.restart local [COLOR="Red"]v10[/COLOR] #nominalCurrentValue:I

(aound line 5859) and remember the "red" part (aka the register. It could be something different). Now look for:

const/16 v5, 0x14

and change it with

const/16 v5, 0x14
if-lt [COLOR="Red"]v10[/COLOR],v5,:low_dim

goto/16 :goto_a0

:low_dim
const/16 v5, 0x1

(line 5964). Make sure the red part is like the one above.

Pseudocode:

if your current brightness < 0x14 (20/255) => dim = 0x1 (1/255)
if your current brightness > 0x14 (20/255) => dim = 0x14 (20/255)

This value should be less than or equal to the values used above.

UPDATE 3:

When the battery is below 10, the brightness goes to the minimum value achievable. That could be a problem if you set a very low value, because everytime you turn off and then on the screen, you'll always need to increase the brightness, because the minimum value is good only in very dark places. To disable this feature:

5) Look for (line 1494):

.method private batteryIsLow()Z

Replace this: (UPDATE 3b)

.method private batteryIsLow()Z
.registers 3

.prologue
.line 1812
iget-boolean v0, p0, Lcom/android/server/PowerManagerService;->mIsPowered:Z

with this:

.method private batteryIsLow()Z
.registers 3

.prologue
.line 1812
const/4 v0, 0x0
return v0

iget-boolean v0, p0, Lcom/android/server/PowerManagerService;->mIsPowered:Z

Settings.apk

1) Decompile Settings.apk and open smali/com/android/settings/BrightnessPreference.smali

2) Look for 0x1e (3 occurences, lines: 318, 603 and 664) and change with 0x4 (the value used above)

line 318: const/16 v3, 0x1e
line 664: add-int/lit8 v0, p2, 0x1e
line 603: add-int/lit8 v3, v3, 0x1e

line 318: const/16 v3, [B]0x1[/B]
line 664: add-int/lit8 v0, p2, [B]0x1[/B]
line 603: add-int/lit8 v3, v3, [B]0x1[/B]

3) open smali/com/android/settings/BrightnessPreference$BrightnessObserver.smali

Look for 0x1e (line 98) and change it with 0x4

const/16 v3, 0x1e

const/16 v3, [B]0x1[/B]

UPDATE 5:

SystemUI.apk

1) Decompile SystemUI.apk and open smali/com/android/systemui/statusbar/StatusBarService.smali

2) Look for

.local v0, checkBrightNess:I
const/16 v1, 0x1e

(around line 404) and change it with

.local v0, checkBrightNess:I
const/16 v1, 0x1

This will let you achieve the minimum brightness level through the status bar.

AUTO BRIGHTNESS

If you want to change the auto brightness levels there's already a tutorial: Link

Probably you'll find this helpful.

Note that if you set a level below 20, if you don't mod services.jar when your phone is inactive, the brightness will go to 20.

Are you looking for a "night pack"? Read here

===================================

Flashable zips for DEODEXED only.

Do a nandroid backup!

SystemUI.apk is not included in these zips, sorry. You can't go below "30" from the status bar.

UPDATE 4:

If the current brightness is higher than 20/255, when inactive, the screen brighntess is set to 20 instead of 1.

XXKPU

If you don't like this mod, you can always restore the original files using these flashable zip:

DDKP3 stock

XXKPQ stock

XXKPU stock

or restore a nandroid backup of course.

UPDATE 3:

Brigthness won't change when battery goes below 10.

DDKP3

XXKPQ

XXKPU

UPDATE 2:

This time I used as minimum level 1 instead of 4, as shown in the guide. Even if they are close, the difference is significant. In order to avoid brightness increases, the brighntess is set to 1 when inactive.

DDKP3

XXKPQ

XXKPU

UPDATE 1:

This is for who downloaded the first version. It simply contains the stock framework.jar, because the change I made is not needed. This will not remove the mod. See the files below for that.

XXKPU framework.jar