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

Commit d144ebbc authored by Piotr Wilczyński's avatar Piotr Wilczyński
Browse files

Brightness wear bedtime mode clamper max reason

Bug: 325644776
Test: atest com.android.server.display.brightness.clamper
Change-Id: I5c4f48a6e9e18e1bff41b73b69866df3ef913bf6
parent 62c2e3f7
Loading
Loading
Loading
Loading
+5 −0
Original line number Original line Diff line number Diff line
@@ -80,6 +80,11 @@ public final class BrightnessInfo implements Parcelable {
     */
     */
    public static final int BRIGHTNESS_MAX_REASON_POWER_IC = 2;
    public static final int BRIGHTNESS_MAX_REASON_POWER_IC = 2;


    /**
     * Maximum brightness is restricted due to the Wear bedtime mode.
     */
    public static final int BRIGHTNESS_MAX_REASON_WEAR_BEDTIME_MODE = 3;

    /** Brightness */
    /** Brightness */
    public final float brightness;
    public final float brightness;


+1 −1
Original line number Original line Diff line number Diff line
@@ -75,6 +75,6 @@ abstract class BrightnessClamper<T> {
    protected enum Type {
    protected enum Type {
        THERMAL,
        THERMAL,
        POWER,
        POWER,
        BEDTIME_MODE,
        WEAR_BEDTIME_MODE,
    }
    }
}
}
+2 −0
Original line number Original line Diff line number Diff line
@@ -156,6 +156,8 @@ public class BrightnessClamperController {
            return BrightnessInfo.BRIGHTNESS_MAX_REASON_THERMAL;
            return BrightnessInfo.BRIGHTNESS_MAX_REASON_THERMAL;
        } else if (mClamperType == Type.POWER) {
        } else if (mClamperType == Type.POWER) {
            return BrightnessInfo.BRIGHTNESS_MAX_REASON_POWER_IC;
            return BrightnessInfo.BRIGHTNESS_MAX_REASON_POWER_IC;
        } else if (mClamperType == Type.WEAR_BEDTIME_MODE) {
            return BrightnessInfo.BRIGHTNESS_MAX_REASON_WEAR_BEDTIME_MODE;
        } else {
        } else {
            Slog.wtf(TAG, "BrightnessMaxReason not mapped for type=" + mClamperType);
            Slog.wtf(TAG, "BrightnessMaxReason not mapped for type=" + mClamperType);
            return BrightnessInfo.BRIGHTNESS_MAX_REASON_NONE;
            return BrightnessInfo.BRIGHTNESS_MAX_REASON_NONE;
+1 −1
Original line number Original line Diff line number Diff line
@@ -64,7 +64,7 @@ public class BrightnessWearBedtimeModeClamper extends
    @NonNull
    @NonNull
    @Override
    @Override
    Type getType() {
    Type getType() {
        return Type.BEDTIME_MODE;
        return Type.WEAR_BEDTIME_MODE;
    }
    }


    @Override
    @Override
+1 −1
Original line number Original line Diff line number Diff line
@@ -85,7 +85,7 @@ public class BrightnessWearBedtimeModeClamperTest {


    @Test
    @Test
    public void testType() {
    public void testType() {
        assertEquals(BrightnessClamper.Type.BEDTIME_MODE, mClamper.getType());
        assertEquals(BrightnessClamper.Type.WEAR_BEDTIME_MODE, mClamper.getType());
    }
    }


    @Test
    @Test