Skip to content

fix: pre-generate blur cache to fix first-boot wallpaper issue - #178

Open
mhduiy wants to merge 1 commit into
linuxdeepin:masterfrom
mhduiy:agent/pms-bug-bot/21e5187a97b6
Open

mhduiy wants to merge 1 commit into
linuxdeepin:masterfrom
mhduiy:agent/pms-bug-bot/21e5187a97b6

Conversation

@mhduiy

@mhduiy mhduiy commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

fix: pre-generate blur cache to fix first-boot wallpaper issue

  1. Root cause: wallpaper blur service migrated to dde-services as
    on-demand plugin, D-Bus cold-start delay exceeds greeter 2s timeout
  2. Fix: add systemd preheat service to trigger blur generation before
    display manager starts on first boot, so cache is ready when greeter
    requests it
  3. Impact: only runs on first boot when blur cache dir does not exist,
    subsequent boots skip via ConditionPathExists

Log: Fix first-boot wallpaper blur missing on login screen

Influence:

  1. Test fresh install first boot shows blurred wallpaper on greeter
  2. Test subsequent boots are not delayed by preheat service
  3. Verify preheat service skips when blur cache already exists

fix: 预生成模糊壁纸缓存修复首次启动壁纸无模糊效果

  1. 根因:壁纸模糊服务迁移为 dde-services 按需激活插件后,D-Bus
    冷启动延迟超过 greeter 客户端 2 秒超时
  2. 方案:新增 systemd 预热服务在显示管理器启动前触发默认壁纸
    模糊缓存生成,确保 greeter 请求时缓存已就绪
  3. 影响:仅在首次启动(blur 缓存目录不存在)时执行,后续启动
    通过 ConditionPathExists 跳过

Log: 修复首次启动登录界面壁纸无模糊效果

Influence:

  1. 测试新装系统首次启动登录界面显示模糊壁纸
  2. 测试后续启动不受预热服务影响
  3. 验证缓存已存在时预热服务正确跳过

PMS: BUG-335593

Summary by Sourcery

Pre-generate the default wallpaper blur cache during first boot so the greeter can display the blurred wallpaper without a cold-start timeout.

Bug Fixes:

  • Fix missing blurred wallpaper on the greeter during the first boot by pre-generating the default wallpaper blur cache before the display manager starts.

Enhancements:

  • Skip the preheat operation when the blur cache already exists, avoiding delays on subsequent boots.

Build:

  • Install the wallpaper-cache preheat script and systemd service as part of the wallpapercache plugin.

1. Root cause: wallpaper blur service migrated to dde-services as
   on-demand plugin, D-Bus cold-start delay exceeds greeter 2s timeout
2. Fix: add systemd preheat service to trigger blur generation before
   display manager starts on first boot, so cache is ready when greeter
   requests it
3. Impact: only runs on first boot when blur cache dir does not exist,
   subsequent boots skip via ConditionPathExists

Log: Fix first-boot wallpaper blur missing on login screen

Influence:
1. Test fresh install first boot shows blurred wallpaper on greeter
2. Test subsequent boots are not delayed by preheat service
3. Verify preheat service skips when blur cache already exists

fix: 预生成模糊壁纸缓存修复首次启动壁纸无模糊效果

1. 根因:壁纸模糊服务迁移为 dde-services 按需激活插件后,D-Bus
   冷启动延迟超过 greeter 客户端 2 秒超时
2. 方案:新增 systemd 预热服务在显示管理器启动前触发默认壁纸
   模糊缓存生成,确保 greeter 请求时缓存已就绪
3. 影响:仅在首次启动(blur 缓存目录不存在)时执行,后续启动
   通过 ConditionPathExists 跳过

Log: 修复首次启动登录界面壁纸无模糊效果

Influence:
1. 测试新装系统首次启动登录界面显示模糊壁纸
2. 测试后续启动不受预热服务影响
3. 验证缓存已存在时预热服务正确跳过

