修改自动亮度下背光和按键的亮度

乐蛙又出现BUG了,高通拼包的BUG就是多!设置自动亮度后,按住光感器,屏幕会一片黑..

第一感觉就是去看Log....Log如下~

E/lights ( 399): set_light_backlight state = 1408253004, brightness = 34
E/lights ( 399): set_light_backlight state = 1408253004, brightness = 33
E/lights ( 399): set_light_backlight state = 1408253004, brightness = 32
E/lights ( 399): set_light_backlight state = 1408253004, brightness = 31
E/lights ( 399): set_light_backlight state = 1408253004, brightness = 32
E/lights ( 399): set_light_backlight state = 1408253004, brightness = 30
E/lights ( 399): set_light_backlight state = 1408253004, brightness = 29
E/lights ( 399): set_light_backlight state = 1408253004, brightness = 28
E/lights ( 399): set_light_backlight state = 1408253004, brightness = 26
E/lights ( 399): set_light_backlight state = 1408253004, brightness = 23
E/lights ( 399): set_light_backlight state = 1408253004, brightness = 19
E/lights ( 399): set_light_backlight state = 1408253004, brightness = 16
E/lights ( 399): set_light_backlight state = 1408253004, brightness = 12
E/lights ( 399): set_light_backlight state = 1408253004, brightness = 10

从此可以看到,屏幕亮度降到10后,屏幕就黑了,那我们就需要把最低亮度调高!

感谢大蛋的指导,让我们一起大喊:"大蛋教万岁,大蛋教武运长久!!!"

首先我们需要加载和反编译framework-res.apk

$ apktool if framework-res.apk
I: Framework installed to: /home/michellgaby/apktool/framework/1.apk

$ apktool d framework-res.apk 
I: Loading resource table...
I: Loaded.
I: Decoding AndroidManifest.xml with resources...
I: Regular manifest package...
I: Decoding file-resources...
I: Decoding values */* XMLs...
I: Done.
I: Copying assets and libs...

然后编辑framework-res_apk/res/values/arrays.xml文件~

如果framework-res_apk/res/values-zh-rCN/arrays.xml里面也有对应项的话,那就修改,没有就不需要修改!

接着定位为下面代码的位置

<integer-array name="config_autoBrightnessLevels">
<item>7</item>
<item>94</item>
<item>208</item>
<item>458</item>
<item>2223</item>
</integer-array>
<integer-array name="config_autoBrightnessLcdBacklightValues">
<item>10</item>
<item>35</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>255</item>
<item>0</item>
<item>0</item>
<item>0</item>
</integer-array>

我先来讲解下上面代码的含义吧

config_autoBrightnessLevels:手机检测到的光亮度

config_autoBrightnessLcdBacklightValues:对应需要设定的背光亮度

config_autoBrightnessButtonBacklightValues:对应需要设定的按键灯亮度

如:当检测到的光亮度低于7时,设置背光亮度为10,按键灯亮度为255。(255是最大亮度,0代表关闭灯源)

我们需要修改的就是"10"这个数值,我修改为"25",亮度太暗看手机会不习惯~

修改后的代码如下

<integer-array name="config_autoBrightnessLevels">
<item>7</item>
<item>94</item>
<item>208</item>
<item>458</item>
<item>2223</item>
</integer-array>
<integer-array name="config_autoBrightnessLcdBacklightValues">
<item>25</item>
<item>35</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>255</item>
<item>0</item>
<item>0</item>
<item>0</item>
</integer-array>

然后我们回编译,出现警告不管他,我们只需要回编译后的resources.arsc文件

$ apktool b framework-res
W: Could not find sources
I: Checking whether resources has changed...
I: Building resources...
aapt: warning: string 'url_dialog_choice_message' has no default translation in /home/michellgaby/tmp/framework-res/res; found: zh_CN
aapt: warning: string 'url_dialog_choice_title' has no default translation in /home/michellgaby/tmp/framework-res/res; found: zh_CN
I: Building apk file...

把原来的framework-res.apk复制到frameowrk-res/build/apk文件夹里

接着把resources.arsc打包进framework-res.apk

$ zip framework-res.apk resources.arsc


用ADB传送到手机并修改权限,然后重启即可!!!

$ adb push framework-res.apk /system/framework/
$ adb shell chmod 644 /system/framework/framework-res.apk
$ adb reboot

看看你的手机,背光是不是修改好了~欧耶!!! ヽ( ^∀^)ノ

修改按键亮度同理,不过是修改"config_autoBrightnessButtonBacklightValues"下的参数!

posted on 2013-08-12 22:54  GentlemanMod  阅读(1786)  评论(0编辑  收藏  举报

导航