Aperture: Use MediaActionSound.mustPlayShutterSound() on Android T
Change-Id: Ie646282cfdca86f9a0f445ea80a1e5879bb9699f
diff --git a/app/src/main/java/org/lineageos/aperture/utils/CameraSoundsUtils.kt b/app/src/main/java/org/lineageos/aperture/utils/CameraSoundsUtils.kt
index d6d896e..6f9ee7f 100644
--- a/app/src/main/java/org/lineageos/aperture/utils/CameraSoundsUtils.kt
+++ b/app/src/main/java/org/lineageos/aperture/utils/CameraSoundsUtils.kt
@@ -9,6 +9,7 @@
import android.content.res.Resources
import android.content.SharedPreferences
import android.media.MediaActionSound
+import android.os.Build
import org.lineageos.aperture.shutterSound
class CameraSoundsUtils(private val sharedPreferences: SharedPreferences) {
@@ -42,9 +43,13 @@
companion object {
val mustPlaySounds: Boolean
get() {
- val resources = Resources.getSystem()
- val id = resources.getIdentifier("config_camera_sound_forced", "bool", "android")
- return id > 0 && resources.getBoolean(id)
+ return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
+ MediaActionSound.mustPlayShutterSound()
+ } else {
+ val resources = Resources.getSystem()
+ val id = resources.getIdentifier("config_camera_sound_forced", "bool", "android")
+ id > 0 && resources.getBoolean(id)
+ }
}
}
}