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

Commit 772cacf7 authored by Piotr Wilczyński's avatar Piotr Wilczyński Committed by Automerger Merge Worker
Browse files

Merge "Pass brightness ramp rate to follower displays" into udc-qpr-dev am:...

Merge "Pass brightness ramp rate to follower displays" into udc-qpr-dev am: 5dc4f71d am: 9b0e554e

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/23632794



Change-Id: I2bf29345812fdb65bc44fc6174a54e83a0cc5c01
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 42f38ee9 9b0e554e
Loading
Loading
Loading
Loading
+33 −14
Original line number Original line Diff line number Diff line
@@ -512,6 +512,9 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
    // of the lead display that this DPC should follow.
    // of the lead display that this DPC should follow.
    private float mBrightnessToFollow;
    private float mBrightnessToFollow;


    // Indicates whether we should ramp slowly to the brightness value to follow.
    private boolean mBrightnessToFollowSlowChange;

    // The last auto brightness adjustment that was set by the user and not temporary. Set to
    // The last auto brightness adjustment that was set by the user and not temporary. Set to
    // Float.NaN when an auto-brightness adjustment hasn't been recorded yet.
    // Float.NaN when an auto-brightness adjustment hasn't been recorded yet.
    private float mAutoBrightnessAdjustment;
    private float mAutoBrightnessAdjustment;
@@ -812,7 +815,8 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
    }
    }


    @Override
    @Override
    public void setBrightnessToFollow(float leadDisplayBrightness, float nits, float ambientLux) {
    public void setBrightnessToFollow(float leadDisplayBrightness, float nits, float ambientLux,
            boolean slowChange) {
        mBrightnessRangeController.onAmbientLuxChange(ambientLux);
        mBrightnessRangeController.onAmbientLuxChange(ambientLux);
        if (nits < 0) {
        if (nits < 0) {
            mBrightnessToFollow = leadDisplayBrightness;
            mBrightnessToFollow = leadDisplayBrightness;
@@ -825,6 +829,7 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
                mBrightnessToFollow = leadDisplayBrightness;
                mBrightnessToFollow = leadDisplayBrightness;
            }
            }
        }
        }
        mBrightnessToFollowSlowChange = slowChange;
        sendUpdatePowerState();
        sendUpdatePowerState();
    }
    }


@@ -842,7 +847,7 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
            mDisplayBrightnessFollowers.remove(follower.getDisplayId());
            mDisplayBrightnessFollowers.remove(follower.getDisplayId());
            mHandler.postAtTime(() -> follower.setBrightnessToFollow(
            mHandler.postAtTime(() -> follower.setBrightnessToFollow(
                    PowerManager.BRIGHTNESS_INVALID_FLOAT, /* nits= */ -1,
                    PowerManager.BRIGHTNESS_INVALID_FLOAT, /* nits= */ -1,
                    /* ambientLux= */ 0), mClock.uptimeMillis());
                    /* ambientLux= */ 0, /* slowChange= */ false), mClock.uptimeMillis());
        }
        }
    }
    }


@@ -852,7 +857,7 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
            DisplayPowerControllerInterface follower = mDisplayBrightnessFollowers.valueAt(i);
            DisplayPowerControllerInterface follower = mDisplayBrightnessFollowers.valueAt(i);
            mHandler.postAtTime(() -> follower.setBrightnessToFollow(
            mHandler.postAtTime(() -> follower.setBrightnessToFollow(
                    PowerManager.BRIGHTNESS_INVALID_FLOAT, /* nits= */ -1,
                    PowerManager.BRIGHTNESS_INVALID_FLOAT, /* nits= */ -1,
                    /* ambientLux= */ 0), mClock.uptimeMillis());
                    /* ambientLux= */ 0, /* slowChange= */ false), mClock.uptimeMillis());
        }
        }
        mDisplayBrightnessFollowers.clear();
        mDisplayBrightnessFollowers.clear();
    }
    }
