New Possible solution for Mi8 unusable auto-brightness


myfluxi

Members
Oct 31, 2018
24
15
UPDATE: Included in regular builds >= 8.11.15.

More or less everybody knows that Xiaomi messed up autobrightness values on their sdm845 devices (i.e. Mi8 or Poco F1).

Here is a possible fix kanged from https://review.lineageos.org/#/c/LineageOS/android_device_xiaomi_beryllium/+/233901/.

Basically it uses Google's values from a Pixel device. I love it, with all the latest fixes (SystemUI, camera) the device is finally perfect.

Download flashable zip

Code:
diff -rupN framework-res/res/values/arrays.xml /framework-res.new/res/values/arrays.xml
--- framework-res/res/values/arrays.xml    2018-11-09 23:15:16.111879626 +0100
+++ /framework-res.new/res/values/arrays.xml    2018-11-09 21:49:49.550041834 +0100
@@ -55,125 +55,48 @@
         <item>com.tencent.mm</item>
     </string-array>
     <array name="config_autoBrightnessButtonBacklightValues" />
-    <integer-array name="config_autoBrightnessDisplayValuesNits">
-        <item>4</item>
-        <item>4</item>
-        <item>4</item>
-        <item>4</item>
-        <item>4</item>
-        <item>4</item>
-        <item>14</item>
-        <item>14</item>
-        <item>14</item>
-        <item>31</item>
-        <item>31</item>
-        <item>31</item>
-        <item>46</item>
-        <item>46</item>
-        <item>46</item>
-        <item>56</item>
-        <item>56</item>
-        <item>56</item>
-        <item>64</item>
-        <item>80</item>
-        <item>86</item>
-        <item>90</item>
-        <item>92</item>
-        <item>103</item>
-        <item>106</item>
-        <item>112</item>
-        <item>121</item>
-        <item>132</item>
-        <item>145</item>
-        <item>167</item>
-        <item>184</item>
-        <item>207</item>
-        <item>227</item>
-        <item>258</item>
-        <item>303</item>
-        <item>324</item>
-        <item>364</item>
-        <item>445</item>
-    </integer-array>
+    <array name="config_autoBrightnessDisplayValuesNits">
+        <item>10.45935</item>   <!-- 0-1 -->
+        <item>29.25559</item>   <!-- 1-2 -->
+        <item>34.240692</item>  <!-- 2-3 -->
+        <item>37.514347</item>  <!-- 3-4 -->
+        <item>40.018696</item>  <!-- 4-8 -->
+        <item>46.885098</item>  <!-- 8-12 -->
+        <item>51.626434</item>  <!-- 12-20 -->
+        <item>58.610405</item>  <!-- 20-33 -->
+        <item>66.890915</item>  <!-- 33-55 -->
+        <item>77.61644</item>   <!-- 55-90 -->
+        <item>90.221886</item>  <!-- 90-148 -->
+        <item>105.80314</item>  <!-- 148-245 -->
+        <item>126.073845</item> <!-- 245-403 -->
+        <item>154.16931</item>  <!-- 403-665 -->
+        <item>191.83717</item>  <!-- 665-1097 -->
+        <item>240.74442</item>  <!-- 1097-1808 -->
+        <item>294.84857</item>  <!-- 1808-2981 -->
+        <item>348.05453</item>  <!-- 2981-5000 -->
+        <item>389.70</item>     <!-- 5000+ -->
+    </array>
     <array name="config_autoBrightnessKeyboardBacklightValues" />
-    <integer-array name="config_autoBrightnessLcdBacklightValues">
-        <item>8</item>
-        <item>8</item>
-        <item>8</item>
-        <item>8</item>
-        <item>8</item>
-        <item>8</item>
-        <item>32</item>
-        <item>32</item>
-        <item>32</item>
-        <item>72</item>
-        <item>72</item>
-        <item>72</item>
-        <item>108</item>
-        <item>108</item>
-        <item>108</item>
-        <item>128</item>
-        <item>128</item>
-        <item>128</item>
-        <item>148</item>
-        <item>184</item>
-        <item>196</item>
-        <item>208</item>
-        <item>212</item>
-        <item>236</item>
-        <item>244</item>
-        <item>256</item>
-        <item>280</item>
-        <item>308</item>
-        <item>340</item>
-        <item>388</item>
-        <item>428</item>
-        <item>480</item>
-        <item>524</item>
-        <item>596</item>
-        <item>700</item>
-        <item>744</item>
-        <item>836</item>
-        <item>1023</item>
-    </integer-array>
+    <array name="config_autoBrightnessLcdBacklightValues" />
     <integer-array name="config_autoBrightnessLevels">
         <item>1</item>
         <item>2</item>
         <item>3</item>
         <item>4</item>
