music: catch cancellation events during indexing
Catch and propagate cancellation events during indexing. This is just better for debug information.
This commit is contained in:
parent
7cc5c77ad7
commit
4d8c2abd09
2 changed files with 7 additions and 3 deletions
|
@ -23,6 +23,7 @@ import android.content.pm.PackageManager
|
||||||
import android.database.Cursor
|
import android.database.Cursor
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
import androidx.core.content.ContextCompat
|
import androidx.core.content.ContextCompat
|
||||||
|
import kotlinx.coroutines.CancellationException
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.withContext
|
import kotlinx.coroutines.withContext
|
||||||
import org.oxycblt.auxio.BuildConfig
|
import org.oxycblt.auxio.BuildConfig
|
||||||
|
@ -153,8 +154,12 @@ class Indexer {
|
||||||
logE("No music found")
|
logE("No music found")
|
||||||
Response.NoMusic
|
Response.NoMusic
|
||||||
}
|
}
|
||||||
|
} catch (e: CancellationException) {
|
||||||
|
// Got cancelled, propagate upwards
|
||||||
|
logD("Loading routine was cancelled")
|
||||||
|
throw e
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
logE("Music indexing failed.")
|
logE("Music indexing failed")
|
||||||
logE(e.stackTraceToString())
|
logE(e.stackTraceToString())
|
||||||
Response.Err(e)
|
Response.Err(e)
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,8 +64,7 @@ import org.oxycblt.auxio.util.logD
|
||||||
* TODO: Remove the player callback once smooth seeking is implemented
|
* TODO: Remove the player callback once smooth seeking is implemented
|
||||||
*
|
*
|
||||||
* TODO: Rework what is considered to "start foreground" and what is not from the context of this
|
* TODO: Rework what is considered to "start foreground" and what is not from the context of this
|
||||||
* object. This could help reduce the amount of post calls I send on Android 13 onwards,
|
* object. This could help reduce the amount of post calls I send on Android 13 onwards, hopefully.
|
||||||
* hopefully.
|
|
||||||
*/
|
*/
|
||||||
class MediaSessionComponent(
|
class MediaSessionComponent(
|
||||||
private val context: Context,
|
private val context: Context,
|
||||||
|
|
Loading…
Reference in a new issue