@@ -1559,6 +1564,7 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
        final int oldState = mPowerState.getScreenState();
        final int oldState = mPowerState.getScreenState();
        animateScreenStateChange(state, performScreenOffTransition);
        animateScreenStateChange(state, performScreenOffTransition);
        state = mPowerState.getScreenState();
        state = mPowerState.getScreenState();
        boolean slowChange = false;


        if (state == Display.STATE_OFF) {
        if (state == Display.STATE_OFF) {
            brightnessState = PowerManager.BRIGHTNESS_OFF_FLOAT;
            brightnessState = PowerManager.BRIGHTNESS_OFF_FLOAT;
@@ -1567,6 +1573,7 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call


        if (Float.isNaN(brightnessState) && isValidBrightnessValue(mBrightnessToFollow)) {
        if (Float.isNaN(brightnessState) && isValidBrightnessValue(mBrightnessToFollow)) {
            brightnessState = mBrightnessToFollow;
            brightnessState = mBrightnessToFollow;
            slowChange = mBrightnessToFollowSlowChange;
            mBrightnessReasonTemp.setReason(BrightnessReason.REASON_FOLLOWER);
            mBrightnessReasonTemp.setReason(BrightnessReason.REASON_FOLLOWER);
        }
        }


@@ -1661,7 +1668,6 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
        float rawBrightnessState = brightnessState;
        float rawBrightnessState = brightnessState;


        // Apply auto-brightness.
        // Apply auto-brightness.
        boolean slowChange = false;
        if (Float.isNaN(brightnessState)) {
        if (Float.isNaN(brightnessState)) {
            float newAutoBrightnessAdjustment = autoBrightnessAdjustment;
            float newAutoBrightnessAdjustment = autoBrightnessAdjustment;
            if (autoBrightnessEnabled) {
            if (autoBrightnessEnabled) {
@@ -1740,6 +1746,14 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
            mBrightnessReasonTemp.setReason(BrightnessReason.REASON_MANUAL);
            mBrightnessReasonTemp.setReason(BrightnessReason.REASON_MANUAL);
        }
        }


        float ambientLux = mAutomaticBrightnessController == null ? 0
                : mAutomaticBrightnessController.getAmbientLux();
        for (int i = 0; i < displayBrightnessFollowers.size(); i++) {
            DisplayPowerControllerInterface follower = displayBrightnessFollowers.valueAt(i);
            follower.setBrightnessToFollow(rawBrightnessState, convertToNits(rawBrightnessState),
                    ambientLux, slowChange);
        }

        // Now that a desired brightness has been calculated, apply brightness throttling. The
        // Now that a desired brightness has been calculated, apply brightness throttling. The
        // dimming and low power transformations that follow can only dim brightness further.
        // dimming and low power transformations that follow can only dim brightness further.
        //
        //
@@ -1762,14 +1776,6 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
            mAppliedThrottling = false;
            mAppliedThrottling = false;
        }
        }


        float ambientLux = mAutomaticBrightnessController == null ? 0
                : mAutomaticBrightnessController.getAmbientLux();
        for (int i = 0; i < displayBrightnessFollowers.size(); i++) {
            DisplayPowerControllerInterface follower = displayBrightnessFollowers.valueAt(i);
            follower.setBrightnessToFollow(rawBrightnessState, convertToNits(rawBrightnessState),
                    ambientLux);
        }

        if (updateScreenBrightnessSetting) {
        if (updateScreenBrightnessSetting) {
            // Tell the rest of the system about the new brightness in case we had to change it
            // Tell the rest of the system about the new brightness in case we had to change it
            // for things like auto-brightness or high-brightness-mode. Note that we do this
            // for things like auto-brightness or high-brightness-mode. Note that we do this
@@ -2157,8 +2163,9 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
        final DisplayDeviceConfig.HighBrightnessModeData hbmData =
        final DisplayDeviceConfig.HighBrightnessModeData hbmData =
                ddConfig != null ? ddConfig.getHighBrightnessModeData() : null;
                ddConfig != null ? ddConfig.getHighBrightnessModeData() : null;
        final DisplayDeviceInfo info = device.getDisplayDeviceInfoLocked();
        final DisplayDeviceInfo info = device.getDisplayDeviceInfoLocked();
        return new HighBrightnessModeController(mHandler, info.width, info.height, displayToken,
        return mInjector.getHighBrightnessModeController(mHandler, info.width, info.height,
                displayUniqueId, PowerManager.BRIGHTNESS_MIN, PowerManager.BRIGHTNESS_MAX, hbmData,
                displayToken, displayUniqueId, PowerManager.BRIGHTNESS_MIN,
                PowerManager.BRIGHTNESS_MAX, hbmData,
                new HighBrightnessModeController.HdrBrightnessDeviceConfig() {
                new HighBrightnessModeController.HdrBrightnessDeviceConfig() {
                    @Override
                    @Override
                    public float getHdrBrightnessFromSdr(
                    public float getHdrBrightnessFromSdr(
@@ -2949,6 +2956,7 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
                + mPendingScreenBrightnessSetting);
                + mPendingScreenBrightnessSetting);
        pw.println("  mTemporaryScreenBrightness=" + mTemporaryScreenBrightness);
        pw.println("  mTemporaryScreenBrightness=" + mTemporaryScreenBrightness);
        pw.println("  mBrightnessToFollow=" + mBrightnessToFollow);
        pw.println("  mBrightnessToFollow=" + mBrightnessToFollow);
        pw.println("  mBrightnessToFollowSlowChange=" + mBrightnessToFollowSlowChange);
        pw.println("  mAutoBrightnessAdjustment=" + mAutoBrightnessAdjustment);
        pw.println("  mAutoBrightnessAdjustment=" + mAutoBrightnessAdjustment);
        pw.println("  mBrightnessReason=" + mBrightnessReason);
        pw.println("  mBrightnessReason=" + mBrightnessReason);
        pw.println("  mTemporaryAutoBrightnessAdjustment=" + mTemporaryAutoBrightnessAdjustment);
        pw.println("  mTemporaryAutoBrightnessAdjustment=" + mTemporaryAutoBrightnessAdjustment);
@@ -3528,6 +3536,17 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
                    brightnessMapper
                    brightnessMapper
            );
            );
        }
        }

        HighBrightnessModeController getHighBrightnessModeController(Handler handler, int width,
                int height, IBinder displayToken, String displayUniqueId, float brightnessMin,
                float brightnessMax, DisplayDeviceConfig.HighBrightnessModeData hbmData,
                HighBrightnessModeController.HdrBrightnessDeviceConfig hdrBrightnessCfg,
                Runnable hbmChangeCallback, HighBrightnessModeMetadata hbmMetadata,
                Context context) {
            return new HighBrightnessModeController(handler, width, height, displayToken,
                    displayUniqueId, brightnessMin, brightnessMax, hbmData, hdrBrightnessCfg,
                    hbmChangeCallback, hbmMetadata, context);
        }
    }
    }


    static class CachedBrightnessInfo {
    static class CachedBrightnessInfo {
+42 −16
Original line number Original line Diff line number Diff line
@@ -435,6 +435,9 @@ final class DisplayPowerController2 implements AutomaticBrightnessController.Cal
    @Nullable
    @Nullable
    private BrightnessMappingStrategy mIdleModeBrightnessMapper;
    private BrightnessMappingStrategy mIdleModeBrightnessMapper;


    // Indicates whether we should ramp slowly to the brightness value to follow.
    private boolean mBrightnessToFollowSlowChange;

    private boolean mIsRbcActive;
    private boolean mIsRbcActive;


    // Animators.
    // Animators.
@@ -1272,6 +1275,7 @@ final class DisplayPowerController2 implements AutomaticBrightnessController.Cal
        // actual state instead of the desired one.
        // actual state instead of the desired one.
        animateScreenStateChange(state, mDisplayStateController.shouldPerformScreenOffTransition());
        animateScreenStateChange(state, mDisplayStateController.shouldPerformScreenOffTransition());
        state = mPowerState.getScreenState();
        state = mPowerState.getScreenState();
        boolean slowChange = false;
        final boolean userSetBrightnessChanged = mDisplayBrightnessController
        final boolean userSetBrightnessChanged = mDisplayBrightnessController
                .updateUserSetScreenBrightness();
                .updateUserSetScreenBrightness();


@@ -1281,6 +1285,11 @@ final class DisplayPowerController2 implements AutomaticBrightnessController.Cal
        float rawBrightnessState = displayBrightnessState.getBrightness();
        float rawBrightnessState = displayBrightnessState.getBrightness();
        mBrightnessReasonTemp.set(displayBrightnessState.getBrightnessReason());
        mBrightnessReasonTemp.set(displayBrightnessState.getBrightnessReason());


        if (displayBrightnessState.getBrightnessReason().getReason()
                == BrightnessReason.REASON_FOLLOWER) {
            slowChange = mBrightnessToFollowSlowChange;
        }

        // Take note if the short term model was already active before applying the current
        // Take note if the short term model was already active before applying the current
        // request changes.
        // request changes.
        final boolean wasShortTermModelActive =
        final boolean wasShortTermModelActive =
@@ -1305,7 +1314,6 @@ final class DisplayPowerController2 implements AutomaticBrightnessController.Cal
        boolean updateScreenBrightnessSetting = false;
        boolean updateScreenBrightnessSetting = false;
        float currentBrightnessSetting = mDisplayBrightnessController.getCurrentBrightness();
        float currentBrightnessSetting = mDisplayBrightnessController.getCurrentBrightness();
        // Apply auto-brightness.
        // Apply auto-brightness.
        boolean slowChange = false;
        int brightnessAdjustmentFlags = 0;
        int brightnessAdjustmentFlags = 0;
        if (Float.isNaN(brightnessState)) {
        if (Float.isNaN(brightnessState)) {
            if (mAutomaticBrightnessStrategy.isAutoBrightnessEnabled()) {
            if (mAutomaticBrightnessStrategy.isAutoBrightnessEnabled()) {
@@ -1322,10 +1330,13 @@ final class DisplayPowerController2 implements AutomaticBrightnessController.Cal
                    brightnessAdjustmentFlags =
                    brightnessAdjustmentFlags =
                            mAutomaticBrightnessStrategy.getAutoBrightnessAdjustmentReasonsFlags();
                            mAutomaticBrightnessStrategy.getAutoBrightnessAdjustmentReasonsFlags();
                    updateScreenBrightnessSetting = currentBrightnessSetting != brightnessState;
                    updateScreenBrightnessSetting = currentBrightnessSetting != brightnessState;
                    mAutomaticBrightnessStrategy.setAutoBrightnessApplied(true);
                    mBrightnessReasonTemp.setReason(BrightnessReason.REASON_AUTOMATIC);
                    mBrightnessReasonTemp.setReason(BrightnessReason.REASON_AUTOMATIC);
                    if (mScreenOffBrightnessSensorController != null) {
                    if (mScreenOffBrightnessSensorController != null) {
                        mScreenOffBrightnessSensorController.setLightSensorEnabled(false);
                        mScreenOffBrightnessSensorController.setLightSensorEnabled(false);
                    }
                    }
                } else {
                    mAutomaticBrightnessStrategy.setAutoBrightnessApplied(false);
                }
                }
            }
            }
        } else {
        } else {
@@ -1333,6 +1344,7 @@ final class DisplayPowerController2 implements AutomaticBrightnessController.Cal
            // to clamping so that they don't go beyond the current max as specified by HBM
            // to clamping so that they don't go beyond the current max as specified by HBM
            // Controller.
            // Controller.
            brightnessState = clampScreenBrightness(brightnessState);
            brightnessState = clampScreenBrightness(brightnessState);
            mAutomaticBrightnessStrategy.setAutoBrightnessApplied(false);
        }
        }


        // Use default brightness when dozing unless overridden.
        // Use default brightness when dozing unless overridden.
@@ -1372,6 +1384,15 @@ final class DisplayPowerController2 implements AutomaticBrightnessController.Cal
            mBrightnessReasonTemp.setReason(BrightnessReason.REASON_MANUAL);
            mBrightnessReasonTemp.setReason(BrightnessReason.REASON_MANUAL);
        }
        }


        float ambientLux = mAutomaticBrightnessController == null ? 0
                : mAutomaticBrightnessController.getAmbientLux();
        for (int i = 0; i < displayBrightnessFollowers.size(); i++) {
            DisplayPowerControllerInterface follower = displayBrightnessFollowers.valueAt(i);
            follower.setBrightnessToFollow(rawBrightnessState,
                    mDisplayBrightnessController.convertToNits(rawBrightnessState),
                    ambientLux, slowChange);
        }

        // Now that a desired brightness has been calculated, apply brightness throttling. The
        // Now that a desired brightness has been calculated, apply brightness throttling. The
        // dimming and low power transformations that follow can only dim brightness further.
        // dimming and low power transformations that follow can only dim brightness further.
        //
        //