-        <item>5</item>
-        <item>6</item>
-        <item>7</item>
         <item>8</item>
-        <item>10</item>
         <item>12</item>
-        <item>15</item>
-        <item>18</item>
-        <item>22</item>
-        <item>30</item>
-        <item>40</item>
-        <item>50</item>
-        <item>80</item>
-        <item>110</item>
-        <item>155</item>
-        <item>173</item>
-        <item>300</item>
-        <item>387</item>
-        <item>492</item>
-        <item>533</item>
-        <item>726</item>
-        <item>883</item>
-        <item>1023</item>
-        <item>1222</item>
-        <item>1501</item>
-        <item>1733</item>
-        <item>2034</item>
-        <item>2227</item>
-        <item>2517</item>
-        <item>3042</item>
-        <item>3495</item>
-        <item>3998</item>
-        <item>4472</item>
+        <item>20</item>
+        <item>33</item>
+        <item>55</item>
+        <item>90</item>
+        <item>148</item>
+        <item>245</item>
+        <item>403</item>
+        <item>665</item>
+        <item>1097</item>
+        <item>1808</item>
+        <item>2981</item>
+        <item>5000</item>
     </integer-array>
     <integer-array name="config_autoRotationTiltTolerance">
         <item>-25</item>
@@ -416,8 +339,46 @@
         <item>500</item>
         <item>600</item>
     </integer-array>
-    <array name="config_screenBrightnessBacklight" />
-    <array name="config_screenBrightnessNits" />
+    <integer-array name="config_screenBrightnessBacklight">
+        <item>0</item>
+        <item>15</item>
+        <item>30</item>
+        <item>45</item>
+        <item>60</item>
+        <item>75</item>
+        <item>90</item>
+        <item>105</item>
+        <item>120</item>
+        <item>135</item>
+        <item>150</item>
+        <item>165</item>
+        <item>180</item>
+        <item>195</item>
+        <item>210</item>
+        <item>225</item>
+        <item>240</item>
+        <item>255</item>
+    </integer-array>
+    <array name="config_screenBrightnessNits">
+        <item>0</item>
+        <item>26.11</item>
+        <item>50.5</item>
+        <item>74.17</item>
+        <item>96.89</item>
+        <item>118.3</item>
+        <item>139.8</item>
+        <item>162.9</item>
+        <item>189.8</item>
+        <item>217.4</item>
+        <item>240.4</item>
+        <item>265.3</item>
+        <item>288.7</item>
+        <item>316</item>
+        <item>340.8</item>
+        <item>357.9</item>
+        <item>376.2</item>
+        <item>392.9</item>
+    </array>
     <integer-array name="config_scrollBarrierVibePattern">
         <item>0</item>
         <item>15</item>
diff -rupN framework-res/res/values/fractions.xml /framework-res.new/res/values/fractions.xml
--- framework-res/res/values/fractions.xml    2018-11-09 23:15:16.315879440 +0100
+++ /framework-res.new/res/values/fractions.xml    2018-11-09 21:44:01.116764514 +0100
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
-    <fraction name="config_autoBrightnessAdjustmentMaxGamma">200.0%</fraction>
+    <fraction name="config_autoBrightnessAdjustmentMaxGamma">300.0%</fraction>
     <fraction name="config_dimBehindFadeDuration">100.0%</fraction>
     <fraction name="config_maximumScreenDimRatio">29.999996%</fraction>
     <fraction name="config_screenAutoBrightnessDozeScaleFactor">100.0%</fraction>
diff -rupN framework-res/res/values/integers.xml /framework-res.new/res/values/integers.xml
--- framework-res/res/values/integers.xml    2018-11-09 23:15:15.935879787 +0100
+++ /framework-res.new/res/values/integers.xml    2018-11-09 21:49:11.578147474 +0100
@@ -13,7 +13,7 @@
     <integer name="config_activityShortDur">150</integer>
     <integer name="config_alertDialogController">0</integer>
     <integer name="config_autoBrightnessBrighteningLightDebounce">2000</integer>
