Skip to content

fix(android): limit DND channel settings to native devices - #585

Merged
whes1015 merged 1 commit into
mainfrom
fix(android)-handle-OEM-specific-DND-notification-settings
Oct 2, 2026
Merged

whes1015 merged 1 commit into
mainfrom
fix(android)-handle-OEM-specific-DND-notification-settings

Conversation

@lowrt

@lowrt lowrt commented Sep 28, 2026

Copy link
Copy Markdown
Contributor

這個 PR 做了什麼

部分 Android OEM 將「勿擾 / 零打擾」設定放在不同的位置。

目前已確認 Google Pixel、Sony Xperia 會在通知類別的系統設定中提供原生 Android 的「零打擾」選項,因此這些裝置會繼續直接開啟指定的 Notification Channel 設定。

其他尚未確認支援相同設定流程的 OEM,則改為開啟 App 的通知設定,避免將使用者帶到沒有「零打擾」選項的通知類別頁面。

白名單

  • Google Pixel
  • Sony Xperia
  • Motorola

其他裝置
未列入白名單的裝置會 fallback 至 App 通知設定。

這次不針對個別 OEM 寫死特定的私有 Settings Activity,後續可在確認其他品牌的實際設定流程後,再加入白名單。

相關 issue

  • closes #

怎麼驗

檢查清單

  • tool/check/commits.sh origin/main..HEAD 通過
    —— commit 訊息就是更新日誌,格式見 commit.md
  • 一個 commit 一件事(這條 gate 驗不了,靠自己和 review)
  • mise exec -- flutter analyze 與 mise exec -- flutter test 通過
  • 新的使用者可見字串都走 AppLocalizations,沒有寫死
  • 有 UI 變更的話:用的是 AppSpacing / AppRadius / AppMotion,
    深色模式看過,文字對比度可接受

@lowrt lowrt added this to the v26.3 milestone Sep 28, 2026
@github-actions

github-actions Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

🔍 OpenCodeReview found 1 issue(s) in this PR.

  • ✅ Successfully posted inline: 1 comment(s)

Comment thread android/app/src/main/kotlin/com/exptech/dpip/PermissionSettingsChannel.kt Outdated
@codecov

codecov Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 66.28%. Comparing base (e5b8cf2) to head (9c97507).

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

YinCheng0106
YinCheng0106 previously approved these changes Oct 1, 2026
@whes1015
whes1015 force-pushed the fix(android)-handle-OEM-specific-DND-notification-settings branch from bfedf20 to 3eed769 Compare October 1, 2026 19:50
whes1015
whes1015 previously approved these changes Oct 1, 2026
Comment thread android/app/src/main/kotlin/com/exptech/dpip/PermissionSettingsChannel.kt Outdated
@whes1015
whes1015 force-pushed the fix(android)-handle-OEM-specific-DND-notification-settings branch from 3eed769 to e9dd467 Compare October 1, 2026 20:38
@whes1015
whes1015 enabled auto-merge (rebase) October 1, 2026 20:38
Comment thread android/app/src/main/kotlin/com/exptech/dpip/PermissionSettingsChannel.kt Outdated
Comment thread android/app/src/main/kotlin/com/exptech/dpip/PermissionSettingsChannel.kt Outdated
@lowrt
lowrt dismissed stale reviews from whes1015 and YinCheng0106 via a065692 October 2, 2026 00:12
@lowrt
lowrt force-pushed the fix(android)-handle-OEM-specific-DND-notification-settings branch from e9dd467 to a065692 Compare October 2, 2026 00:12
Platform: android

Fix(zh-Hant): 限制零打擾通知類別設定至原生 Android 裝置
Fix(en-US): limit Do Not Disturb channel settings to native Android devices
@lowrt
lowrt force-pushed the fix(android)-handle-OEM-specific-DND-notification-settings branch from a065692 to 9c97507 Compare October 2, 2026 00:13
Comment on lines +79 to +80
private fun usesNativeDndChannelSettings() =
Build.MANUFACTURER.lowercase() in nativeDndChannelSettingsManufacturers

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

performance · low
由于设备的制造商在应用运行期间不会改变,建议将 usesNativeDndChannelSettings 改为 companion object 中的 val 属性,以避免每次调用时都重复执行 Build.MANUFACTURER.lowercase() 操作。

Suggestion:

Suggested change
private fun usesNativeDndChannelSettings() =
Build.MANUFACTURER.lowercase() in nativeDndChannelSettingsManufacturers
// 在 companion object 中定义:
private val usesNativeDndChannelSettings = Build.MANUFACTURER.lowercase() in nativeDndChannelSettingsManufacturers
// 然后在调用处使用:
if (!usesNativeDndChannelSettings) { ... }

@whes1015
whes1015 disabled auto-merge October 2, 2026 22:55
@whes1015
whes1015 merged commit fcd37d2 into main Oct 2, 2026
8 checks passed
@whes1015
whes1015 deleted the fix(android)-handle-OEM-specific-DND-notification-settings branch October 2, 2026 22:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants