Fix autobrightness scaling issues - Moto G General

I notice on most LOS based ROMs, the autobrightness function does not scale very well with changes in light levels. I guess the table values are a default for multiple devices and not tailored for the Moto G.
Anyway, if you want to know how to fix it, here goes.....
This mod is applicable to all ROMs for our phone.
Decompile framework-res.apk using your favorite decompiler (mine is TickleMyAndroid)
Open D:\TickleMyAndroid\_WorkArea1\_working\framework-res.apk\res\values\arrays.xml
Edit the config_autoBrightnessLcdBacklightValues values as below (these are my edited values that get you much closer to ideal)
Code:
<integer-array name="config_autoBrightnessLevels">
<item>50</item>
<item>100</item>
<item>150</item>
<item>200</item>
<item>800</item>
<item>1300</item>
<item>2000</item>
<item>3000</item>
<item>4000</item>
<item>8000</item>
</integer-array>
<integer-array name="config_autoBrightnessLcdBacklightValues">
<item>22</item>
<item>32</item>
<item>44</item>
<item>56</item>
<item>68</item>
<item>98</item>
<item>120</item>
<item>148</item>
<item>180</item>
<item>216</item>
<item>255</item>
</integer-array>
While you are at it, might as well speed up response times a bit by editing integers.xml and changing this line from 8 secs to 4. There are other timings to mess with but defaults for the rest are pretty good.
Code:
<integer name="config_autoBrightnessDarkeningLightDebounce">4000</integer>
Recompile framework-res.apk without re-signing. (Never re-sign framework or system apks)
Copy the new framework-res.apk file over the original. The phone will probably immediately reboot - this always happens if a framework file changes size - don't panic.
If the phone does not reboot, force a reboot yourself.
If the LCD brightness does not follow ambient light levels to your satisfaction, you can monitor the LCD brightness here: /sys/class/leds/lcd-backlight/brightness and use an app such as Smart Tools-Pro to monitor Lux levels. This will give you an idea what value needs to be tweaked.
I won't post a modded framework-res.apk file as it will only be valid for exactly the ROM it came from and the fun of doing your own mod and maybe learning something will be lost

Related

Radio options in build.prop

