Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d6080c5a authored by Rupesh Bansal's avatar Rupesh Bansal
Browse files

Introducing AutomaticBrightnessStrategy

Creating an AutomaticBrightnessStrategy, which will be
responsible for managing all the auto-brightness related states when
evaluating the brightness.

This strategy is currently linked directly to DisplayPowerController2,
and is not implementing the DisplayBrightnessStrategy interface to keep
the scope limited. As a followup, this will be fully ported to inherit
all the properties of a strategy, and there will be no direct linkage
between DisplayPowerController and AutomaticBrightnessStrategy

Test: atest AutomaticBrightnessStrategyTest.java
Bug: 265415257
Change-Id: Idd8479109ee398729c8d84cab82a4bba5f0c6c1f
parent f9e6314f
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -1634,7 +1634,6 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
            mAppliedAutoBrightness = false;
            brightnessAdjustmentFlags = 0;
        }

        // Use default brightness when dozing unless overridden.
        if ((Float.isNaN(brightnessState))
                && Display.isDozeState(state)) {
+67 −156

File changed.

Preview size limit exceeded, changes collapsed.

+404 −0

File added.

Preview size limit exceeded, changes collapsed.

+4 −5
Original line number Diff line number Diff line
@@ -66,7 +66,6 @@ import com.android.dx.mockito.inline.extended.ExtendedMockito;
import com.android.server.LocalServices;
import com.android.server.am.BatteryStatsService;
import com.android.server.display.RampAnimator.DualRampAnimator;
import com.android.server.display.brightness.BrightnessEvent;
import com.android.server.display.color.ColorDisplayService;
import com.android.server.display.layout.Layout;
import com.android.server.display.whitebalance.DisplayWhiteBalanceController;
@@ -565,8 +564,8 @@ public final class DisplayPowerController2Test {
                .thenReturn(brightness);
        dpr.policy = DisplayPowerRequest.POLICY_BRIGHT;
        when(mHolder.displayPowerState.getScreenState()).thenReturn(Display.STATE_ON);
        when(mHolder.automaticBrightnessController.getAutomaticScreenBrightness(
                any(BrightnessEvent.class))).thenReturn(PowerManager.BRIGHTNESS_INVALID_FLOAT);
        when(mHolder.automaticBrightnessController.getAutomaticScreenBrightness())
                .thenReturn(PowerManager.BRIGHTNESS_INVALID_FLOAT);

        mHolder.dpc.requestPowerState(dpr, /* waitForNegativeProximity= */ false);
        advanceTime(1); // Run updatePowerState
@@ -603,8 +602,8 @@ public final class DisplayPowerController2Test {
                .thenReturn(brightness);
        dpr.policy = DisplayPowerRequest.POLICY_BRIGHT;
        when(mHolder.displayPowerState.getScreenState()).thenReturn(Display.STATE_ON);
        when(mHolder.automaticBrightnessController.getAutomaticScreenBrightness(
                any(BrightnessEvent.class))).thenReturn(PowerManager.BRIGHTNESS_INVALID_FLOAT);
        when(mHolder.automaticBrightnessController.getAutomaticScreenBrightness())
                .thenReturn(PowerManager.BRIGHTNESS_INVALID_FLOAT);

        mHolder.dpc.requestPowerState(dpr, /* waitForNegativeProximity= */ false);
        advanceTime(1); // Run updatePowerState
+329 −0

File added.

Preview size limit exceeded, changes collapsed.