Do not stop audio track when the buffer queue is empty.

Stopping audio track is not required as there is automatic underrun
detection in AudioFlinger. When the buffer queue is empty, the audio
track will be underrun. When there is new buffer available, the audio
track will be restarted automatically.

Bug: 154868033
Test: Use OboeTester to play audio via OpenSL ES.
Change-Id: Ia051b6639fac4d4fe7c505cff07676b52b6b4fa7
diff --git a/src/android/AudioPlayer_to_android.cpp b/src/android/AudioPlayer_to_android.cpp
index a324b4a..cd1a36d 100644
--- a/src/android/AudioPlayer_to_android.cpp
+++ b/src/android/AudioPlayer_to_android.cpp
@@ -1318,8 +1318,8 @@
                 }
             }
 
-            // stop the track so it restarts playing faster when new data is enqueued
-            ap->mTrackPlayer->stop();
+            // The track will fall into underrun status when the queue is empty.
+            // The track will be automatically started when the next available buffer is enqueued.
         }
         interface_unlock_exclusive(&ap->mBufferQueue);
 
@@ -2483,16 +2483,6 @@
 
 //-----------------------------------------------------------------------------
 void android_audioPlayer_bufferQueue_onRefilled_l(CAudioPlayer *ap) {
-    // the AudioTrack associated with the AudioPlayer receiving audio from a PCM buffer
-    // queue was stopped when the queue become empty, we restart as soon as a new buffer
-    // has been enqueued since we're in playing state
-    if (ap->mTrackPlayer->mAudioTrack != 0) {
-        ap->mTrackPlayer->reportEvent(android::PLAYER_STATE_STARTED,
-                            ap->mTrackPlayer->mAudioTrack->getRoutedDeviceId());
-        // instead of ap->mTrackPlayer->mAudioTrack->start();
-        ap->mDeferredStart = true;
-    }
-
     // when the queue became empty, an underflow on the prefetch status itf was sent. Now the queue
     // has received new data, signal it has sufficient data
     if (IsInterfaceInitialized(&ap->mObject, MPH_PREFETCHSTATUS)) {