PMS: BUG-335593
@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: mhduiy

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@sourcery-ai

sourcery-ai Bot commented Sep 17, 2026

Copy link
Copy Markdown

Reviewer's Guide

The PR installs a boot-time systemd preheat service and helper script that invokes the on-demand wallpaper-cache D-Bus API for the default wallpaper before the display manager starts, avoiding the greeter’s first-boot timeout while remaining non-blocking and automatically skipping once the cache exists.

Sequence diagram for boot-time wallpaper blur preheating

sequenceDiagram
    participant Systemd
    participant Preheat as wallpaper-cache-preheat.sh
    participant ImageEffect as org.deepin.dde.ImageEffect1
    participant Cache
    participant Greeter

    Systemd->>Systemd: ConditionPathExists[blur cache missing]
    Systemd->>Preheat: Start before display manager
    Preheat->>ImageEffect: dbus-send ImageEffect1.Get("", default wallpaper)
    ImageEffect->>Cache: Generate and store blur cache
    ImageEffect-->>Preheat: Get reply
    Systemd->>Greeter: Start display manager and greeter
    Greeter->>ImageEffect: Get("", default wallpaper)
    ImageEffect-->>Greeter: Return cached blur image

    alt Blur cache already exists
        Systemd-->>Preheat: Skip preheat service
        Systemd->>Greeter: Start display manager and greeter
    end
Loading

File-Level Changes

Change Details Files
Add a first-boot systemd preheat path that generates the default wallpaper’s blur cache before the display manager needs it.
  • Install the preheat script and systemd unit as part of the wallpapercache plugin.
  • Trigger D-Bus activation and request blur generation with a 30-second reply timeout.
  • Make the operation non-fatal when the wallpaper is absent or D-Bus/image generation fails.
  • Gate execution on the blur-cache directory’s existence so subsequent boots skip preheating.
src/plugin-qt/wallpapercache/CMakeLists.txt
src/plugin-qt/wallpapercache/misc/dde-wallpaper-cache-preheat.service
src/plugin-qt/wallpapercache/misc/wallpaper-cache-preheat.sh

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 1 issue

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="src/plugin-qt/wallpapercache/CMakeLists.txt" line_range="70" />
<code_context>
 )
+# Pre-generate blur cache for default wallpaper at boot (avoid first-boot cold-start delay)
+install(PROGRAMS ${MISC_DIR}/wallpaper-cache-preheat.sh DESTINATION ${CMAKE_INSTALL_LIBDIR}/deepin-service-manager/)
+install(FILES ${MISC_DIR}/dde-wallpaper-cache-preheat.service DESTINATION lib/systemd/system/)
</code_context>
<issue_to_address>
**issue (bug_risk):** The preheat unit is installed but never enabled or linked into a systemd target, so its `WantedBy=multi-user.target` install hint is not applied and the service does not run on boot. The first-boot blur cache therefore remains cold and the greeter still hits the original D-Bus timeout.

**Triggers:** On installations that do not provide a separate package preset enabling this unit.

**Suggested fix:** Install an explicit symlink into `multi-user.target.wants`, add a package preset, or otherwise enable the unit during installation.

```suggestion
install(FILES ${MISC_DIR}/dde-wallpaper-cache-preheat.service DESTINATION lib/systemd/system/)
install(CODE [[
    file(MAKE_DIRECTORY "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/lib/systemd/system/multi-user.target.wants")
    execute_process(
        COMMAND "${CMAKE_COMMAND}" -E create_symlink
                ../dde-wallpaper-cache-preheat.service
                "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/lib/systemd/system/multi-user.target.wants/dde-wallpaper-cache-preheat.service"
    )
]])
```
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨

)
# Pre-generate blur cache for default wallpaper at boot (avoid first-boot cold-start delay)
install(PROGRAMS ${MISC_DIR}/wallpaper-cache-preheat.sh DESTINATION ${CMAKE_INSTALL_LIBDIR}/deepin-service-manager/)
install(FILES ${MISC_DIR}/dde-wallpaper-cache-preheat.service DESTINATION lib/systemd/system/)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (bug_risk): The preheat unit is installed but never enabled or linked into a systemd target, so its WantedBy=multi-user.target install hint is not applied and the service does not run on boot. The first-boot blur cache therefore remains cold and the greeter still hits the original D-Bus timeout.