@@ -1394,15 +1415,6 @@ final class DisplayPowerController2 implements AutomaticBrightnessController.Cal
            mAppliedThrottling = false;
            mAppliedThrottling = false;
        }
        }


        float ambientLux = mAutomaticBrightnessController == null ? 0
                : mAutomaticBrightnessController.getAmbientLux();
        for (int i = 0; i < displayBrightnessFollowers.size(); i++) {
            DisplayPowerControllerInterface follower = displayBrightnessFollowers.valueAt(i);
            follower.setBrightnessToFollow(rawBrightnessState,
                    mDisplayBrightnessController.convertToNits(rawBrightnessState),
                    ambientLux);
        }

        if (updateScreenBrightnessSetting) {
        if (updateScreenBrightnessSetting) {
            // Tell the rest of the system about the new brightness in case we had to change it
            // Tell the rest of the system about the new brightness in case we had to change it
            // for things like auto-brightness or high-brightness-mode. Note that we do this
            // for things like auto-brightness or high-brightness-mode. Note that we do this
@@ -1804,9 +1816,9 @@ final class DisplayPowerController2 implements AutomaticBrightnessController.Cal
        final DisplayDeviceConfig.HighBrightnessModeData hbmData =
        final DisplayDeviceConfig.HighBrightnessModeData hbmData =
                ddConfig != null ? ddConfig.getHighBrightnessModeData() : null;
                ddConfig != null ? ddConfig.getHighBrightnessModeData() : null;
        final DisplayDeviceInfo info = device.getDisplayDeviceInfoLocked();
        final DisplayDeviceInfo info = device.getDisplayDeviceInfoLocked();
        return new HighBrightnessModeController(mHandler, info.width, info.height, displayToken,
        return mInjector.getHighBrightnessModeController(mHandler, info.width, info.height,
                displayUniqueId, PowerManager.BRIGHTNESS_MIN, PowerManager.BRIGHTNESS_MAX, hbmData,
                displayToken, displayUniqueId, PowerManager.BRIGHTNESS_MIN,
                (sdrBrightness, maxDesiredHdrSdrRatio) ->
                PowerManager.BRIGHTNESS_MAX, hbmData, (sdrBrightness, maxDesiredHdrSdrRatio) ->
                        mDisplayDeviceConfig.getHdrBrightnessFromSdr(sdrBrightness,
                        mDisplayDeviceConfig.getHdrBrightnessFromSdr(sdrBrightness,
                                maxDesiredHdrSdrRatio), modeChangeCallback, hbmMetadata, mContext);
                                maxDesiredHdrSdrRatio), modeChangeCallback, hbmMetadata, mContext);
    }
    }
@@ -2189,7 +2201,8 @@ final class DisplayPowerController2 implements AutomaticBrightnessController.Cal
    }
    }


    @Override
    @Override
    public void setBrightnessToFollow(float leadDisplayBrightness, float nits, float ambientLux) {
    public void setBrightnessToFollow(float leadDisplayBrightness, float nits, float ambientLux,
            boolean slowChange) {
        mBrightnessRangeController.onAmbientLuxChange(ambientLux);
        mBrightnessRangeController.onAmbientLuxChange(ambientLux);
        if (nits < 0) {
        if (nits < 0) {
            mDisplayBrightnessController.setBrightnessToFollow(leadDisplayBrightness);
            mDisplayBrightnessController.setBrightnessToFollow(leadDisplayBrightness);
@@ -2202,6 +2215,7 @@ final class DisplayPowerController2 implements AutomaticBrightnessController.Cal
                mDisplayBrightnessController.setBrightnessToFollow(leadDisplayBrightness);
                mDisplayBrightnessController.setBrightnessToFollow(leadDisplayBrightness);
            }
            }
        }
        }
        mBrightnessToFollowSlowChange = slowChange;
        sendUpdatePowerState();
        sendUpdatePowerState();
    }
    }


@@ -2261,7 +2275,7 @@ final class DisplayPowerController2 implements AutomaticBrightnessController.Cal
            mDisplayBrightnessFollowers.remove(follower.getDisplayId());
            mDisplayBrightnessFollowers.remove(follower.getDisplayId());
            mHandler.postAtTime(() -> follower.setBrightnessToFollow(
            mHandler.postAtTime(() -> follower.setBrightnessToFollow(
                    PowerManager.BRIGHTNESS_INVALID_FLOAT, /* nits= */ -1,
                    PowerManager.BRIGHTNESS_INVALID_FLOAT, /* nits= */ -1,
                    /* ambientLux= */ 0), mClock.uptimeMillis());
                    /* ambientLux= */ 0, /* slowChange= */ false), mClock.uptimeMillis());
        }
        }
    }
    }


