From 13f55893456f9435238a36f8dec7d344fd97dde6 Mon Sep 17 00:00:00 2001 From: chriss158 Date: Sun, 28 Jun 2026 18:07:58 +0000 Subject: [PATCH 1/4] Document Android 17 restrictions on ringer mode commands Added caution regarding Android 17's Background Audio Hardening affecting notification commands for ringer mode changes. --- docs/notifications/commands.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/docs/notifications/commands.md b/docs/notifications/commands.md index 8d4aa6823b2..92e54f1a4c0 100644 --- a/docs/notifications/commands.md +++ b/docs/notifications/commands.md @@ -678,6 +678,24 @@ While it is possible to create an automation in Home Assistant to call this acti On Android you can control the device\'s ringer mode by sending `message: command_ringer_mode` with an appropriate `command` as outlined in the table below. Certain devices will need to grant a special permission that will appear upon the first command received if the permission was not already granted. This is the same permission as [Do Not Disturb](#do-not-disturb) up above. If the device has Do Not Disturb enabled then setting to `normal` or `vibrate` will turn it off. If the device does not have Do Not Disturb enabled then `silent` will turn it on.
+:::caution +### Android 17 and Background Audio Hardening + +Starting with Android 17, Android may block notification commands that change the ringer mode when they are executed in the background. This is caused by Android's **Background Audio Hardening**, which restricts background audio interactions, including volume and ringer mode changes, unless they are started from a visible app or an eligible foreground service. + +See the official Android documentation: https://developer.android.com/about/versions/17/changes/bg-audio + +If ringer mode commands no longer work on Android 17, you can temporarily disable this system hardening with ADB: + +```bash adb shell cmd audio set-hardening 0 ``` + +To re-enable it: + +```bash adb shell cmd audio set-hardening 1 ``` + +Disabling this protection is a system-wide developer workaround and is not recommended for normal use. It may allow apps to change audio behavior from the background without clear user interaction, which can lead to unexpected ringer, volume, or audio playback changes. +::: + | `command` | Description | | ------- | ----------- | | `normal` | Set the device to normal ringer mode, will turn off Do Not Disturb if enabled and supported. | From bbc80bab7f7cd021b9965d32101fcefc00d9fde0 Mon Sep 17 00:00:00 2001 From: chriss158 Date: Sun, 28 Jun 2026 18:13:29 +0000 Subject: [PATCH 2/4] Enhance Android 17 background audio caution --- docs/notifications/commands.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/docs/notifications/commands.md b/docs/notifications/commands.md index 92e54f1a4c0..1747e7ed055 100644 --- a/docs/notifications/commands.md +++ b/docs/notifications/commands.md @@ -679,19 +679,17 @@ While it is possible to create an automation in Home Assistant to call this acti On Android you can control the device\'s ringer mode by sending `message: command_ringer_mode` with an appropriate `command` as outlined in the table below. Certain devices will need to grant a special permission that will appear upon the first command received if the permission was not already granted. This is the same permission as [Do Not Disturb](#do-not-disturb) up above. If the device has Do Not Disturb enabled then setting to `normal` or `vibrate` will turn it off. If the device does not have Do Not Disturb enabled then `silent` will turn it on.
:::caution -### Android 17 and Background Audio Hardening - Starting with Android 17, Android may block notification commands that change the ringer mode when they are executed in the background. This is caused by Android's **Background Audio Hardening**, which restricts background audio interactions, including volume and ringer mode changes, unless they are started from a visible app or an eligible foreground service. See the official Android documentation: https://developer.android.com/about/versions/17/changes/bg-audio If ringer mode commands no longer work on Android 17, you can temporarily disable this system hardening with ADB: -```bash adb shell cmd audio set-hardening 0 ``` +```bash adb shell cmd audio set-hardening 0``` To re-enable it: -```bash adb shell cmd audio set-hardening 1 ``` +```bash adb shell cmd audio set-hardening 1``` Disabling this protection is a system-wide developer workaround and is not recommended for normal use. It may allow apps to change audio behavior from the background without clear user interaction, which can lead to unexpected ringer, volume, or audio playback changes. ::: From 7e9a4735da7b970233e3476b0ee977565e2af537 Mon Sep 17 00:00:00 2001 From: chriss158 Date: Sun, 28 Jun 2026 18:56:18 +0000 Subject: [PATCH 3/4] Clarify Android 17 restrictions on ringer mode commands and update caution note --- docs/notifications/commands.md | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/docs/notifications/commands.md b/docs/notifications/commands.md index 1747e7ed055..2c57a3276b6 100644 --- a/docs/notifications/commands.md +++ b/docs/notifications/commands.md @@ -679,17 +679,15 @@ While it is possible to create an automation in Home Assistant to call this acti On Android you can control the device\'s ringer mode by sending `message: command_ringer_mode` with an appropriate `command` as outlined in the table below. Certain devices will need to grant a special permission that will appear upon the first command received if the permission was not already granted. This is the same permission as [Do Not Disturb](#do-not-disturb) up above. If the device has Do Not Disturb enabled then setting to `normal` or `vibrate` will turn it off. If the device does not have Do Not Disturb enabled then `silent` will turn it on.
:::caution -Starting with Android 17, Android may block notification commands that change the ringer mode when they are executed in the background. This is caused by Android's **Background Audio Hardening**, which restricts background audio interactions, including volume and ringer mode changes, unless they are started from a visible app or an eligible foreground service. - -See the official Android documentation: https://developer.android.com/about/versions/17/changes/bg-audio +Starting with Android 17, Android may block notification commands that change the ringer mode when they are executed in the background. This is caused by Android's [**Background Audio Hardening**](https://developer.android.com/about/versions/17/changes/bg-audio), which restricts background audio interactions, including volume and ringer mode changes, unless they are started from a visible app or an eligible foreground service. If ringer mode commands no longer work on Android 17, you can temporarily disable this system hardening with ADB: -```bash adb shell cmd audio set-hardening 0``` +```adb shell cmd audio set-hardening 0``` To re-enable it: -```bash adb shell cmd audio set-hardening 1``` +```adb shell cmd audio set-hardening 1``` Disabling this protection is a system-wide developer workaround and is not recommended for normal use. It may allow apps to change audio behavior from the background without clear user interaction, which can lead to unexpected ringer, volume, or audio playback changes. ::: From 3449ba50026836cf254bec86d74a2e12b6f6d0e1 Mon Sep 17 00:00:00 2001 From: chriss158 Date: Wed, 1 Jul 2026 16:39:24 +0000 Subject: [PATCH 4/4] Add note about ADB command persistence for audio behavior changes --- docs/notifications/commands.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/notifications/commands.md b/docs/notifications/commands.md index 2c57a3276b6..c672bb20b1b 100644 --- a/docs/notifications/commands.md +++ b/docs/notifications/commands.md @@ -690,6 +690,8 @@ To re-enable it: ```adb shell cmd audio set-hardening 1``` Disabling this protection is a system-wide developer workaround and is not recommended for normal use. It may allow apps to change audio behavior from the background without clear user interaction, which can lead to unexpected ringer, volume, or audio playback changes. + +Note that this ADB command does not persist across device restarts. You must run it again after each reboot. ::: | `command` | Description |