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

Commit b3151540 authored by Piotr Wilczyński's avatar Piotr Wilczyński Committed by Android (Google) Code Review
Browse files

Merge "Log doze requests and display state reason" into main

parents 697399a6 da9c1623
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -1755,6 +1755,7 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
        mTempBrightnessEvent.setPhysicalDisplayId(mUniqueDisplayId);
        mTempBrightnessEvent.setPhysicalDisplayName(mPhysicalDisplayName);
        mTempBrightnessEvent.setDisplayState(state);
        mTempBrightnessEvent.setDisplayStateReason(stateAndReason.second);
        mTempBrightnessEvent.setDisplayPolicy(mPowerRequest.policy);
        mTempBrightnessEvent.setReason(mBrightnessReason);
        mTempBrightnessEvent.setHbmMax(hbmMax);
+10 −0
Original line number Diff line number Diff line
@@ -52,6 +52,8 @@ public final class BrightnessEvent {
    private String mPhysicalDisplayId;
    private String mPhysicalDisplayName;
    private int mDisplayState;
    @Display.StateReason
    private int mDisplayStateReason;
    private int mDisplayPolicy;
    private long mTime;
    private float mLux;
@@ -96,6 +98,7 @@ public final class BrightnessEvent {
        mPhysicalDisplayId = that.getPhysicalDisplayId();
        mPhysicalDisplayName = that.getPhysicalDisplayName();
        mDisplayState = that.mDisplayState;
        mDisplayStateReason = that.mDisplayStateReason;
        mDisplayPolicy = that.mDisplayPolicy;
        mTime = that.getTime();
        // Lux values
@@ -133,6 +136,7 @@ public final class BrightnessEvent {
        mPhysicalDisplayId = "";
        mPhysicalDisplayName = "";
        mDisplayState = Display.STATE_UNKNOWN;
        mDisplayStateReason = Display.STATE_REASON_UNKNOWN;
        mDisplayPolicy = POLICY_OFF;
        // Lux values
        mLux = INVALID_LUX;
@@ -176,6 +180,7 @@ public final class BrightnessEvent {
                && mPhysicalDisplayId.equals(that.mPhysicalDisplayId)
                && mPhysicalDisplayName.equals(that.mPhysicalDisplayName)
                && mDisplayState == that.mDisplayState
                && mDisplayStateReason == that.mDisplayStateReason
                && mDisplayPolicy == that.mDisplayPolicy
                && Float.floatToRawIntBits(mLux) == Float.floatToRawIntBits(that.mLux)
                && Float.floatToRawIntBits(mPreThresholdLux)
@@ -221,6 +226,7 @@ public final class BrightnessEvent {
                + ", reason=" + mReason.toString(mAdjustmentFlags)
                + ", strat=" + mDisplayBrightnessStrategyName
                + ", state=" + Display.stateToString(mDisplayState)
                + ", stateReason=" + Display.stateReasonToString(mDisplayStateReason)
                + ", policy=" + policyToString(mDisplayPolicy)
                + ", flags=" + flagsToString()
                // Autobrightness
@@ -293,6 +299,10 @@ public final class BrightnessEvent {
        mDisplayState = state;
    }

    public void setDisplayStateReason(@Display.StateReason int reason) {
        mDisplayStateReason = reason;
    }

    public void setDisplayPolicy(int policy) {
        mDisplayPolicy = policy;
    }
+4 −5
Original line number Diff line number Diff line
@@ -544,11 +544,10 @@ public final class DreamManagerService extends SystemService {

    private void startDozingInternal(IBinder token, int screenState,
            @Display.StateReason int reason, int screenBrightness) {
        if (DEBUG) {
        Slog.d(TAG, "Dream requested to start dozing: " + token
                    + ", screenState=" + screenState
                + ", screenState=" + Display.stateToString(screenState)
                + ", reason=" + Display.stateReasonToString(reason)
                + ", screenBrightness=" + screenBrightness);
        }

        synchronized (mLock) {
            if (mCurrentDream != null && mCurrentDream.token == token && mCurrentDream.canDoze) {
+4 −3
Original line number Diff line number Diff line
@@ -46,6 +46,7 @@ public final class BrightnessEventTest {
        mBrightnessEvent.setPhysicalDisplayId("987654321");
        mBrightnessEvent.setPhysicalDisplayName("display_name");
        mBrightnessEvent.setDisplayState(Display.STATE_ON);
        mBrightnessEvent.setDisplayStateReason(Display.STATE_REASON_DEFAULT_POLICY);
        mBrightnessEvent.setDisplayPolicy(POLICY_BRIGHT);
        mBrightnessEvent.setLux(100.0f);
        mBrightnessEvent.setPercent(46.5f);
@@ -82,9 +83,9 @@ public final class BrightnessEventTest {
        String actualString = mBrightnessEvent.toString(false);
        String expectedString =
                "BrightnessEvent: brt=0.6 (46.5%), nits= 893.8, lux=100.0, reason=doze [ "
                        + "low_pwr ], strat=strategy_name, state=ON, policy=BRIGHT, flags=, "
                        + "initBrt=25.0, rcmdBrt=0.6, preBrt=NaN, preLux=150.0, "
                        + "wasShortTermModelActive=true, autoBrightness=true (idle), "
                        + "low_pwr ], strat=strategy_name, state=ON, stateReason=DEFAULT_POLICY, "
                        + "policy=BRIGHT, flags=, initBrt=25.0, rcmdBrt=0.6, preBrt=NaN, "
                        + "preLux=150.0, wasShortTermModelActive=true, autoBrightness=true (idle), "
                        + "unclampedBrt=0.65, hbmMax=0.62, hbmMode=off, thrmMax=0.65, "
                        + "rbcStrength=-1, powerFactor=0.2, physDisp=display_name(987654321), "
                        + "logicalId=1";