@@ -2271,7 +2285,7 @@ final class DisplayPowerController2 implements AutomaticBrightnessController.Cal
            DisplayPowerControllerInterface follower = mDisplayBrightnessFollowers.valueAt(i);
            DisplayPowerControllerInterface follower = mDisplayBrightnessFollowers.valueAt(i);
            mHandler.postAtTime(() -> follower.setBrightnessToFollow(
            mHandler.postAtTime(() -> follower.setBrightnessToFollow(
                    PowerManager.BRIGHTNESS_INVALID_FLOAT, /* nits= */ -1,
                    PowerManager.BRIGHTNESS_INVALID_FLOAT, /* nits= */ -1,
                    /* ambientLux= */ 0), mClock.uptimeMillis());
                    /* ambientLux= */ 0, /* slowChange= */ false), mClock.uptimeMillis());
        }
        }
        mDisplayBrightnessFollowers.clear();
        mDisplayBrightnessFollowers.clear();
    }
    }
@@ -2341,6 +2355,7 @@ final class DisplayPowerController2 implements AutomaticBrightnessController.Cal
        pw.println("  mReportedToPolicy="
        pw.println("  mReportedToPolicy="
                + reportedToPolicyToString(mReportedScreenStateToPolicy));
                + reportedToPolicyToString(mReportedScreenStateToPolicy));
        pw.println("  mIsRbcActive=" + mIsRbcActive);
        pw.println("  mIsRbcActive=" + mIsRbcActive);
        pw.println("  mBrightnessToFollowSlowChange=" + mBrightnessToFollowSlowChange);
        IndentingPrintWriter ipw = new IndentingPrintWriter(pw, "    ");
        IndentingPrintWriter ipw = new IndentingPrintWriter(pw, "    ");
        mAutomaticBrightnessStrategy.dump(ipw);
        mAutomaticBrightnessStrategy.dump(ipw);


