[XPERIA X10 Android Development] cobrato:
As more and more people are interested to port roms from other phones to our x10, these 2 features are usually missing and need some modifications to work properly.

Here is a simple guide to enable these 2 features on our x10

Pre-Requisite

1. You need to know how to use apktool or any tool that can decompile/compile apks.

2. You need to know how to use smali/baksmali tool

This is not a tutorial of how to use apktool or smali tool. Please google for the above for downloads and tutorials

Credits to Z&J for their great FreeX10 rom that provides a base for reference.

Enable Hardware LED

You need to modify framework-res.apk (in /system/framework folder)

1. backup the original framework-res.apk

2. use apktool to decode framework-res.apk to a folder

syntax:

apktool d framework-res.apk

This should create a folder "framework-res" in the current folder

3. use a text editor (eg notepad++) to open the file <foldername>/res/values/array.xml

look for something similar to below:

<integer-array name="config_autoBrightnessLevels">
<item>200</item>
<item>400</item>
<item>1000</item>
<item>3000</item>
</integer-array>
<integer-array name="config_autoBrightnessLcdBacklightValues">
<item>25</item>
<item>55</item>
<item>70</item>
<item>70</item>
<item>250</item>
</integer-array>
<integer-array name="config_autoBrightnessButtonBacklightValues">
<item>255</item>
<item>255</item>
<item>0</item>
<item>0</item>
<item>0</item>
</integer-array>
<integer-array name="config_autoBrightnessKeyboardBacklightValues">
<item>0</item>
<item>0</item>
<item>0</item>
<item>0</item>
<item>0</item>
</integer-array>

and replace it with:

<array name="config_autoBrightnessLevels" />
<array name="config_autoBrightnessLcdBacklightValues" />
<array name="config_autoBrightnessButtonBacklightValues" />
<array name="config_autoBrightnessKeyboardBacklightValues" />

4. open the file <foldername>/res/values/bools.xml

looks for the line:

<bool name="config_automatic_brightness_available">true</bool>

and change the word "true" to "false"

5. compile the apk

syntax:

apktool b <foldername>

6. replace the resources.arsc in original framework-res.apk with the one in <foldername>/build/apk folder

Note: I use TotalCommander as it has 2 pane windows and can open apk file as folder but there should be many guides in the App & Theme section

that teach you how to replace resources file in framework-res.apk

7. replace the framework-res.apk in /system/framework folder

8. reboot

Enable Camera Flash Light

You need to modify services.jar (in /system/framework folder)

1. backup the original services.jar

2. use winrar to extract classes.dex from services.jar

3. use smali/baksmali tool to decode classes.dex to a folder

syntax:

java -jar baksmali.jar -o <foldername>/ classes.dex

4. use a text editor (eg notepad++) to open the file <foldername>/com/android/server/LightsService.smali

5. look for lines that contain this (there should be 5 of them):

"/sys/class/leds/spotlight/brightness"
or
"/sys/class/leds/flashlight/brightness"

and replace it with:

"/sys/class/leds/lv5219lg:fled/spotlight_enable"

6. use smali/baksmali tool to compile classes.dex

syntax:

java -Xmx512M -jar smali.jar <foldername>/ -o classes.dex

7. replace classes.dex in services.jar with the new classes.dex using winrar

8. replace the services.jar in /system/framework folder

9. reboot

10. test it with switchpro or LED Light (from market) or vignette (provided camera works)

Notes:

1. If booting fails that'd mean something wrong in compiling / packing the apk. please replace the original file

2. The method may not apply to every rom. Do it at your own risk.

Pls hit "Thanks" if it helps you :)