There seems to be a race condition when adding an audio media to history
when it starts, in which it doesnt get the right progress, and hence
getting the progress saved when it shouldn't.
To fix this, a new method was added to media on the medialibrary side,
markAsPlayed to increment playcount and add to history but without
having to call savePosition / Time.
When setting a non default locale, the VideoPlayerActivity when in best
fit aspect ratio will not update it's configuration.orientation when
rotating, causing libvlc to assume that the orientation is still the one
used when starting the video. By forcing the orientation to its new
value in onConfigurationChange, this is fixed. Though it doesn't explain
why it has this behaviour in the first place. This is a workaround.
Fixes#2475
After a clearDatabase, the medialibrary was called for a discovery
without using the MediaParsingService, which means no callbacks set
to get progress, and progress couldn't be displayed.
If the path starts with an already known device path, addDeviceIfNeeded
should return without re-adding the path to the medialibrary, but not
kill the service as discovery will still happen afterwards, and with the
service killed there won't be any progress updates.
In some discovery cases, the medialibrary will internally switch
isWorking to false, before enqueuing another operation. This means that
the service, that has a listener on isWorking, will stop itself, and wont
get any updates on the operation that the medialibrary enqueued. To
conter this, a delay is added, afterwhich the isWorking value is checked
again before killing the service. If at that point the medialibrary is
working, then the service wont commit suicide, and the ui can get
progress updates.
Instead of stopping MediaParsingService before clearing the
medialibrary to ensure that there won't be any operations going, this
just checks if the medialibrary is working before clearing the database