Revert "tracks: Check track states before transitioning states"
This does not fix the race condition problem
CYNGNOS-2775 FEIJ-1227
This reverts commit 0445f98ed0ba3c3fe682eb617660ae5d385a0216.
Change-Id: I8c4f5fb7f064286b6895e084ec726bcbfcce0484
diff --git a/src/com/android/fmradio/FmService.java b/src/com/android/fmradio/FmService.java
index 973dceb..b3d7715 100644
--- a/src/com/android/fmradio/FmService.java
+++ b/src/com/android/fmradio/FmService.java
@@ -396,7 +396,7 @@
mAudioRecord.release();
mAudioRecord = null;
}
- if (mAudioTrack != null && mAudioTrack.getState() == AudioTrack.STATE_INITIALIZED) {
+ if (mAudioTrack != null) {
mAudioTrack.stop();
mAudioTrack.release();
mAudioTrack = null;
@@ -448,8 +448,7 @@
}
private void startAudioTrack() {
- if (mAudioTrack.getState() == AudioTrack.STATE_INITIALIZED
- && mAudioTrack.getPlayState() == AudioTrack.PLAYSTATE_STOPPED) {
+ if (mAudioTrack.getPlayState() == AudioTrack.PLAYSTATE_STOPPED) {
ArrayList<AudioPatch> patches = new ArrayList<AudioPatch>();
mAudioManager.listAudioPatches(patches);
mAudioTrack.play();
@@ -478,13 +477,11 @@
// Speaker mode or BT a2dp mode will come here and keep reading and writing.
// If we want FM sound output from speaker or BT a2dp, we must record data
// to AudioRecrd and write data to AudioTrack.
- if (mAudioRecord.getRecordingState() == AudioRecord.RECORDSTATE_STOPPED
- && mAudioRecord.getState() == AudioRecord.STATE_INITIALIZED) {
+ if (mAudioRecord.getRecordingState() == AudioRecord.RECORDSTATE_STOPPED) {
mAudioRecord.startRecording();
}
- if (mAudioTrack.getPlayState() == AudioTrack.PLAYSTATE_STOPPED
- && mAudioTrack.getState() == AudioTrack.STATE_INITIALIZED) {
+ if (mAudioTrack.getPlayState() == AudioTrack.PLAYSTATE_STOPPED) {
mAudioTrack.play();
}
int size = mAudioRecord.read(buffer, 0, RECORD_BUF_SIZE);