@@ -2892,6 +2907,17 @@ final class DisplayPowerController2 implements AutomaticBrightnessController.Cal
                    brightnessMapper
                    brightnessMapper
            );
            );
        }
        }

        HighBrightnessModeController getHighBrightnessModeController(Handler handler, int width,
                int height, IBinder displayToken, String displayUniqueId, float brightnessMin,
                float brightnessMax, DisplayDeviceConfig.HighBrightnessModeData hbmData,
                HighBrightnessModeController.HdrBrightnessDeviceConfig hdrBrightnessCfg,
                Runnable hbmChangeCallback, HighBrightnessModeMetadata hbmMetadata,
                Context context) {
            return new HighBrightnessModeController(handler, width, height, displayToken,
                    displayUniqueId, brightnessMin, brightnessMax, hbmData, hdrBrightnessCfg,
                    hbmChangeCallback, hbmMetadata, context);
        }
    }
    }


    static class CachedBrightnessInfo {
    static class CachedBrightnessInfo {
+3 −1
Original line number Original line Diff line number Diff line
@@ -201,8 +201,10 @@ public interface DisplayPowerControllerInterface {
     * @param nits The brightness value in nits if the device supports nits. Set to a negative
     * @param nits The brightness value in nits if the device supports nits. Set to a negative
     *             number otherwise.
     *             number otherwise.
     * @param ambientLux The lux value that will be passed to {@link HighBrightnessModeController}
     * @param ambientLux The lux value that will be passed to {@link HighBrightnessModeController}
     * @param slowChange Indicates whether we should slowly animate to the given brightness value.
     */
     */
    void setBrightnessToFollow(float leadDisplayBrightness, float nits, float ambientLux);
    void setBrightnessToFollow(float leadDisplayBrightness, float nits, float ambientLux,
            boolean slowChange);


    /**
    /**
     * Add an additional display that will copy the brightness value from this display. This is used
     * Add an additional display that will copy the brightness value from this display. This is used
+1 −4
Original line number Original line Diff line number Diff line
@@ -287,8 +287,6 @@ public class AutomaticBrightnessStrategy {
        mAutoBrightnessAdjustmentReasonsFlags = isTemporaryAutoBrightnessAdjustmentApplied()
        mAutoBrightnessAdjustmentReasonsFlags = isTemporaryAutoBrightnessAdjustmentApplied()
                ? BrightnessReason.ADJUSTMENT_AUTO_TEMP
                ? BrightnessReason.ADJUSTMENT_AUTO_TEMP
                : BrightnessReason.ADJUSTMENT_AUTO;
                : BrightnessReason.ADJUSTMENT_AUTO;
        mAppliedAutoBrightness = BrightnessUtils.isValidBrightnessValue(brightnessState)
                || brightnessState == PowerManager.BRIGHTNESS_OFF_FLOAT;
        float newAutoBrightnessAdjustment =
        float newAutoBrightnessAdjustment =
                (mAutomaticBrightnessController != null)
                (mAutomaticBrightnessController != null)
                        ? mAutomaticBrightnessController.getAutomaticScreenBrightnessAdjustment()
                        ? mAutomaticBrightnessController.getAutomaticScreenBrightnessAdjustment()
@@ -345,8 +343,7 @@ public class AutomaticBrightnessStrategy {
    /**
    /**
     * Sets if the auto-brightness is applied on the latest brightness change.
     * Sets if the auto-brightness is applied on the latest brightness change.
     */
     */
    @VisibleForTesting
    public void setAutoBrightnessApplied(boolean autoBrightnessApplied) {
    void setAutoBrightnessApplied(boolean autoBrightnessApplied) {
        mAppliedAutoBrightness = autoBrightnessApplied;
        mAppliedAutoBrightness = autoBrightnessApplied;
    }
    }


+169 −45

File changed.

Preview size limit exceeded, changes collapsed.

Loading