Triggers: On installations that do not provide a separate package preset enabling this unit.

Suggested fix: Install an explicit symlink into multi-user.target.wants, add a package preset, or otherwise enable the unit during installation.

Suggested change
install(FILES ${MISC_DIR}/dde-wallpaper-cache-preheat.service DESTINATION lib/systemd/system/)
install(FILES ${MISC_DIR}/dde-wallpaper-cache-preheat.service DESTINATION lib/systemd/system/)
install(CODE [[
file(MAKE_DIRECTORY "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/lib/systemd/system/multi-user.target.wants")
execute_process(
COMMAND "${CMAKE_COMMAND}" -E create_symlink
../dde-wallpaper-cache-preheat.service
"$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/lib/systemd/system/multi-user.target.wants/dde-wallpaper-cache-preheat.service"
)
]])

@deepin-ci-robot

Copy link
Copy Markdown

deepin pr auto review

🤖 AI 代码审查报告

总体评分: 96 分 (通过阈值: 70分)

Pass


📊 总体评价

项目 结果
审查结论 代码审查通过
PR 标题 fix: pre-generate blur cache to fix first-boot wallpaper issue
关联 Bug 335593 - 新安装镜像系统成功重启到登录界面,背景壁纸无蒙层效果
分析模式 全量分析
评分详情 本次提交通过新增 systemd oneshot 服务和 Shell 脚本,在系统启动早期(display-manager 之前)预生成默认壁纸的模糊缓存,有效解决了 Bug 335593 中描述的新安装系统首次启动时登录界面壁纸无蒙层效果的问题。代码逻辑清晰,注释完整,安全无漏洞。存在 2 个代码质量改进建议:安装路径一致性和 systemd 安全加固。

🔍 详细分析

1. 语法逻辑 ✅

评分: 25/25 ✓ 通过

评价: 语法正确,逻辑清晰

潜在问题:
✅ 未发现明显问题

建议:

  1. CMakeLists.txt 中脚本安装路径使用 ${CMAKE_INSTALL_LIBDIR},而 systemd service 文件中 ExecStart 硬编码为 /usr/lib/deepin-service-manager/。建议使用 configure_file() 模板化 service 文件中的安装路径,确保两者一致。

2. 代码质量 ✅

评分: 21/25 ✓ 通过

评价: 代码结构清晰,注释完整

潜在问题:

  1. src/plugin-qt/wallpapercache/CMakeLists.txt 第 68 行:脚本安装路径 ${CMAKE_INSTALL_LIBDIR}/deepin-service-manager/dde-wallpaper-cache-preheat.service 中 ExecStart 硬编码路径 /usr/lib/deepin-service-manager/ 不一致。当 CMAKE_INSTALL_LIBDIR 不为 lib 时(如 lib64lib/x86_64-linux-gnu),服务文件将无法找到脚本。
  2. src/plugin-qt/wallpapercache/misc/dde-wallpaper-cache-preheat.service 第 10 行:systemd service 文件缺少安全加固指令。服务以 root 身份运行但未添加 NoNewPrivilegesProtectSystemPrivateTmp 等加固选项。

建议:

  1. 使用 configure_file() 生成 service 文件,将 ${CMAKE_INSTALL_FULL_LIBDIR} 注入到 ExecStart 路径中,确保安装路径与引用路径一致。
  2. 添加以下加固指令:NoNewPrivileges=true, ProtectSystem=strict, PrivateTmp=true, ReadWritePaths=/var/cache/dde-wallpaper-cache

