[Android Software/Hacking General [Developers Only]] axelpix:
I know, there are some hints about how to modify the terrible behaviour of AutoBacklight already existing in this forum. But they are all hidden deep inside some device specific ROM threads. So I like to cross post here, what I already partly posted in the Saga ROM dev section.

Androids AutoBacklight on most devices has a habit to not quite reasonably adapt to environmental light conditions. Especially in dark environment, the screen is usually not getting dark enough. You need to manually set the backlight value for ebook reading in a dark room e.g.

To overcome this issue is not exactly easy. But it's manageable.

What you need

is a ROOTED DEVICE (!!) and APK-Manager.

The task is to modify the AutoBacklight values within arrays.xml, which is located inside framework.res.apk

I did this on my HTC Desire S. It should work for all HTC Androids and all other devices as long as you find the arrays.xml after decompiling the framework.res.apk. No garantie though for other devices. Just have a look to your files to see if it's there.

And here's the step by step procedure:

on Phone:

copy framework.res.apk from \system\framework to SD-Card (use e.g. RootExplorer)

on PC within APK-Manager folder:

1. place framework.res.apk into folder "place-apk-here-for-modding"

2. clear old files in projects folder if necessary

3. run Script.bat

4. Option 22 - select project --> select framework.res.apk

5. Option 9 - Decompile apk

6. apk is beeing decompiled and extracted to the projects folder now

7. keep APK-Manager script window open in background

8. go to \projects\framework-res.apk\res\values\

9. edit arrays.xml in editor accordingly, this is the interesting section:

<integer-array name="config_autoBrightnessLevels">
<item>11</item>
<item>41</item>
<item>91</item>
<item>161</item>
<item>226</item>
<item>321</item>
<item>641</item>
<item>1281</item>
<item>2601</item>
</integer-array>
<integer-array name="config_autoBrightnessLcdBacklightValues">
<item>25</item>
<item>31</item>
<item>38</item>
<item>51</item>
<item>71</item>
<item>92</item>
<item>128</item>
<item>171</item>
<item>204</item>
<item>255</item>
</integer-array>
<integer-array name="config_autoBrightnessLcdBacklightValuesUp">
<item>25</item>
<item>31</item>
<item>38</item>
<item>51</item>
<item>71</item>
<item>92</item>
<item>128</item>
<item>171</item>
<item>204</item>
<item>255</item>
</integer-array>
<integer-array name="config_autoBrightnessLcdBacklightValuesDown">
<item>25</item>
<item>31</item>
<item>38</item>
<item>51</item>
<item>71</item>
<item>92</item>
<item>128</item>
<item>171</item>
<item>204</item>
<item>255</item>
</integer-array>

Keep the "config_autoBrightnessLevels" untouched. Just modify the "config_autoBrightnessLcdBacklightValues", "config_autoBrightnessLcdBacklightValuesDown" and "config_autoBrightnessLcdBacklightValuesUp".

10. back to APK-Manager Script - Option 11 - compile apk

11. after a while of compilation, you will be asked if you want to keep unmodified files from original apk --> answer Y

12. content from original framework.res.apk is beeing extracted to folder \keep

13. now you will be asked to delete all the files you modified in \projects to delete in \keep (think a while, it makes sense!)

14. in our case, you only need to delete resources.arsc (as we only modified a XML)

15. hit Enter in script window and the compilation will finish

16. look at \place-apk-here-for-modding, there's an unsignedframework.res.apk beside your original framework.res.apk

17. Option 12 - sign apk

18. look at \place-apk-here-for-modding, unsignedframework.res.apk will now be renamed to signed...

--> this is your new framework.res.apk to be uploaded to UOT-Kitchen. Copy it somewhere and rename it back to framework.res.apk

19. You can not simply copy it back to \system\framework. It has to be cooked and flashed.

20. Go to UOT-Kitchen website (http://uot.dakra.lt/kitchen/), open a new kitchen and do nothing but upload your new framework.res.apk. You don't need to upload all the other files as long as you do not want to apply any other modification.

21. submit the kitchen work and wait to be cooked

22. get your UOT-***.zip from the kitchen once it's available in the pickup section

23. put the zip to your phone an flash it through eighter Recovery or ROM-Manager as any other flashable update.zip

Done.

The values you see in the code section above are the ones that work best for me on the Desire S. Your milage may vary. Here's a characteristics comparison between my values and the ones that came with stock ROM.

Attached find the Excel file to do your own characteristics calculation.