Loading core/java/com/android/internal/BrightnessSynchronizer.java +17 −11 Original line number Diff line number Diff line Loading @@ -73,18 +73,26 @@ public class BrightnessSynchronizer { } }; private float mPreferredSettingValue; public BrightnessSynchronizer(Context context) { final BrightnessSyncObserver mBrightnessSyncObserver; mContext = context; mBrightnessSyncObserver = new BrightnessSyncObserver(mHandler); mBrightnessSyncObserver.startObserving(); } /** * Starts brightnessSyncObserver to ensure that the float and int brightness values stay * in sync. * This also ensures that values are synchronized at system start up too. * So we force an update to the int value, since float is the source of truth. Fallback to int * value, if float is invalid. If both are invalid, use default float value from config. */ public void startSynchronizing() { final BrightnessSyncObserver brightnessSyncObserver; brightnessSyncObserver = new BrightnessSyncObserver(mHandler); brightnessSyncObserver.startObserving(); // It is possible for the system to start up with the int and float values not // synchronized. So we force an update to the int value, since float is the source // of truth. Fallback to int value, if float is invalid. If both are invalid, use default // float value from config. final float currentFloatBrightness = getScreenBrightnessFloat(context); final int currentIntBrightness = getScreenBrightnessInt(context); final float currentFloatBrightness = getScreenBrightnessFloat(mContext); final int currentIntBrightness = getScreenBrightnessInt(mContext); if (!Float.isNaN(currentFloatBrightness)) { updateBrightnessIntFromFloat(currentFloatBrightness); Loading Loading @@ -156,8 +164,6 @@ public class BrightnessSynchronizer { UserHandle.USER_CURRENT); } private float mPreferredSettingValue; /** * Updates the float setting based on a passed in int value. This is called whenever the int * setting changes. mWriteHistory keeps a record of the values that been written to the settings Loading services/core/java/com/android/server/display/DisplayPowerController.java +1 −0 Original line number Diff line number Diff line Loading @@ -417,6 +417,7 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call mBlanker = blanker; mContext = context; mBrightnessSynchronizer = new BrightnessSynchronizer(context); mBrightnessSynchronizer.startSynchronizing(); mDisplayId = displayId; PowerManager pm = context.getSystemService(PowerManager.class); Loading Loading
core/java/com/android/internal/BrightnessSynchronizer.java +17 −11 Original line number Diff line number Diff line Loading @@ -73,18 +73,26 @@ public class BrightnessSynchronizer { } }; private float mPreferredSettingValue; public BrightnessSynchronizer(Context context) { final BrightnessSyncObserver mBrightnessSyncObserver; mContext = context; mBrightnessSyncObserver = new BrightnessSyncObserver(mHandler); mBrightnessSyncObserver.startObserving(); } /** * Starts brightnessSyncObserver to ensure that the float and int brightness values stay * in sync. * This also ensures that values are synchronized at system start up too. * So we force an update to the int value, since float is the source of truth. Fallback to int * value, if float is invalid. If both are invalid, use default float value from config. */ public void startSynchronizing() { final BrightnessSyncObserver brightnessSyncObserver; brightnessSyncObserver = new BrightnessSyncObserver(mHandler); brightnessSyncObserver.startObserving(); // It is possible for the system to start up with the int and float values not // synchronized. So we force an update to the int value, since float is the source // of truth. Fallback to int value, if float is invalid. If both are invalid, use default // float value from config. final float currentFloatBrightness = getScreenBrightnessFloat(context); final int currentIntBrightness = getScreenBrightnessInt(context); final float currentFloatBrightness = getScreenBrightnessFloat(mContext); final int currentIntBrightness = getScreenBrightnessInt(mContext); if (!Float.isNaN(currentFloatBrightness)) { updateBrightnessIntFromFloat(currentFloatBrightness); Loading Loading @@ -156,8 +164,6 @@ public class BrightnessSynchronizer { UserHandle.USER_CURRENT); } private float mPreferredSettingValue; /** * Updates the float setting based on a passed in int value. This is called whenever the int * setting changes. mWriteHistory keeps a record of the values that been written to the settings Loading
services/core/java/com/android/server/display/DisplayPowerController.java +1 −0 Original line number Diff line number Diff line Loading @@ -417,6 +417,7 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call mBlanker = blanker; mContext = context; mBrightnessSynchronizer = new BrightnessSynchronizer(context); mBrightnessSynchronizer.startSynchronizing(); mDisplayId = displayId; PowerManager pm = context.getSystemService(PowerManager.class); Loading