3. 代码性能 ✅

评分: 20/20 ✓ 通过

评价: 性能良好,资源使用合理

潜在问题:
✅ 未发现明显问题

建议:

  1. ConditionPathExists 双重条件判断设计良好,避免不必要的重复执行。TimeoutStartSec=60dbus-send --reply-timeout=30000 设置合理,能适配慢速硬件的冷启动场景。
  2. Type=oneshotRemainAfterExit=no 确保服务仅执行一次且不留残留进程,资源使用合理。

4. 代码安全 🔒

评分: 30/30 ✓ 通过

🔐 存在 0 个安全漏洞

评价: 存在0个安全漏洞,安全合规

安全漏洞详情:
✅ 未发现安全漏洞

漏洞对比统计: 新增漏洞 0 个,减少漏洞 0 个,持平 0 个

安全分析:

  1. wallpaper-cache-preheat.sh 使用硬编码路径 /usr/share/backgrounds/default_background.jpg,无用户输入,无命令注入风险。
  2. dbus-send 命令使用固定参数,无注入风险。
  3. 输出重定向到 /dev/null 2>&1,防止信息泄露。
  4. 失败处理使用 || trueexit 0,确保非致命,不影响系统启动。
  5. systemd service 使用 ConditionPathExists 进行前置条件检查,避免不必要的执行。

💡 改进建议代码示例

建议 1:使用 configure_file() 模板化 service 文件路径

在 CMakeLists.txt 中添加:

# 使用 configure_file 生成 service 文件,确保路径一致
configure_file(
    ${MISC_DIR}/dde-wallpaper-cache-preheat.service.in
    ${CMAKE_CURRENT_BINARY_DIR}/dde-wallpaper-cache-preheat.service
    @ONLY
)

install(PROGRAMS ${MISC_DIR}/wallpaper-cache-preheat.sh
    DESTINATION ${CMAKE_INSTALL_LIBDIR}/deepin-service-manager/
)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/dde-wallpaper-cache-preheat.service
    DESTINATION lib/systemd/system/
)

对应的 service 模板文件 dde-wallpaper-cache-preheat.service.in

[Unit]
Description=Pre-generate wallpaper blur cache for default wallpaper
Documentation=https://pms.uniontech.com/bug-view-335593.html
After=dbus.service
Before=display-manager.service
ConditionPathExists=/usr/share/backgrounds/default_background.jpg
ConditionPathExists=!/var/cache/dde-wallpaper-cache/blur

[Service]
Type=oneshot
ExecStart=@CMAKE_INSTALL_FULL_LIBDIR@/deepin-service-manager/wallpaper-cache-preheat.sh
TimeoutStartSec=60
RemainAfterExit=no
NoNewPrivileges=true
ProtectSystem=strict
PrivateTmp=true
ReadWritePaths=/var/cache/dde-wallpaper-cache

[Install]
WantedBy=multi-user.target

📋 修改文件清单

文件 类型 说明
src/plugin-qt/wallpapercache/CMakeLists.txt 修改 新增脚本和 service 文件的安装规则
src/plugin-qt/wallpapercache/misc/dde-wallpaper-cache-preheat.service 新增 systemd oneshot 服务,启动早期预生成壁纸模糊缓存
src/plugin-qt/wallpapercache/misc/wallpaper-cache-preheat.sh 新增 Shell 脚本,通过 D-Bus 触发壁纸模糊缓存生成

📈 评分汇总

维度 评分 权重 状态
语法逻辑 25/25 25% ✓ 通过
代码质量 21/25 25% ✓ 通过
代码性能 20/20 20% ✓ 通过
代码安全 30/30 30% ✓ 通过
总分 96/100 100% ✓ 通过

本报告由 AI 代码审查工具自动生成
扫描时间:2026-09-17 21:50:00
平台:GitHub | 项目:linuxdeepin/dde-services | PR: #178

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants