Android 14 屏幕相关修改点记录

2025-04-11  本文已影响0人  梧叶已秋声

1.将亮度变化逻辑变化逻辑从伽马曲线修改为线性

frameworks/base/packages/SettingsLib/DisplayUtils/src/com/android/settingslib/display/BrightnessUtils.java
@@ -17,6 +17,7 @@
 package com.android.settingslib.display;
 
 import android.util.MathUtils;
 
 /** Utility methods for calculating the display brightness. */
 public class BrightnessUtils {
@@ -30,6 +31,8 @@
     private static final float B = 0.28466892f;
     private static final float C = 0.55991073f;
 
+    public static final boolean ENABLE_GAMMA = false;
+
     /**
      * A function for converting from the gamma space that the slider works in to the
      * linear space that the setting works in.
@@ -76,6 +79,10 @@
      * @return The corresponding setting value.
      */
     public static final float convertGammaToLinearFloat(int val, float min, float max) {
+        if(!ENABLE_GAMMA){
+            float ratio = (float)val / GAMMA_SPACE_MAX;
+            return min + (float)(ratio * (max - min));
+        }
         final float normalizedVal = MathUtils.norm(GAMMA_SPACE_MIN, GAMMA_SPACE_MAX, val);
         final float ret;
         if (normalizedVal <= R) {
@@ -128,6 +135,10 @@
      * @return The corresponding slider value
      */
     public static final int convertLinearToGammaFloat(float val, float min, float max) {
+        if(!ENABLE_GAMMA){
+            float ratio = (float)(val - min)/ (max - min);
+            return (int)(ratio * GAMMA_SPACE_MAX);
+        }
         // For some reason, HLG normalizes to the range [0, 12] rather than [0, 1]
         final float normalizedVal = MathUtils.norm(min, max, val) * 12;
         final float ret;

2.低亮度时,某些app使用过程中(例如滑动界面)会闪屏,这个是AAL导致的。解决方法是低亮度时关闭AAL或直接关闭AAL功能。主要修改vendor/mediatek/proprietary/hardware/aal/AAL25/lib/legacy/AALService.cpp 。
参考链接:
Android 12 屏幕亮度(从伽马曲线变为线性)
Android功耗(17)---省电续航-AAL 屏幕内容省电

上一篇 下一篇

猜你喜欢

热点阅读