fix: support ambient light automatic brightness - #122
Conversation
Reviewer's GuideIntroduce a new ambient-brightness plugin that exposes org.deepin.dde.AmbientBrightness1 on D-Bus, implements a configurable continuous ambient light policy backed by iio-sensor-proxy with lifecycle management (lid/sleep/session), adds unit tests and CMake wiring, and removes legacy power config toggles for ambient-light from shortcut and power manager paths so manual brightness changes no longer forcibly disable auto brightness. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
/test all |
deepin pr auto review★ 总体评分:90分■ 【总体评价】
■ 【详细分析】
■ 【改进建议代码示例】 // ambientbrightnessservice.cpp
void AmbientBrightnessService::stopSensorAndDisableModel()
{
stopInitialSampleWait();
if (m_evaluationTimer)
m_evaluationTimer->stop();
if (m_sensor && m_claimed)
m_sensor->call(QStringLiteral("ReleaseLight"));
m_claimed = false;
m_haveSample = false;
m_model.setDisabled();
}
void AmbientBrightnessService::onAutomaticBrightnessEnabledChanged(bool enabled)
{
if (m_lifecycle.enabled == enabled)
return;
qCDebug(logAmbientBrightness) << "configured enabled=" << enabled;
m_lifecycle.enabled = enabled;
Q_EMIT enabledChanged(enabled);
publishPropertyChange(QStringLiteral("Enabled"), enabled);
if (!enabled) {
stopSensorAndDisableModel();
} else {
refreshSensorConnection();
}
}
void AmbientBrightnessService::Enable(bool active)
{
qCDebug(logAmbientBrightness) << "enable requested=" << active;
m_lifecycle.enabled = active;
Q_EMIT enabledChanged(active);
publishPropertyChange(QStringLiteral("Enabled"), active);
if (m_config && m_config->isValid())
m_config->setValue(QString::fromLatin1(kAmbientLightAdjustBrightnessKey), active);
if (!active) {
stopSensorAndDisableModel();
} else {
refreshSensorConnection();
}
} |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: fly602, robertkill 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 |
1. Add an ambient brightness service backed by iio-sensor-proxy 2. Convert lux samples into stable brightness recommendations with filtering, hysteresis, and debounce 3. Coordinate sensor lifecycle with lid, sleep, session, service, and configuration state Influence: 1. Publish automatic brightness state and recommendations through org.deepin.dde.AmbientBrightness1 2. Prevent power-saving and manual brightness paths from conflicting with ambient brightness 3. Verify sensor lifecycle and brightness policy with unit tests fix: 支持环境光自动亮度调节 1. 新增基于iio-sensor-proxy的环境光亮度服务 2. 通过滤波、滞回和防抖将lux样本转换为稳定的亮度推荐值 3. 根据合盖、休眠、会话、传感器服务及配置状态管理光感生命周期 Influence: 1. 通过org.deepin.dde.AmbientBrightness1发布自动亮度状态及推荐值 2. 避免省电及手动亮度调节路径与环境光自动亮度冲突 3. 通过单元测试验证光感生命周期及亮度策略 PMS: BUG-372191
Influence:
fix: 支持环境光自动亮度调节
Influence:
PMS: BUG-372191
Summary by Sourcery
Introduce a DDE ambient brightness plugin that provides automatic brightness recommendations based on ambient light while decoupling it from power settings and integrating tests and build wiring.
New Features:
Bug Fixes:
Enhancements:
Build:
Tests: