mediaplayer: save thread id in MediaPlayer::reset()
Fix: 63905551
Test: adb shell am instrument -e size small -w 'android.media.cts/android.support.test.runner.AndroidJUnitRunner'
Change-Id: I54f724d2b2e73e2ab08aa7cc07054afe6e0a8092
diff --git a/media/libmedia/mediaplayer.cpp b/media/libmedia/mediaplayer.cpp
index b976721..efe947a 100644
--- a/media/libmedia/mediaplayer.cpp
+++ b/media/libmedia/mediaplayer.cpp
@@ -649,8 +649,12 @@
status_t MediaPlayer::reset()
{
ALOGV("reset");
+ mLockThreadId = getThreadId();
Mutex::Autolock _l(mLock);
- return reset_l();
+ status_t result = reset_l();
+ mLockThreadId = 0;
+
+ return result;
}
status_t MediaPlayer::setAudioStreamType(audio_stream_type_t type)
@@ -860,7 +864,7 @@
// this will deadlock.
//
// The threadId hack below works around this for the care of prepare,
- // seekTo and start within the same process.
+ // seekTo, start, and reset within the same process.
// FIXME: Remember, this is a hack, it's not even a hack that is applied
// consistently for all use-cases, this needs to be revisited.
if (mLockThreadId != getThreadId()) {