playback: make state db sync
Add synchronized calls to PlaybackStateDatabase to resolve future race conditions.
This commit is contained in:
@@ -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" />
|
||||
|
||||
Reference in New Issue
Block a user