SDL: androidaudio: same fix as AAudio for pausing thread when backgrounding app.

From 1e13aa2c98b7740c4747af6651df24e977c97e7f Mon Sep 17 00:00:00 2001
From: "Ryan C. Gordon" <[EMAIL REDACTED]>
Date: Fri, 19 Jan 2024 22:15:27 -0500
Subject: [PATCH] androidaudio: same fix as AAudio for pausing thread when
 backgrounding app.

Reference Issue #8748.
---
 src/audio/android/SDL_androidaudio.c | 36 ++++------------------------
 src/audio/android/SDL_androidaudio.h |  3 +--
 2 files changed, 5 insertions(+), 34 deletions(-)

diff --git a/src/audio/android/SDL_androidaudio.c b/src/audio/android/SDL_androidaudio.c
index fa37bd913af1..817368680974 100644
--- a/src/audio/android/SDL_androidaudio.c
+++ b/src/audio/android/SDL_androidaudio.c
@@ -148,29 +148,12 @@ AudioBootStrap ANDROIDAUDIO_bootstrap = {
 void ANDROIDAUDIO_PauseDevices(void)
 {
     /* TODO: Handle multiple devices? */
-    struct SDL_PrivateAudioData *private;
     if (audioDevice && audioDevice->hidden) {
-        private = (struct SDL_PrivateAudioData *)audioDevice->hidden;
-        if (SDL_AtomicGet(&audioDevice->paused)) {
-            /* The device is already paused, leave it alone */
-            private->resume = SDL_FALSE;
-        } else {
-            SDL_LockMutex(audioDevice->mixer_lock);
-            SDL_AtomicSet(&audioDevice->paused, 1);
-            private->resume = SDL_TRUE;
-        }
+        SDL_LockMutex(audioDevice->mixer_lock);
     }
 
     if (captureDevice && captureDevice->hidden) {
-        private = (struct SDL_PrivateAudioData *)captureDevice->hidden;
-        if (SDL_AtomicGet(&captureDevice->paused)) {
-            /* The device is already paused, leave it alone */
-            private->resume = SDL_FALSE;
-        } else {
-            SDL_LockMutex(captureDevice->mixer_lock);
-            SDL_AtomicSet(&captureDevice->paused, 1);
-            private->resume = SDL_TRUE;
-        }
+        SDL_LockMutex(captureDevice->mixer_lock);
     }
 }
 
@@ -178,23 +161,12 @@ void ANDROIDAUDIO_PauseDevices(void)
 void ANDROIDAUDIO_ResumeDevices(void)
 {
     /* TODO: Handle multiple devices? */
-    struct SDL_PrivateAudioData *private;
     if (audioDevice && audioDevice->hidden) {
-        private = (struct SDL_PrivateAudioData *)audioDevice->hidden;
-        if (private->resume) {
-            SDL_AtomicSet(&audioDevice->paused, 0);
-            private->resume = SDL_FALSE;
-            SDL_UnlockMutex(audioDevice->mixer_lock);
-        }
+        SDL_UnlockMutex(audioDevice->mixer_lock);
     }
 
     if (captureDevice && captureDevice->hidden) {
-        private = (struct SDL_PrivateAudioData *)captureDevice->hidden;
-        if (private->resume) {
-            SDL_AtomicSet(&captureDevice->paused, 0);
-            private->resume = SDL_FALSE;
-            SDL_UnlockMutex(captureDevice->mixer_lock);
-        }
+        SDL_UnlockMutex(captureDevice->mixer_lock);
     }
 }
 
diff --git a/src/audio/android/SDL_androidaudio.h b/src/audio/android/SDL_androidaudio.h
index b28d6f346fb6..4e9df10f10e1 100644
--- a/src/audio/android/SDL_androidaudio.h
+++ b/src/audio/android/SDL_androidaudio.h
@@ -30,8 +30,7 @@
 
 struct SDL_PrivateAudioData
 {
-    /* Resume device if it was paused automatically */
-    int resume;
+    int unused;
 };
 
 void ANDROIDAUDIO_ResumeDevices(void);