playback: make state db sync
Add synchronized calls to PlaybackStateDatabase to resolve future race conditions.
This commit is contained in:
parent
d5c0ccfce0
commit
149da883fe
2 changed files with 26 additions and 25 deletions
|
@ -188,6 +188,7 @@ class PlaybackStateDatabase(context: Context) :
|
|||
fun write(state: SavedState) {
|
||||
requireBackgroundThread()
|
||||
|
||||
synchronized(this) {
|
||||
val song = state.queue.getOrNull(state.index)
|
||||
|
||||
if (song != null) {
|
||||
|
@ -216,6 +217,7 @@ class PlaybackStateDatabase(context: Context) :
|
|||
|
||||
logD("Wrote state to database")
|
||||
}
|
||||
}
|
||||
|
||||
private fun writeRawState(rawState: RawState?) {
|
||||
writableDatabase.transaction {
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
app:liftOnScroll="true"
|
||||
app:liftOnScrollTargetViewId="@id/detail_recycler">
|
||||
|
||||
|
||||
<com.google.android.material.appbar.MaterialToolbar
|
||||
android:id="@+id/detail_toolbar"
|
||||
style="@style/Widget.Auxio.Toolbar.Icon.Actions" />
|
||||
|
|
Loading…
Reference in a new issue