From 573f6b897e7e247a8f15f7d32b904060188dda18 Mon Sep 17 00:00:00 2001 From: Alex Baker Date: Wed, 23 Aug 2023 12:12:38 -0500 Subject: [PATCH] Set audio attributes on completion sound --- .../com/todoroo/astrid/service/TaskCompleter.kt | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/todoroo/astrid/service/TaskCompleter.kt b/app/src/main/java/com/todoroo/astrid/service/TaskCompleter.kt index 4a0442eb4..c4063bc67 100644 --- a/app/src/main/java/com/todoroo/astrid/service/TaskCompleter.kt +++ b/app/src/main/java/com/todoroo/astrid/service/TaskCompleter.kt @@ -3,6 +3,8 @@ package com.todoroo.astrid.service import android.app.NotificationManager import android.app.NotificationManager.INTERRUPTION_FILTER_ALL import android.content.Context +import android.media.AudioAttributes +import android.media.AudioAttributes.USAGE_NOTIFICATION_EVENT import android.media.RingtoneManager import com.todoroo.andlib.utility.DateUtilities import com.todoroo.astrid.dao.TaskDao @@ -72,7 +74,16 @@ class TaskCompleter @Inject internal constructor( preferences .completionSound ?.takeUnless { preferences.isCurrentlyQuietHours } - ?.let { RingtoneManager.getRingtone(context, it).play() } + ?.let { + RingtoneManager + .getRingtone(context, it) + .apply { + audioAttributes = AudioAttributes.Builder() + .setUsage(USAGE_NOTIFICATION_EVENT) + .build() + } + .play() + } } } } \ No newline at end of file