Android Q优化自动背光调节
2021-12-31 本文已影响0人
gale_小米
1.背光曲线调节
Android Q自动背光曲线调节
Index: device/softwinner/ceres-b3/overlay/frameworks/base/core/res/res/values/config.xml
===================================================================
--- device/softwinner/ceres-b3/overlay/frameworks/base/core/res/res/values/config.xml (revision 14239)
+++ device/softwinner/ceres-b3/overlay/frameworks/base/core/res/res/values/config.xml (working copy)
@@ -746,13 +746,25 @@
<item>399.81</item>
</array>
<array name="config_autoBrightnessDisplayValuesNits">
- <item>11</item>
- <item>19</item>
- <item>31</item>
- <item>70</item>
- <item>100</item>
- <item>156</item>
- <item>255</item>
+ <item>33.07</item> <!-- 0-16 -->
+ <item>49.81</item> <!-- 16-32 -->
+ <item>65.02</item> <!-- 32-50 -->
+ <item>80.2</item> <!-- 50-100 -->
+ <item>96.75</item> <!-- 100-140 -->
+ <item>111.8</item> <!-- 140-180 -->
+ <item>144.3</item> <!-- 180-240 -->
+ <item>144.3</item> <!-- 240-300 -->
+ <item>144.3</item> <!-- 300-600 -->
+ <item>144.3</item> <!-- 600-800 -->
+ <item>144.3</item> <!-- 800-1000 -->
+ <item>260.0</item> <!-- 1000-2000 -->
+ <item>288.5</item> <!-- 2000-3000 -->
+ <item>302.0</item> <!-- 3000-4000 -->
+ <item>308.7</item> <!-- 4000-5000 -->
+ <item>315.4</item> <!-- 5000-6000 -->
+ <item>330.0</item> <!-- 6000-8000 -->
+ <item>363.6</item> <!-- 8000-10000 -->
+ <item>366.6</item> <!-- 10000+ -->
</array>
<bool name="config_shutdownForceScreenOff">true</bool>
@@ -780,11 +792,24 @@
Must be overridden in platform specific overlays -->
<integer-array name="config_autoBrightnessLevels">
- <item>20</item>
+ <item>16</item>
+ <item>32</item>
<item>50</item>
- <item>145</item>
- <item>350</item>
- <item>1250</item>
+ <item>100</item>
+ <item>140</item>
+ <item>180</item>
+ <item>240</item>
+ <item>300</item>
+ <item>600</item>
+ <item>800</item>
+ <item>1000</item>
+ <item>2000</item>
+ <item>3000</item>
+ <item>4000</item>
+ <item>5000</item>
+ <item>6000</item>
+ <item>8000</item>
+ <item>10000</item>
</integer-array>
<!--
<integer-array name="config_autoBrightnessLevels">
2.配置了曲线,光感有效果了,但是效果太过突兀,添加一个过渡动画
Index: frameworks/base/services/core/java/com/android/server/display/DisplayPowerController.java
===================================================================
--- frameworks/base/services/core/java/com/android/server/display/DisplayPowerController.java (revision 14239)
+++ frameworks/base/services/core/java/com/android/server/display/DisplayPowerController.java (working copy)
@@ -951,7 +951,7 @@
// before applying the low power or dim transformations so that the slider
// accurately represents the full possible range, even if they range changes what
// it means in absolute terms.
- putScreenBrightnessSetting(brightness);
+ //putScreenBrightnessSetting(brightness);
mAppliedAutoBrightness = true;
mBrightnessReasonTemp.setReason(BrightnessReason.REASON_AUTOMATIC);
} else {
@@ -1055,7 +1055,9 @@
mAppliedTemporaryBrightness || mAppliedTemporaryAutoBrightnessAdjustment;
if (initialRampSkip || hasBrightnessBuckets
|| wasOrWillBeInVr || !isDisplayContentVisible || brightnessIsTemporary) {
- animateScreenBrightness(brightness, 0);
+ //animateScreenBrightness(brightness, 0);
+ animateScreenBrightness(brightness,
+ slowChange ? mBrightnessRampRateSlow : mBrightnessRampRateFast);
} else {
animateScreenBrightness(brightness,
slowChange ? mBrightnessRampRateSlow : mBrightnessRampRateFast);
@@ -1297,6 +1299,7 @@
}
if (mScreenBrightnessRampAnimator.animateTo(target, rate)) {
Trace.traceCounter(Trace.TRACE_TAG_POWER, "TargetScreenBrightness", target);
+ putScreenBrightnessSetting(target);
try {
mBatteryStats.noteScreenBrightness(target);
} catch (RemoteException ex) {
@@ -1613,6 +1616,7 @@
private void putScreenBrightnessSetting(int brightness) {
mCurrentScreenBrightnessSetting = brightness;
+ //android.util.Log.e(TAG,"mCurrentScreenBrightnessSetting="+mCurrentScreenBrightnessSetting);
Settings.System.putIntForUser(mContext.getContentResolver(),
Settings.System.SCREEN_BRIGHTNESS, brightness, UserHandle.USER_CURRENT);
}