Loading services/core/java/com/android/server/display/BrightnessSetting.java +7 −0 Original line number Original line Diff line number Diff line Loading @@ -149,6 +149,13 @@ public class BrightnessSetting { } } } } /** * Flush the brightness update that has been made to the persistent data store. */ public void saveIfNeeded() { mPersistentDataStore.saveIfNeeded(); } /** /** * @return The brightness for the default display in nits. Used when the underlying display * @return The brightness for the default display in nits. Used when the underlying display * device has changed but we want to persist the nit value. * device has changed but we want to persist the nit value. Loading services/core/java/com/android/server/display/DisplayPowerController.java +5 −0 Original line number Original line Diff line number Diff line Loading @@ -2484,6 +2484,11 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call Settings.System.SCREEN_BRIGHTNESS_MODE_MANUAL, UserHandle.USER_CURRENT); Settings.System.SCREEN_BRIGHTNESS_MODE_MANUAL, UserHandle.USER_CURRENT); mAutomaticBrightnessStrategy.setUseAutoBrightness(screenBrightnessModeSetting mAutomaticBrightnessStrategy.setUseAutoBrightness(screenBrightnessModeSetting == Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC); == Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC); if (screenBrightnessModeSetting == Settings.System.SCREEN_BRIGHTNESS_MODE_MANUAL) { // In manual mode, all brightness changes should be saved immediately. mDisplayBrightnessController.saveBrightnessIfNeeded(); } } } Loading services/core/java/com/android/server/display/brightness/DisplayBrightnessController.java +7 −0 Original line number Original line Diff line number Diff line Loading @@ -338,6 +338,13 @@ public final class DisplayBrightnessController { setBrightness(brightnessValue, maxBrightness); setBrightness(brightnessValue, maxBrightness); } } /** * Flush the brightness update that has been made to the persistent data store. */ public void saveBrightnessIfNeeded() { mBrightnessSetting.saveIfNeeded(); } /** /** * Sets the current screen brightness, and notifies the BrightnessSetting about the change. * Sets the current screen brightness, and notifies the BrightnessSetting about the change. */ */ Loading services/tests/displayservicetests/src/com/android/server/display/DisplayPowerControllerTest.java +14 −0 Original line number Original line Diff line number Diff line Loading @@ -2213,6 +2213,20 @@ public final class DisplayPowerControllerTest { /* ignoreAnimationLimits= */ anyBoolean()); /* ignoreAnimationLimits= */ anyBoolean()); } } @Test public void testManualBrightnessModeSavesBrightness() { DisplayPowerRequest dpr = new DisplayPowerRequest(); mHolder.dpc.requestPowerState(dpr, /* waitForNegativeProximity= */ false); advanceTime(1); // Initialize Settings.System.putInt(mContext.getContentResolver(), Settings.System.SCREEN_BRIGHTNESS_MODE, Settings.System.SCREEN_BRIGHTNESS_MODE_MANUAL); advanceTime(1); verify(mHolder.brightnessSetting).saveIfNeeded(); } /** /** * Creates a mock and registers it to {@link LocalServices}. * Creates a mock and registers it to {@link LocalServices}. */ */ Loading Loading
services/core/java/com/android/server/display/BrightnessSetting.java +7 −0 Original line number Original line Diff line number Diff line Loading @@ -149,6 +149,13 @@ public class BrightnessSetting { } } } } /** * Flush the brightness update that has been made to the persistent data store. */ public void saveIfNeeded() { mPersistentDataStore.saveIfNeeded(); } /** /** * @return The brightness for the default display in nits. Used when the underlying display * @return The brightness for the default display in nits. Used when the underlying display * device has changed but we want to persist the nit value. * device has changed but we want to persist the nit value. Loading
services/core/java/com/android/server/display/DisplayPowerController.java +5 −0 Original line number Original line Diff line number Diff line Loading @@ -2484,6 +2484,11 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call Settings.System.SCREEN_BRIGHTNESS_MODE_MANUAL, UserHandle.USER_CURRENT); Settings.System.SCREEN_BRIGHTNESS_MODE_MANUAL, UserHandle.USER_CURRENT); mAutomaticBrightnessStrategy.setUseAutoBrightness(screenBrightnessModeSetting mAutomaticBrightnessStrategy.setUseAutoBrightness(screenBrightnessModeSetting == Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC); == Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC); if (screenBrightnessModeSetting == Settings.System.SCREEN_BRIGHTNESS_MODE_MANUAL) { // In manual mode, all brightness changes should be saved immediately. mDisplayBrightnessController.saveBrightnessIfNeeded(); } } } Loading
services/core/java/com/android/server/display/brightness/DisplayBrightnessController.java +7 −0 Original line number Original line Diff line number Diff line Loading @@ -338,6 +338,13 @@ public final class DisplayBrightnessController { setBrightness(brightnessValue, maxBrightness); setBrightness(brightnessValue, maxBrightness); } } /** * Flush the brightness update that has been made to the persistent data store. */ public void saveBrightnessIfNeeded() { mBrightnessSetting.saveIfNeeded(); } /** /** * Sets the current screen brightness, and notifies the BrightnessSetting about the change. * Sets the current screen brightness, and notifies the BrightnessSetting about the change. */ */ Loading
services/tests/displayservicetests/src/com/android/server/display/DisplayPowerControllerTest.java +14 −0 Original line number Original line Diff line number Diff line Loading @@ -2213,6 +2213,20 @@ public final class DisplayPowerControllerTest { /* ignoreAnimationLimits= */ anyBoolean()); /* ignoreAnimationLimits= */ anyBoolean()); } } @Test public void testManualBrightnessModeSavesBrightness() { DisplayPowerRequest dpr = new DisplayPowerRequest(); mHolder.dpc.requestPowerState(dpr, /* waitForNegativeProximity= */ false); advanceTime(1); // Initialize Settings.System.putInt(mContext.getContentResolver(), Settings.System.SCREEN_BRIGHTNESS_MODE, Settings.System.SCREEN_BRIGHTNESS_MODE_MANUAL); advanceTime(1); verify(mHolder.brightnessSetting).saveIfNeeded(); } /** /** * Creates a mock and registers it to {@link LocalServices}. * Creates a mock and registers it to {@link LocalServices}. */ */ Loading