-    <integer name="config_autoBrightnessDarkeningLightDebounce">2000</integer>
+    <integer name="config_autoBrightnessDarkeningLightDebounce">4000</integer>
     <integer name="config_autoBrightnessInitialLightSensorRate">-1</integer>
     <integer name="config_autoBrightnessLightSensorRate">250</integer>
     <integer name="config_autoPowerModeAnyMotionSensor">0</integer>
@@ -25,8 +25,8 @@
     <integer name="config_bluetooth_operating_voltage_mv">3300</integer>
     <integer name="config_bluetooth_rx_cur_ma">0</integer>
     <integer name="config_bluetooth_tx_cur_ma">0</integer>
-    <integer name="config_brightness_ramp_rate_fast">1233</integer>
-    <integer name="config_brightness_ramp_rate_slow">986</integer>
+    <integer name="config_brightness_ramp_rate_fast">180</integer>
+    <integer name="config_brightness_ramp_rate_slow">60</integer>
     <integer name="config_burnInProtectionMaxHorizontalOffset">0</integer>
     <integer name="config_burnInProtectionMaxRadius">-1</integer>
     <integer name="config_burnInProtectionMaxVerticalOffset">0</integer>
@@ -146,7 +146,7 @@
     <integer name="config_screenBrightnessForVrSettingMinimum">1264</integer>
     <integer name="config_screenBrightnessSettingDefault">268</integer>
     <integer name="config_screenBrightnessSettingMaximum">1023</integer>
-    <integer name="config_screenBrightnessSettingMinimum">3</integer>
+    <integer name="config_screenBrightnessSettingMinimum">1</integer>
     <integer name="config_screen_magnification_multi_tap_adjustment">-50</integer>
     <integer name="config_shortPressOnPowerBehavior">1</integer>
     <integer name="config_shortPressOnSleepBehavior">0</integer>
 
Last edited:
More or less everybody knows that Xiaomi messed up autobrightness values on their sdm845 devices (i.e. Mi8 or Poco F1).

Here is a possible fix kanged from https://review.lineageos.org/#/c/LineageOS/android_device_xiaomi_beryllium/+/233901/.

Basically it uses Google's values from a Pixel device. I love it, with all the latest fixes (SystemUI, camera) the device is finally perfect.

Download flashable zip

Code:
diff -rupN framework-res/res/values/arrays.xml /framework-res.new/res/values/arrays.xml
--- framework-res/res/values/arrays.xml    2018-11-09 23:15:16.111879626 +0100
+++ /framework-res.new/res/values/arrays.xml    2018-11-09 21:49:49.550041834 +0100
@@ -55,125 +55,48 @@
         <item>com.tencent.mm</item>
     </string-array>
     <array name="config_autoBrightnessButtonBacklightValues" />
-    <integer-array name="config_autoBrightnessDisplayValuesNits">
-        <item>4</item>
-        <item>4</item>
-        <item>4</item>
-        <item>4</item>
-        <item>4</item>
-        <item>4</item>
-        <item>14</item>
-        <item>14</item>
-        <item>14</item>
-        <item>31</item>
-        <item>31</item>
-        <item>31</item>
-        <item>46</item>
-        <item>46</item>
-        <item>46</item>
-        <item>56</item>
-        <item>56</item>
-        <item>56</item>
-        <item>64</item>
-        <item>80</item>
-        <item>86</item>
-        <item>90</item>
-        <item>92</item>
-        <item>103</item>
-        <item>106</item>
-        <item>112</item>
-        <item>121</item>
-        <item>132</item>
-        <item>145</item>
-        <item>167</item>
-        <item>184</item>
-        <item>207</item>
-        <item>227</item>
-        <item>258</item>
-        <item>303</item>
-        <item>324</item>
-        <item>364</item>
-        <item>445</item>
-    </integer-array>
+    <array name="config_autoBrightnessDisplayValuesNits">
+        <item>10.45935</item>   <!-- 0-1 -->
+        <item>29.25559</item>   <!-- 1-2 -->
+        <item>34.240692</item>  <!-- 2-3 -->
+        <item>37.514347</item>  <!-- 3-4 -->
+        <item>40.018696</item>  <!-- 4-8 -->
+        <item>46.885098</item>  <!-- 8-12 -->
+        <item>51.626434</item>  <!-- 12-20 -->
+        <item>58.610405</item>  <!-- 20-33 -->
+        <item>66.890915</item>  <!-- 33-55 -->
+        <item>77.61644</item>   <!-- 55-90 -->
+        <item>90.221886</item>  <!-- 90-148 -->
+        <item>105.80314</item>  <!-- 148-245 -->
+        <item>126.073845</item> <!-- 245-403 -->
+        <item>154.16931</item>  <!-- 403-665 -->
+        <item>191.83717</item>  <!-- 665-1097 -->
+        <item>240.74442</item>  <!-- 1097-1808 -->
+        <item>294.84857</item>  <!-- 1808-2981 -->
+        <item>348.05453</item>  <!-- 2981-5000 -->
+        <item>389.70</item>     <!-- 5000+ -->
+    </array>
     <array name="config_autoBrightnessKeyboardBacklightValues" />