I decided to post this after doing some research and putting off testing this for a while now. I know editing the radio options in the build.prop has been tossed around as a whisper in dark hallways for a while now but no one has really seemed to do it and see what happens. This is just for the Slide in America, I have no clue if it will work in europe, though I've heard it does.
All I've done is edit the following lines:
HTML:
ro.wifi.channels
ro.ril.gprsclass
ro.ril.hsdpa.category
ro.ril.hsupa.category
wifi.supplicant_scan_interval
ro.ril.gprsclass
ro.ril.enable.3G.prefix
Editing the wifi scan interval should save on battery (it's set at 60s now instead of 15s), the 3G prefix is 0 by default and I think it's just asthetic even though I haven't noticed it yet. There are 2 ro.ril.gprsclass listings and usually they are different classes, I set them both to the same class. Lastly, the wifi channels were (on my rom at least) set to "blank" and I figured that might be an issue for some of the roms that have trouble with wifi so I set that 14.
I won't say that this will increase your speed or help lock on to 'H' or '3G' more, you'll just have to test it for yourself and see if you notice anything. If enough people do try this I'll put up a poll to see if editing the class or wifi settings actually helps.
Back up your original before you push this (of course you're in recovery).
Code:
adb pull /system/build.prop <path to where ever>
Then to push it:
Code:
adb push <path to new file> /system/
I'm not taking credit for this, I'm sure I'm not the first or last to do this

[MOD] Changing the brightness curve in stock JellyBean

Ok, so with instructions from this thread - [MOD]Lower Auto-Brightness levels to save battery we can change the brightness curve without using 3rd party tools running on top.
Note: Seems like the output values need to be one more entry than the autoBrightnessLevels arrays.
And now the following lines contain the tweaked settings that make more sense for our cellphone. We need to extend the following arrays first.
Code:
<integer-array name="config_autoBrightnessLevels">
<item>5</item>
<item>20</item>
<item>50</item>
<item>100</item>
<item>400</item>
<item>800</item>
<item>1500</item>
<item>3000</item>
<item>6000</item>
<item>9000</item>
<item>15000</item>
</integer-array>
<integer-array name="config_autoBrightnessLcdBacklightValues">
<item>3</item>
<item>3</item>
<item>7</item>
<item>13</item>
<item>23</item>
<item>63</item>
<item>93</item>
<item>131</item>
<item>191</item>
<item>241</item>
<item>255</item>
<item>255</item>
</integer-array>
<integer-array name="config_autoBrightnessLcdBacklightValuesPowerSave">
<item>1</item>
<item>1</item>
<item>5</item>
<item>13</item>
<item>23</item>
<item>63</item>
<item>93</item>
<item>131</item>
<item>191</item>
<item>241</item>
<item>255</item>
<item>255</item>
</integer-array>
The following lines should be changed too to the following:
Code:
<integer-array name="config_displayTempThresholdValues">
<item>1000</item>
</integer-array>
<integer-array name="config_displayTempHysteresisValues">
<item>200</item>
</integer-array>
<integer-array name="config_displayProtectionCapValues">
<item>0</item>
</integer-array>
And to finish it seems like we need to drop down the minimum backlight brightness level too in order to make use of our new curve. This can be changed in 'res/values/integers.xml', the stock value is 20,
Code:
res/values/integers.xml: <integer name="config_screenBrightnessDim">20</integer>
I personally just use a value of four and a warmup of zero.
Code:
res/values/integers.xml: <integer name="config_screenBrightnessDim">2</integer>
res/values/integers.xml: <integer name="config_lightSensorWarmupTime">0</integer>
Note: Once done, sign with the old signature of the file and then zipalign or you will bootloop after every /data wipe procedure!
Omar-Avelar said:
So I can see that the device by itself can really output dimmer backlight levels on the device. I can control that at will by doing the following as root:
Code:
echo 2 > /sys/class/backlight/psb-bl/brightness
The backlight really gets DIMM, which is insanely good for using the phone at night.
Question: Does anyone know a way or has an idea to change the way android registers the minimum backlight setting and also change the brightness curve? This would be for the stock JB firmware.
Click to expand...
Click to collapse
I use velis auto brightness set as amoled bright and high sensitivity with the stock dim and auto brightness switched off
<Updated original post with the relevant information since this is not a question anymore>
Updated the last line in order to be able to get lower brightness values.
Hi
I tried the mod on the JB Retail.EU homemade fastboot version. And so far so good it seems to work great.
Will see on the long term if I can see the improvement on the backlight
Thanks
Le_Poilu said:
Hi
I tried the mod on the JB Retail.EU homemade fastboot version. And so far so good it seems to work great.
Will see on the long term if I can see the improvement on the backlight
Thanks
Click to expand...
Click to collapse
Did you try the Brasil mod on the EU rom, or did you modify your own framework file?
arman68 said:
Did you try the Brasil mod on the EU rom, or did you modify your own framework file?
Click to expand...
Click to collapse
I downloaded the mod here, the BR one, with no modification at all.
Code:
<integer-array name="config_displayTempThresholdValues">
<item>100</item>
</integer-array>
<integer-array name="config_displayTempHysteresisValues">
<item>2000</item>
</integer-array>
<integer-array name="config_displayProtectionCapValues">
<item>20</item>
</integer-array>
What do the above settings do, and why did you change them?
arman68 said:
Code:
<integer-array name="config_displayTempThresholdValues">
<item>100</item>
</integer-array>
<integer-array name="config_displayTempHysteresisValues">
<item>2000</item>
</integer-array>
<integer-array name="config_displayProtectionCapValues">
<item>20</item>
</integer-array>
What do the above settings do, and why did you change them?
Click to expand...
Click to collapse
The first one is which value to stop holding hysteresis for (if a 100 lux change is present or more), the second one is a timer/ticker on for how long to wait for the hysteresis curves before doing a fast change in the brightness levels.
I have no idea on the last one so I just played with it and haven't had much complains personally.
Bootloop
Hello,
I did the procedure and I am in booloop, can someone help me, please?
matheusgallo said:
Hello,
I did the procedure and I am in booloop, can someone help me, please?
Click to expand...
Click to collapse
I got a bootloop to. Downloaded the EU Version. Currently i have the Homemade Version 91.2.260001.XT890.Retail.en.EU Version installed.
Wipe-Cache does not help..
Solution for bootloop
Hello,
I did the downgrade to ICS and used the unbrick.
Now, my device is ON! =D
Better brightness curves
I don't quite understand why, but I have been experimenting with config_displayTempThresholdValues, config_displayTempHysteresisValues and config_displayProtectionCapValues, and your settings make it much smoothier and less jittery than the default ones; therefore I will use those.
However, I am not so sure about your brightness curve. I agree the default one is far too bright, but I find yours too dark and scaling up too slowly. I have been experimenting with multiple curves, and I think I have finally found one I am happy with:
Code:
<integer-array name="config_autoBrightnessLevels">
<item>3</item>
<item>20</item>
<item>50</item>
<item>100</item>
<item>200</item>
<item>350</item>
<item>600</item>
<item>1000</item>
<item>1600</item>
<item>2500</item>
<item>4000</item>
<item>6400</item>
<item>10000</item>
</integer-array>
Code:
<integer-array name="config_autoBrightnessLcdBacklightValues">
<item>4</item> <!-- 0 to 2 -->
<item>12</item> <!-- 3 to 19 -->
<item>23</item> <!-- 20 to 49 -->
<item>35</item> <!-- 50 to 99 -->
<item>48</item> <!-- 100 to 199 -->
<item>64</item> <!-- 200 to 349 -->
<item>81</item> <!-- 350 to 599 -->
<item>99</item> <!-- 600 to 999 -->
<item>119</item> <!-- 1000 to 1599 -->
<item>142</item> <!-- 1600 to 2499 -->
<item>166</item> <!-- 2500 to 3999 -->
<item>193</item> <!-- 4000 to 6399 -->
<item>223</item> <!-- 6400 to 9999 -->
<item>255</item> <!-- 10000 to 65535-->
</integer-array>
Code:
<integer-array name="config_autoBrightnessLcdBacklightValuesPowerSave">
<item>4</item> <!-- 0 to 2 -->
<item>10</item> <!-- 3 to 19 -->
<item>17</item> <!-- 20 to 49 -->
<item>25</item> <!-- 50 to 99 -->
<item>35</item> <!-- 100 to 199 -->
<item>47</item> <!-- 200 to 349 -->
<item>61</item> <!-- 350 to 599 -->
<item>78</item> <!-- 600 to 999 -->
<item>97</item> <!-- 1000 to 1599 -->
<item>119</item> <!-- 1600 to 2499 -->
<item>146</item> <!-- 2500 to 3999 -->
<item>177</item> <!-- 4000 to 6399 -->
<item>213</item> <!-- 6400 to 9999 -->
<item>255</item> <!-- 10000 to 65535-->
</integer-array>
I am not sure yet if we can go lower than 4 as a minimum value, and I am going to check it next.
Logarithmic curves to show low light behaviour:
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Linear curves to show mid to bright light behaviour:
I have been doing some more testing, and I find a minimum brightness setting of 1 instead of 4 (default is 20) is even better.
I have adjusted the brightness curves to take this into account, with some wider difference between automatic and power saver, while trying to keep the power saver mode usable. I need to use the phone a bit longer, in different light conditions, including reading books in the dark, and when satisfied I will post my new settings.
arman68 said:
I have been doing some more testing, and I find a minimum brightness setting of 1 instead of 4 (default is 20) is even better.
I have adjusted the brightness curves to take this into account, with some wider difference between automatic and power saver, while trying to keep the power saver mode usable. I need to use the phone a bit longer, in different light conditions, including reading books in the dark, and when satisfied I will post my new settings.
Click to expand...
Click to collapse
Awesome! and yeah. I had to bump up the middle-low values the other day because it was not ramping up fast enough. It was a first approach -- but eventually we will get it good, I think 10-12 steps is pretty good too btw .
Oh, and for everyone I actually decided to take out the pre-modded framework files offline as depending on deodexed or odexed ROM's it was causing people to bootloop. I think it will be better to just include the curves on something more distributable!
Omar-Avelar said:
I had to bump up the middle-low values the other day because it was not ramping up fast enough.
Click to expand...
Click to collapse
Yes, my new curve is a bit too dark. I will have to do adjust the polynomial formula for faster ramping in the low-mid values as well, and do some more testing.
Could anyone provide the res.apk for a stock Rom (guess that would be odexed)?
Regards,
prometh
Omar-Avelar said:
Ok, so with instructions from this thread - [MOD]Lower Auto-Brightness levels to save battery we can change the brightness curve without using 3rd party tools running on top.
Note: Seems like the output values need to be one more entry than the autoBrightnessLevels arrays.
And now the following lines contain the tweaked settings that make more sense for our cellphone. We need to extend the following arrays first.
Code:
<integer-array name="config_autoBrightnessLevels">
<item>5</item>
<item>20</item>
<item>50</item>
<item>100</item>
<item>400</item>
<item>800</item>
<item>1500</item>
<item>3000</item>
<item>6000</item>
<item>9000</item>
<item>15000</item>
</integer-array>
<integer-array name="config_autoBrightnessLcdBacklightValues">
<item>7</item>
<item>13</item>
<item>20</item>
<item>29</item>
<item>39</item>
<item>54</item>
<item>79</item>
<item>107</item>
<item>161</item>
<item>199</item>
<item>241</item>
<item>255</item>
</integer-array>
<integer-array name="config_autoBrightnessLcdBacklightValuesPowerSave">
<item>5</item>
<item>10</item>
<item>17</item>
<item>25</item>
<item>35</item>
<item>47</item>
<item>71</item>
<item>97</item>
<item>137</item>
<item>186</item>
<item>221</item>
<item>255</item>
</integer-array>
The following lines should be changed too to the following:
Code:
<integer-array name="config_displayTempThresholdValues">
<item>40</item>
</integer-array>
<integer-array name="config_displayTempHysteresisValues">
<item>2000</item>
</integer-array>
<integer-array name="config_displayProtectionCapValues">
<item>40</item>
</integer-array>
And to finish it seems like we need to drop down the minimum backlight brightness level too in order to make use of our new curve. This can be changed in 'res/values/integers.xml', the stock value is 20,
Code:
res/values/integers.xml: <integer name="config_screenBrightnessDim">20</integer>
I personally just use a value of four.
Code:
res/values/integers.xml: <integer name="config_screenBrightnessDim">4</integer>
Note: Once done, sign with the old signature of the file and then zipalign or you will bootloop after every /data wipe procedure!
Click to expand...
Click to collapse
Thai omar,can put this in cmw zip to flash for us.Thk.
Le_Poilu said:
I downloaded the mod here, the BR one, with no modification at all.
Click to expand...
Click to collapse
Dear Le_Poilu, You mean u have framework done dime brightness for GB rom, can u post here for us.Thanks.
Daniel 9999 said:
Dear Le_Poilu, You mean u have framework done dime brightness for GB rom, can u post here for us.Thanks.
Click to expand...
Click to collapse
Sorry
I don't get what you're expecting from me...
Envoyé depuis mon Nexus 7 avec Tapatalk

[GUIDE][TUTORIALS][HOW TO] Change Density-DPI: SlimKat - 4.4.2.build.3-OFFICIAL-3081

This ROM is wonderful, but at first I found it odd that the screen size is too small. The small icons, the lyrics and everything. I looked everywhere and most of the settings I could find was how to increase the font size, but even so the widgets and applications themselves, were still with a very small format. I searched the internet and some friends gave me this tutorial and it worked fine on my machine. I'll go to you too, but do so with caution and at your own risk. The number density of the screen is known as the DPI was raised to 182 and 222. It looks good.
With some file explorer (Es Explorer, Root Explorer, etc.) open the build.prop file located at: /system/build.prop Within this file, locate the following line: ro.sf.lcd_density=240
Value "240" is the factory original. We can change this value to we change the density of the screen. The lower the value, the greater the density for Change any value between 160 and 240 (Tested with 160 and 192) After change this line, below the line "#ADDITIONAL_BUILD_PROPERTIES" has another line equal to modified up there: ro.sf.lcd_density =240
We will comment this line, simply by placing a # at the beginning of it (this line should originally be deleted, but if you want to go back to the original DPI, should resume this line. Leaving it commented, is virtually a “backup" her. If you just uncomment it)
Save the file.
Delete the file generated by the system, build.prop.bak
Reboot the phone.
Sent from my GT-I9100 using XDA Premium 4 mobile app

[Q] Lollipop volume level

Ever since I installed the lollipop update for the Canadian S5 (900W8), the minimum volume levels for Media and System have been way too high.
I used to put System on the first step and it would be excellent for me. Now it is way too loud, especially when I lock/unlock phone, and type on keyboard (even with volume level of keyboard set as lowest).
Media volume level at first step is also too loud.
I don't know what was Samsung thinking (or is it Google?) but I would like it if someone knows how I could modify the volume steps amount.
I think it has to do with the mixer_paths file, not sure though.
I am rooted and running stock lollipop.
Thanks in advance.
Anyone?
I found the solution for those who are interested:
You need to be rooted.
Go to System/etc and find mixer_paths. Edit it.
In that file, search for "RX7 Digital Volume" and get to the one that is below the category Path name="speaker".
Value should be 79. I changed it to 68.
Reboot, and volume is now lower and more natural. =)
You can choose any value you want and even increase it.
There is no value 78 in that file. All values are 0 and 1
The filename is mixer_paths_auxpcm.xml
The value is 84 on my phone
Modified to 68, restarted, but no changes...
ionutmaruta said:
There is no value 78 in that file. All values are 0 and 1
The filename is mixer_paths_auxpcm.xml
The value is 84 on my phone
Modified to 68, restarted, but no changes...
Click to expand...
Click to collapse
Mine is in mixer_paths and not the one with auxpcm.
I'm running stock touchwiz lollipop.

[BASH SCRIPT] Torch fix for pie GSIs

so, I was googling around a bit, a few days ago, and found out you can control the torch (and other leds) from the command line, or a bash script.
Prerequisites
root (magisk or superSU)
FX file manager or Termux
Text editor
Instructions
Create a file in a directory of your choice with a '.sh' extension
Add the following code to the file:
Code:
su -c 'echo 255 > /sys/class/leds/torch/brightness'
Run the shell script in termux (cd to the directory and run it) or run it using FX, it will ask for root access if you haven't already granted it
Your torch is now on!
To turn it off create another file with
Code:
su -c 'echo 0 > /sys/class/leds/torch/brightness'
in it
Tested on an Honor 9 and P10+
If you have dual tone flash, yo may find different values cause either led to come on, for me, '255' is the yellow flash and '1' is the white flash
For a bit more messing around, cd to the '/sys/class/leds' directory, you will see a few more directories for other LEDs on your device, controlling them is exactly the same as the torch!
Works for me, thanks a bunch dude
EDIT: on honor 7x/Huawei mate se
Thank you so much for this but I found in my own experience, and from comments I saw where this has been shared, that a bash script perhaps wasn't the most effective to have to run each time so I thought of implementing this to Tasker, create a "pseudo toggle" and allocate it to a quick setting tile. The algorithm is:
Code:
If flashlightStatus = TRUE then
Run shell command: su -c 'echo 0 /sys/class/leds/torch/brightness'
Set variable flashlightStatus to FALSE
Else
Run shell command: su -c 'echo 3 /sys/class/leds/torch/brightness'
Set variable flashlightStatus to TRUE
End If
I set it up this way because if you've never set the variable before (or if it clears on reboot or something) then it won't equal true and would still enable. Also, when I set the brightness to 255 the torch had a slight yellow tint so upon further reading, despite that 255 should be full brightness, apparently max brightness is 3 and is a white light (this seems to disable automatically after around 750ms however). Hope this will help those who are still without a torch on treble GSIs.
P.S. I also set up a quick profile that if the flashlight status variable = true then to wait 750ms and check if still true then change to false and turn off the torch; this would reset to compensate for the OS turning the torch off automatically but Tasker still thinking it was on. I'm not sure how necessary this is or whether it's overkill or not.
beejkitsune said:
Thank you so much for this but I found in my own experience, and from comments I saw where this has been shared, that a bash script perhaps wasn't the most effective to have to run each time so I thought of implementing this to Tasker, create a "pseudo toggle" and allocate it to a quick setting tile. The algorithm is:
Code:
If flashlightStatus = TRUE then
Run shell command: su -c 'echo 0 /sys/class/leds/torch/brightness'
Set variable flashlightStatus to FALSE
Else
Run shell command: su -c 'echo 3 /sys/class/leds/torch/brightness'
Set variable flashlightStatus to TRUE
End If
I set it up this way because if you've never set the variable before (or if it clears on reboot or something) then it won't equal true and would still enable. Also, when I set the brightness to 255 the torch had a slight yellow tint so upon further reading, despite that 255 should be full brightness, apparently max brightness is 3 and is a white light (this seems to disable automatically after around 750ms however). Hope this will help those who are still without a torch on treble GSIs.
P.S. I also set up a quick profile that if the flashlight status variable = true then to wait 750ms and check if still true then change to false and turn off the torch; this would reset to compensate for the OS turning the torch off automatically but Tasker still thinking it was on. I'm not sure how necessary this is or whether it's overkill or not.
Click to expand...
Click to collapse
mind if i improve this?
Code:
su -c 'if grep -q 1 /sys/class/leds/torch/brightness; then echo 0 > /sys/class/leds/torch/brightness; else echo 1 > /sys/class/leds/torch/brightness; fi'
-- obviously you can change the 1 to whatever you want
that is the code i'm using, prevents the use of an unnecessary variable, so is faster, and will use less resources, plus its pretty much fail safe, since it reads the current state of the torch to determine if its on or off, so if something else sets it to a state it still works, if something else set you variable externally then the torch becomes messed up until a reboot.
plus, im assuming that variable is a tasker thing? not everyone will use tasker, so eliminating the variable all together makes it work on any app that can add custom quick settings tiles
ambitiousButRubbish said:
mind if i improve this?
Code:
su -c 'if grep -q 1 /sys/class/leds/torch/brightness; then echo 0 > /sys/class/leds/torch/brightness; else echo 1 > /sys/class/leds/torch/brightness; fi'
-- obviously you can change the 1 to whatever you want
that is the code i'm using, prevents the use of an unnecessary variable, so is faster, and will use less resources, plus its pretty much fail safe, since it reads the current state of the torch to determine if its on or off, so if something else sets it to a state it still works, if something else set you variable externally then the torch becomes messed up until a reboot.
plus, im assuming that variable is a tasker thing? not everyone will use tasker, so eliminating the variable all together makes it work on any app that can add custom quick settings tiles
Click to expand...
Click to collapse
Yes, the variable is a Tasker thing so I'm glad there is a solution that wouldn't rely on it. Thanks for the upgrade and I've already switched out my Tasker profile for this. Doesn't seem any quicker or anything but more simple!

Categories

Resources