fix: stop brightness transition on disable#1115
Merged
Merged
Conversation
1. Cancel any ongoing brightness transition before restoring brightness when auto brightness is stopped. 2. Cancel the active transition immediately when a manual brightness change is detected, both when auto brightness is being disabled and when auto adjustment is only temporarily paused. 3. Add AutoBrightnessManager.cancelOngoingTransition to stop the transition for the built-in monitor through TransitionManager.StopMonitor. 4. Prevent sensor light change handling and compensation ticks from continuing to adjust brightness after auto brightness has been turned off by also checking config.Enabled. 5. Add per-step transition callbacks in the brightness transition layer so brightness properties are updated progressively during the fade, instead of being set to the target value immediately at transition start. 6. Remove the premature property update in setBrightnessWithTransition and wire the transition callback in Manager.initTransitionManager to sync built-in monitor brightness and D-Bus properties on each step. Why: 1. When users turn off auto brightness or manually change brightness, an unfinished fade could continue running and override the user's latest brightness choice. 2. The previous implementation also exposed the target brightness property too early, making reported brightness inconsistent with the actual gradual transition state. 3. These changes make brightness behavior match user intent immediately and keep exported brightness state aligned with real transition progress. Log: Fixed an issue where brightness fading could continue after auto brightness was turned off, and improved real-time brightness state updates during transitions Influence: 1. Enable auto brightness, trigger a brightness transition, then turn off auto brightness and verify the transition stops immediately and brightness is restored without further fading. 2. During an active auto-brightness fade, manually change brightness and verify the ongoing transition is canceled and does not override the manual setting afterward. 3. In manual override mode, confirm no further sensor-driven brightness updates occur while auto brightness is disabled or paused. 4. Observe D-Bus or exposed brightness properties during a transition and verify they change step by step instead of jumping directly to the target value. 5. Test built-in monitor behavior specifically, including repeated enable/disable operations and rapid manual brightness adjustments, to ensure there are no lingering transitions. 6. Verify no regression in normal auto-brightness transitions when the feature remains enabled. fix: 关闭自动亮度时停止亮度渐变 1. 在停止自动亮度并恢复亮度前,先取消当前正在进行的亮度渐变。 2. 在检测到用户手动修改亮度时,立即取消当前渐变;无论是要直接关闭自动亮 度,还是仅临时暂停自动调节,都执行该处理。 3. 新增 AutoBrightnessManager.cancelOngoingTransition,通过 TransitionManager.StopMonitor 停止内置显示器上的渐变任务。 4. 在环境光变化处理和补偿定时任务中增加 config.Enabled 判断,避免自动亮 度关闭后仍继续调节亮度。 5. 在亮度渐变层增加逐步回调能力,使亮度属性在渐变过程中按步骤同步更新, 而不是在渐变开始时直接设置为目标值。 6. 移除 setBrightnessWithTransition 中过早设置亮度属性的逻辑,并在 Manager.initTransitionManager 中接入渐变回调,在每一步同步内置显示器亮度 和 D-Bus 属性。 Why: 1. 当用户关闭自动亮度或手动修改亮度时,未完成的渐变可能继续执行,并覆盖 用户最新设置的亮度。 2. 旧实现会过早暴露目标亮度属性,导致对外报告的亮度状态与实际渐变中的亮 度不一致。 3. 这些修改让亮度行为能够立即响应用户意图,并确保导出的亮度状态与真实渐 变进度保持一致。 Log: 修复关闭自动亮度后亮度渐变仍继续的问题,并改进渐变过程中的亮度状态 实时更新 Influence: 1. 开启自动亮度并触发一次亮度渐变,然后关闭自动亮度,验证渐变会立即停 止,亮度恢复后不会继续渐变。 2. 在自动亮度渐变进行中手动修改亮度,验证正在进行的渐变被取消,之后不会 再覆盖手动设置的亮度。 3. 在手动接管期间,确认自动亮度被关闭或暂停后,不会再收到传感器驱动的亮 度更新。 4. 在渐变过程中观察 D-Bus 或对外暴露的亮度属性,验证其会随每一步渐变逐步 变化,而不是直接跳到目标值。 5. 重点测试内置显示器场景,包括反复开关自动亮度和快速连续手动调节亮度, 确保不会残留未停止的渐变任务。 6. 验证自动亮度保持开启时,正常的亮度渐变流程没有回归问题。 PMS: BUG-358023 Change-Id: I27e29c376de575668e364e9612937c86cec41722
deepin pr auto review这份代码变更主要解决了自动亮度调节过程中的两个核心问题:
整体来看,代码逻辑清晰,修改合理。但经过仔细审查,在并发安全、逻辑严谨性、性能和安全性方面还有一些可以改进和优化的空间。以下是详细的审查意见: 一、 逻辑与语法改进1.
|
mhduiy
approved these changes
May 20, 2026
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: fly602, mhduiy The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why:
Log: Fixed an issue where brightness fading could continue after auto brightness was turned off, and improved real-time brightness state updates during transitions
Influence:
fix: 关闭自动亮度时停止亮度渐变
Why:
Log: 修复关闭自动亮度后亮度渐变仍继续的问题,并改进渐变过程中的亮度状态
实时更新
Influence:
PMS: BUG-358023
Change-Id: I27e29c376de575668e364e9612937c86cec41722