-    <integer-array name="config_autoBrightnessLcdBacklightValues">
-        <item>8</item>
-        <item>8</item>
-        <item>8</item>
-        <item>8</item>
-        <item>8</item>
-        <item>8</item>
-        <item>32</item>
-        <item>32</item>
-        <item>32</item>
-        <item>72</item>
-        <item>72</item>
-        <item>72</item>
-        <item>108</item>
-        <item>108</item>
-        <item>108</item>
-        <item>128</item>
-        <item>128</item>
-        <item>128</item>
-        <item>148</item>
-        <item>184</item>
-        <item>196</item>
-        <item>208</item>
-        <item>212</item>
-        <item>236</item>
-        <item>244</item>
-        <item>256</item>
-        <item>280</item>
-        <item>308</item>
-        <item>340</item>
-        <item>388</item>
-        <item>428</item>
-        <item>480</item>
-        <item>524</item>
-        <item>596</item>
-        <item>700</item>
-        <item>744</item>
-        <item>836</item>
-        <item>1023</item>
-    </integer-array>
+    <array name="config_autoBrightnessLcdBacklightValues" />
     <integer-array name="config_autoBrightnessLevels">
         <item>1</item>
         <item>2</item>
         <item>3</item>
         <item>4</item>
-        <item>5</item>
-        <item>6</item>
-        <item>7</item>
         <item>8</item>
-        <item>10</item>
         <item>12</item>
-        <item>15</item>
-        <item>18</item>
-        <item>22</item>
-        <item>30</item>
-        <item>40</item>
-        <item>50</item>
-        <item>80</item>
-        <item>110</item>
-        <item>155</item>
-        <item>173</item>
-        <item>300</item>
-        <item>387</item>
-        <item>492</item>
-        <item>533</item>
-        <item>726</item>
-        <item>883</item>
-        <item>1023</item>
-        <item>1222</item>
-        <item>1501</item>
-        <item>1733</item>
-        <item>2034</item>
-        <item>2227</item>
-        <item>2517</item>
-        <item>3042</item>
-        <item>3495</item>
-        <item>3998</item>
-        <item>4472</item>
+        <item>20</item>
+        <item>33</item>
+        <item>55</item>
+        <item>90</item>
+        <item>148</item>
+        <item>245</item>
+        <item>403</item>
+        <item>665</item>
+        <item>1097</item>
+        <item>1808</item>
+        <item>2981</item>
+        <item>5000</item>
     </integer-array>
     <integer-array name="config_autoRotationTiltTolerance">
         <item>-25</item>
@@ -416,8 +339,46 @@
         <item>500</item>
         <item>600</item>
     </integer-array>
-    <array name="config_screenBrightnessBacklight" />
-    <array name="config_screenBrightnessNits" />
+    <integer-array name="config_screenBrightnessBacklight">
+        <item>0</item>
+        <item>15</item>
+        <item>30</item>
+        <item>45</item>
+        <item>60</item>
+        <item>75</item>
+        <item>90</item>
+        <item>105</item>
+        <item>120</item>
+        <item>135</item>
+        <item>150</item>
+        <item>165</item>
+        <item>180</item>
+        <item>195</item>
+        <item>210</item>
+        <item>225</item>
+        <item>240</item>
+        <item>255</item>
+    </integer-array>
+    <array name="config_screenBrightnessNits">
+        <item>0</item>
+        <item>26.11</item>
+        <item>50.5</item>
+        <item>74.17</item>
+        <item>96.89</item>
+        <item>118.3</item>
+        <item>139.8</item>
+        <item>162.9</item>
+        <item>189.8</item>
+        <item>217.4</item>
+        <item>240.4</item>
+        <item>265.3</item>
+        <item>288.7</item>
+        <item>316</item>
+        <item>340.8</item>
+        <item>357.9</item>
+        <item>376.2</item>
+        <item>392.9</item>
+    </array>
     <integer-array name="config_scrollBarrierVibePattern">
         <item>0</item>
         <item>15</item>
diff -rupN framework-res/res/values/fractions.xml /framework-res.new/res/values/fractions.xml
--- framework-res/res/values/fractions.xml    2018-11-09 23:15:16.315879440 +0100
+++ /framework-res.new/res/values/fractions.xml    2018-11-09 21:44:01.116764514 +0100
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
-    <fraction name="config_autoBrightnessAdjustmentMaxGamma">200.0%</fraction>
+    <fraction name="config_autoBrightnessAdjustmentMaxGamma">300.0%</fraction>
     <fraction name="config_dimBehindFadeDuration">100.0%</fraction>
     <fraction name="config_maximumScreenDimRatio">29.999996%</fraction>
     <fraction name="config_screenAutoBrightnessDozeScaleFactor">100.0%</fraction>
diff -rupN framework-res/res/values/integers.xml /framework-res.new/res/values/integers.xml
--- framework-res/res/values/integers.xml    2018-11-09 23:15:15.935879787 +0100
+++ /framework-res.new/res/values/integers.xml    2018-11-09 21:49:11.578147474 +0100
@@ -13,7 +13,7 @@
     <integer name="config_activityShortDur">150</integer>
     <integer name="config_alertDialogController">0</integer>
     <integer name="config_autoBrightnessBrighteningLightDebounce">2000</integer>
-    <integer name="config_autoBrightnessDarkeningLightDebounce">2000</integer>
+    <integer name="config_autoBrightnessDarkeningLightDebounce">4000</integer>
     <integer name="config_autoBrightnessInitialLightSensorRate">-1</integer>
     <integer name="config_autoBrightnessLightSensorRate">250</integer>
     <integer name="config_autoPowerModeAnyMotionSensor">0</integer>
@@ -25,8 +25,8 @@
     <integer name="config_bluetooth_operating_voltage_mv">3300</integer>
     <integer name="config_bluetooth_rx_cur_ma">0</integer>
     <integer name="config_bluetooth_tx_cur_ma">0</integer>
-    <integer name="config_brightness_ramp_rate_fast">1233</integer>
-    <integer name="config_brightness_ramp_rate_slow">986</integer>
+    <integer name="config_brightness_ramp_rate_fast">180</integer>
+    <integer name="config_brightness_ramp_rate_slow">60</integer>
     <integer name="config_burnInProtectionMaxHorizontalOffset">0</integer>
     <integer name="config_burnInProtectionMaxRadius">-1</integer>
     <integer name="config_burnInProtectionMaxVerticalOffset">0</integer>
@@ -146,7 +146,7 @@
     <integer name="config_screenBrightnessForVrSettingMinimum">1264</integer>
     <integer name="config_screenBrightnessSettingDefault">268</integer>
     <integer name="config_screenBrightnessSettingMaximum">1023</integer>
-    <integer name="config_screenBrightnessSettingMinimum">3</integer>
+    <integer name="config_screenBrightnessSettingMinimum">1</integer>
     <integer name="config_screen_magnification_multi_tap_adjustment">-50</integer>
     <integer name="config_shortPressOnPowerBehavior">1</integer>
     <integer name="config_shortPressOnSleepBehavior">0</integer>
Is this fix suitable for Poco F1 as well?
 
Done. Thanks, so far it seems it fixed the flashing problem, will report back in 24 hours as most problems were at night.
 
More or less everybody knows that Xiaomi messed up autobrightness values on their sdm845 devices (i.e. Mi8 or Poco F1).

Here is a possible fix kanged from https://review.lineageos.org/#/c/LineageOS/android_device_xiaomi_beryllium/+/233901/.

Basically it uses Google's values from a Pixel device. I love it, with all the latest fixes (SystemUI, camera) the device is finally perfect.
Flashed it and looks great. So, I guess you have to modify it after every new beta flash (because it's framework-res.apk?) unless xiaomi.eu or chinese beta fixes it?
 
Yes, unless it's being included in the Xiaomi EU featurelist as a vital upgrade over Xiaomi CN.
 
Yes, unless it's being included in the Xiaomi EU featurelist as a vital upgrade over Xiaomi CN.
I don't think either of them are going to fix it as the issue was there forever :(

It is in your hands to provide us the zip every week ;)
 
I don't think either of them are going to fix it as the issue was there forever :(

It is in your hands to provide us the zip every week ;)
It would be easy for them to include this in their patches on top of CN; and a major upgrade as well.

I hate shipping compiled code and the responsibility that is coming with it (this is btw why I respect the Xiaomi EU people a lot, maintaining a project like this is a tough job).
 
Last edited:
More or less everybody knows that Xiaomi messed up autobrightness values on their sdm845 devices (i.e. Mi8 or Poco F1).

Here is a possible fix kanged from https://review.lineageos.org/#/c/LineageOS/android_device_xiaomi_beryllium/+/233901/.

Basically it uses Google's values from a Pixel device. I love it, with all the latest fixes (SystemUI, camera) the device is finally perfect.

Download flashable zip

Code:
diff -rupN framework-res/res/values/arrays.xml /framework-res.new/res/values/arrays.xml
--- framework-res/res/values/arrays.xml    2018-11-09 23:15:16.111879626 +0100
+++ /framework-res.new/res/values/arrays.xml    2018-11-09 21:49:49.550041834 +0100
@@ -55,125 +55,48 @@
         <item>com.tencent.mm</item>
     </string-array>
     <array name="config_autoBrightnessButtonBacklightValues" />
-    <integer-array name="config_autoBrightnessDisplayValuesNits">
-        <item>4</item>
-        <item>4</item>
-        <item>4</item>
-        <item>4</item>
-        <item>4</item>
-        <item>4</item>
-        <item>14</item>
-        <item>14</item>
-        <item>14</item>
-        <item>31</item>
-        <item>31</item>
-        <item>31</item>
-        <item>46</item>
-        <item>46</item>
-        <item>46</item>
-        <item>56</item>
-        <item>56</item>
-        <item>56</item>
-        <item>64</item>
-        <item>80</item>
-        <item>86</item>
-        <item>90</item>
-        <item>92</item>
-        <item>103</item>
-        <item>106</item>
-        <item>112</item>
-        <item>121</item>
-        <item>132</item>
-        <item>145</item>
-        <item>167</item>
-        <item>184</item>
-        <item>207</item>
-        <item>227</item>
-        <item>258</item>
-        <item>303</item>
-        <item>324</item>
-        <item>364</item>
-        <item>445</item>
-    </integer-array>
+    <array name="config_autoBrightnessDisplayValuesNits">
+        <item>10.45935</item>   <!-- 0-1 -->
+        <item>29.25559</item>   <!-- 1-2 -->
+        <item>34.240692</item>  <!-- 2-3 -->
+        <item>37.514347</item>  <!-- 3-4 -->
+        <item>40.018696</item>  <!-- 4-8 -->
+        <item>46.885098</item>  <!-- 8-12 -->
+        <item>51.626434</item>  <!-- 12-20 -->
+        <item>58.610405</item>  <!-- 20-33 -->
+        <item>66.890915</item>  <!-- 33-55 -->
+        <item>77.61644</item>   <!-- 55-90 -->
+        <item>90.221886</item>  <!-- 90-148 -->
+        <item>105.80314</item>  <!-- 148-245 -->
+        <item>126.073845</item> <!-- 245-403 -->
+        <item>154.16931</item>  <!-- 403-665 -->
+        <item>191.83717</item>  <!-- 665-1097 -->
+        <item>240.74442</item>  <!-- 1097-1808 -->
+        <item>294.84857</item>  <!-- 1808-2981 -->
+        <item>348.05453</item>  <!-- 2981-5000 -->
+        <item>389.70</item>     <!-- 5000+ -->
+    </array>
     <array name="config_autoBrightnessKeyboardBacklightValues" />
-    <integer-array name="config_autoBrightnessLcdBacklightValues">
-        <item>8</item>
-        <item>8</item>
-        <item>8</item>
-        <item>8</item>
-        <item>8</item>
-        <item>8</item>
-        <item>32</item>
-        <item>32</item>
-        <item>32</item>
-        <item>72</item>
-        <item>72</item>
-        <item>72</item>
-        <item>108</item>
-        <item>108</item>
-        <item>108</item>
-        <item>128</item>
-        <item>128</item>
-        <item>128</item>
-        <item>148</item>
-        <item>184</item>
-        <item>196</item>
-        <item>208</item>
-        <item>212</item>
-        <item>236</item>
-        <item>244</item>
-        <item>256</item>
-        <item>280</item>
-        <item>308</item>
-        <item>340</item>
-        <item>388</item>
-        <item>428</item>
-        <item>480</item>
-        <item>524</item>
-        <item>596</item>
-        <item>700</item>
-        <item>744</item>
-        <item>836</item>
-        <item>1023</item>
-    </integer-array>
+    <array name="config_autoBrightnessLcdBacklightValues" />
     <integer-array name="config_autoBrightnessLevels">
         <item>1</item>
         <item>2</item>
         <item>3</item>
         <item>4</item>
-        <item>5</item>
-        <item>6</item>
-        <item>7</item>
         <item>8</item>
-        <item>10</item>
         <item>12</item>
-        <item>15</item>
-        <item>18</item>
-        <item>22</item>
-        <item>30</item>
-        <item>40</item>
-        <item>50</item>
-        <item>80</item>
-        <item>110</item>
-        <item>155</item>
-        <item>173</item>
-        <item>300</item>
-        <item>387</item>
-        <item>492</item>
-        <item>533</item>
-        <item>726</item>
-        <item>883</item>
-        <item>1023</item>
-        <item>1222</item>
-        <item>1501</item>
-        <item>1733</item>
-        <item>2034</item>
-        <item>2227</item>
-        <item>2517</item>
-        <item>3042</item>
-        <item>3495</item>
-        <item>3998</item>
-        <item>4472</item>
+        <item>20</item>
+        <item>33</item>
+        <item>55</item>
+        <item>90</item>
+        <item>148</item>
+        <item>245</item>
+        <item>403</item>
+        <item>665</item>
+        <item>1097</item>
+        <item>1808</item>
+        <item>2981</item>
+        <item>5000</item>
     </integer-array>
     <integer-array name="config_autoRotationTiltTolerance">
         <item>-25</item>
@@ -416,8 +339,46 @@
         <item>500</item>
         <item>600</item>
     </integer-array>
-    <array name="config_screenBrightnessBacklight" />
-    <array name="config_screenBrightnessNits" />
+    <integer-array name="config_screenBrightnessBacklight">
+        <item>0</item>
+        <item>15</item>
+        <item>30</item>
+        <item>45</item>
+        <item>60</item>
+        <item>75</item>
+        <item>90</item>
+        <item>105</item>
+        <item>120</item>
+        <item>135</item>
+        <item>150</item>
+        <item>165</item>
+        <item>180</item>
+        <item>195</item>
+        <item>210</item>
+        <item>225</item>
+        <item>240</item>
+        <item>255</item>
+    </integer-array>
+    <array name="config_screenBrightnessNits">
+        <item>0</item>
+        <item>26.11</item>
+        <item>50.5</item>
+        <item>74.17</item>
+        <item>96.89</item>
+        <item>118.3</item>
+        <item>139.8</item>
+        <item>162.9</item>
+        <item>189.8</item>
+        <item>217.4</item>
+        <item>240.4</item>
+        <item>265.3</item>
+        <item>288.7</item>
+        <item>316</item>
+        <item>340.8</item>
+        <item>357.9</item>
+        <item>376.2</item>
+        <item>392.9</item>
+    </array>
     <integer-array name="config_scrollBarrierVibePattern">
         <item>0</item>
         <item>15</item>
diff -rupN framework-res/res/values/fractions.xml /framework-res.new/res/values/fractions.xml
--- framework-res/res/values/fractions.xml    2018-11-09 23:15:16.315879440 +0100
+++ /framework-res.new/res/values/fractions.xml    2018-11-09 21:44:01.116764514 +0100
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <resources>
-    <fraction name="config_autoBrightnessAdjustmentMaxGamma">200.0%</fraction>
+    <fraction name="config_autoBrightnessAdjustmentMaxGamma">300.0%</fraction>
     <fraction name="config_dimBehindFadeDuration">100.0%</fraction>
     <fraction name="config_maximumScreenDimRatio">29.999996%</fraction>
     <fraction name="config_screenAutoBrightnessDozeScaleFactor">100.0%</fraction>
diff -rupN framework-res/res/values/integers.xml /framework-res.new/res/values/integers.xml
--- framework-res/res/values/integers.xml    2018-11-09 23:15:15.935879787 +0100
+++ /framework-res.new/res/values/integers.xml    2018-11-09 21:49:11.578147474 +0100
@@ -13,7 +13,7 @@
     <integer name="config_activityShortDur">150</integer>
     <integer name="config_alertDialogController">0</integer>
     <integer name="config_autoBrightnessBrighteningLightDebounce">2000</integer>
-    <integer name="config_autoBrightnessDarkeningLightDebounce">2000</integer>
+    <integer name="config_autoBrightnessDarkeningLightDebounce">4000</integer>
     <integer name="config_autoBrightnessInitialLightSensorRate">-1</integer>
     <integer name="config_autoBrightnessLightSensorRate">250</integer>
     <integer name="config_autoPowerModeAnyMotionSensor">0</integer>
@@ -25,8 +25,8 @@
     <integer name="config_bluetooth_operating_voltage_mv">3300</integer>
     <integer name="config_bluetooth_rx_cur_ma">0</integer>
     <integer name="config_bluetooth_tx_cur_ma">0</integer>
-    <integer name="config_brightness_ramp_rate_fast">1233</integer>
-    <integer name="config_brightness_ramp_rate_slow">986</integer>
+    <integer name="config_brightness_ramp_rate_fast">180</integer>
+    <integer name="config_brightness_ramp_rate_slow">60</integer>
     <integer name="config_burnInProtectionMaxHorizontalOffset">0</integer>
     <integer name="config_burnInProtectionMaxRadius">-1</integer>
     <integer name="config_burnInProtectionMaxVerticalOffset">0</integer>
@@ -146,7 +146,7 @@
     <integer name="config_screenBrightnessForVrSettingMinimum">1264</integer>
     <integer name="config_screenBrightnessSettingDefault">268</integer>
     <integer name="config_screenBrightnessSettingMaximum">1023</integer>
-    <integer name="config_screenBrightnessSettingMinimum">3</integer>
+    <integer name="config_screenBrightnessSettingMinimum">1</integer>
     <integer name="config_screen_magnification_multi_tap_adjustment">-50</integer>
     <integer name="config_shortPressOnPowerBehavior">1</integer>
     <integer name="config_shortPressOnSleepBehavior">0</integer>

Looking great on my Mi 8, much better than the original settings. I hope this can be integrated into the Xiaomi.eu ROM, otherwise we would have to flash this addon ZIP every time, and someone would have to provide it.
 
Looking great on my Mi 8, much better than the original settings. I hope this can be integrated into the Xiaomi.eu ROM, otherwise we would have to flash this addon ZIP every time, and someone would have to provide it.

Or just learn to patch by yourself. Patch itself is provided :D
 
Hi all,
I have Mi8 with xiaomi.eu stable rom 10.0.9.0 and I don't have this problem.
* Much too dark in general
* Even worse most of the times when waking up from screen-off (almost nothing visible)
* Sometimes flashing and switching between steps
* Sometimes erratically switching to full brightness
* Generally reacting much too slow when light changes

Google xiaomi mi 8 auto brightness (you'll get results from other Xiaomi devices as well because they have a history of messing this up).

This patch fixes all of this.

This patch is for the Mi8 but can be applied to Mi Mix2s and Poco F1 as well (not the flashable framework file, just the values).
 
Last edited:
The patch has been included on this weeks regular 8.11.15 Mi8 build. Sweet!

(Poco and Mix2s users may experience perfect auto-brightness as well, do you?)
 
  • Like
Reactions: knakworst
Is this flashable ZIP also usable for the 8.11.15 ROM or will thing break down? edit: Never mind, thanks myfluxi!
 
Hello,

Could you tell me if this solution works on Mi5s?

After the update to the Miui 10, mine also stopped working the automatic brightness.

Thankful,

Jose Luiz.