Skip to content

feat: Do Not Disturb and Sound mode states, Sound mode trigger in DIY - #1517

Open
jawzf wants to merge 1 commit into
sameerasw:developfrom
jawzf:feat/023-dnd-sound-mode-states
Open

jawzf wants to merge 1 commit into
sameerasw:developfrom
jawzf:feat/023-dnd-sound-mode-states

Conversation

@jawzf

@jawzf jawzf commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Description

Adds new DIY state and trigger options for sound:

  • State "Do Not Disturb": active while DND is on at any level (Priority, Alarms only, Total silence). Switching between levels doesn't exit and re-enter.
  • State "Sound mode": pick Sound, Vibrate or Silent; active while the ringer is in that mode.
  • Trigger "Sound mode changes": fires once when the ringer switches to the chosen mode.

They sit in a new Sound category in the editor. The DND on/off triggers already existed and are unchanged. No new permissions: reading the interruption filter and the ringer mode needs none.

These states also close properly: saving one that's already true runs its entry actions straight away, and disabling or deleting one that's active runs its exit actions once. That logic lives in a small shared helper, StateEntries, which keeps a copy of each automation as it was when it entered, so an edited or deleted automation still runs its own exit actions. It's pure Kotlin and unit tested. Existing states aren't changed in this PR.

How: a new SoundModule listens to RINGER_MODE_CHANGED_ACTION; the DND state uses NotificationModule's existing ACTION_INTERRUPTION_FILTER_CHANGED receiver. Both are push-only, with no polling or timers. The mode sheet reuses SoundModeSettingsSheet (new optional title and showInfo parameters, so existing callers are unchanged), and Action.SoundModeType now carries its icon so it's mapped in one place.

Type of change

  • Bug fix
  • New feature
  • UI / visual update
  • Performance improvement
  • Refactoring / cleanup
  • Translations
  • Build / CI tooling

UI changes

1_sound_category

The state picker with the new Sound category (Do Not Disturb, Sound mode).

2_sound_mode_sheet

Choosing the mode for the Sound mode state.

3_automation_list

The automation list with a DND state, a Vibrate state and a "changes to Silent" trigger.

Checklist

  • The base branch is set to develop (not main).
  • The app builds cleanly locally with ./gradlew assembleDebug.
  • Unit tests pass with ./gradlew testDebugUnitTest.
  • You tested the changes on a device or emulator (including Shizuku or Root if applicable).
  • New preferences use SettingsRepository for keys and getter/setter methods. (No new preferences.)
  • New user-facing settings are registered in FeatureRegistry.kt for search indexing. (No new settings; DIY options aren't indexed.)
  • New UI follows the design system in ui/core/ (RoundedCardContainer, IconToggleItem, etc.).
  • Strings are added to res/values/strings.xml and drawables use rounded variants (R.drawable.rounded_*).

🤖 Generated with Claude Code

… to DIY

States now run their exit actions when disabled or deleted while active,
through a shared StateEntries helper.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

1 participant