Closed elliotn closed 4 years ago
I can reproduce. Wondering if it is related to https://developer.android.com/about/versions/11/privacy/storage
Guaranteed.
I tried playing with/looking into the app yesterday. It has something to do with this:
public class MediaStoreService {
private static final StringTAG = MediaStoreService.class.getSimpleName(); private static final UriALBUM_ART_URI = Uri.parse("content://media/external/audio/albumart");
(You probably know/knew that.)
I did notice that my album art was saved on the sdcard. Whatever is being done to write the file works...
I was going to try and play with:
context.getExternalFilesDir(null)
to see if that helps. (Had to upgrade compileSdk to 30 for the API to be available.) (Honestly, I just haven't touched ContentProviders in years and I'm not sure how the app uses them.)
If you have any pointers in direction, I'm happy to take a look. I like caching my tunes for my bike rides! :)
Regards-
Elliot
On 9/12/20 11:09 AM, Scott Jackson wrote:
I can reproduce. Wondering if it is related to https://developer.android.com/about/versions/11/privacy/storage
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/daneren2005/Subsonic/issues/1002#issuecomment-691518126, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAFGAZO6M6YPQN5BIZW2ZTLSFOTMJANCNFSM4RIRLNWA.
Can also reproduce, Pixel 3.
I imagine anyone using Android 11 is experiencing this
Looking at https://developer.android.com/training/data-storage/use-cases they are pretty explicit about scoped storage not supposed to break old versions that don't target modern versions of Android, so I'm kind of stumped on what is causing this. I am going to keep investigating. If anyone sees anything that might help let me know. I can verify that android:requestLegacyExternalStorage="true"
does NOT fix anything.
Ok so it is definitely a problem with the media store and not scoped storage. It appears that it is failing to grab a URI for the file path we provide, and also it appears that deleting from the media store automatically deletes the file itself instead of just deleting the media store record like it used to, so this is leading into a loop that causes it to be deleted as soon as it is done. I am trying to investigate into why the media store is returning a null for the uri now when it didn't use to:
I am getting something like this in logcat: W/MediaProvider: Requested path /storage/18F2-3A0C/Android/media/github.daneren2005.dsub/music/Binaerpilot/Bend/01-Bend.complete.mp3 doesn't appear under [/storage/emulated/0]
What a joy. Google... I'm trying to call Uri.getContentUri() to see if it helps.
Elliot
On 9/12/20 12:37 PM, Scott Jackson wrote:
Ok so it is definitely a problem with the media store and not scoped storage. It appears that it is failing to grab a URI for the file path we provide, and also it appears that deleting from the media store automatically deletes the file itself instead of just deleting the media store record like it used to, so this is leading into a loop that causes it to be deleted as soon as it is done. I am trying to investigate into why the media store is returning a null for the uri now when it didn't use to:
I am getting something like this in logcat: |W/MediaProvider: Requested path /storage/18F2-3A0C/Android/media/github.daneren2005.dsub/music/Binaerpilot/Bend/01-Bend.complete.mp3 doesn't appear under [/storage/emulated/0]|
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/daneren2005/Subsonic/issues/1002#issuecomment-691528479, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAFGAZIHJMEE2DG7XQ4XZRDSFO5XBANCNFSM4RIRLNWA.
So I can't figure out why I can't insert into the MediaStore, but my latest commit at least fixes it from not being saved to storage. Want to checkout my latest commits and see if you still have any issues and also if you see MediaStoreService: URI for media store is null
in logcat as it downloads files?
Sure.
I'm trying to use this:
private static final UriALBUM_ART_URI = MediaStore.Audio.Media.getContentUri(MediaStore.Audio.AlbumColumns.ALBUM_ART);
Which opens a can of worms:
build.gradle: targetSdk = 30
manifest:
Elliot
On 9/12/20 12:55 PM, Scott Jackson wrote:
So I can't figure out why I can't insert into the MediaStore, but my latest commit at least fixes it from not being saved to storage. Want to checkout my latest commits and see if you still have any issues and also if you see |MediaStoreService: URI for media store is null| in logcat as it downloads files?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/daneren2005/Subsonic/issues/1002#issuecomment-691531031, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAFGAZPPYF7OJORJ7Z2ZZRLSFO73HANCNFSM4RIRLNWA.
Oh well, I think this issue is fixed. Creating new issue for the MediaStore bug.
It's looking good on my end too. Thanks for the fix!
FWIW, the only thing I'm seeing is the same album art error in logcat, but the behavior is fine!
Thanks again!
Elliot
2020-09-12 13:06:49.402 23719-23762/github.daneren2005.dsub W/DownloadFile: Failed to save in media store android.database.sqlite.SQLiteException: table album_art has no column named _id (code 1 SQLITE_ERROR): , while compiling: INSERT INTO album_art (_data,_id) VALUES (?,_GETID( '/storage/emulated/0/Android/media/github.daneren2005.dsub/music/Beatles-1965-Help[2009Remaster]-_NMR/albumart.jpg' )) at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:186) at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:142) at android.content.ContentProviderProxy.insert(ContentProviderNative.java:549) at android.content.ContentResolver.insert(ContentResolver.java:2149) at android.content.ContentResolver.insert(ContentResolver.java:2111) at github.daneren2005.dsub.service.MediaStoreService.insertAlbumArt(MediaStoreService.java:181) at github.daneren2005.dsub.service.MediaStoreService.saveInMediaStore(MediaStoreService.java:85) at github.daneren2005.dsub.service.DownloadFile.saveToStore(DownloadFile.java:365) at github.daneren2005.dsub.service.DownloadFile.access$1400(DownloadFile.java:43) at github.daneren2005.dsub.service.DownloadFile$DownloadTask.doInBackground(DownloadFile.java:504) at github.daneren2005.dsub.service.DownloadFile$DownloadTask.doInBackground(DownloadFile.java:410) at github.daneren2005.dsub.util.BackgroundTask$Task.execute(BackgroundTask.java:208) at github.daneren2005.dsub.util.BackgroundTask$Task.access$300(BackgroundTask.java:194) at github.daneren2005.dsub.util.BackgroundTask$TaskRunnable.run(BackgroundTask.java:319)
On 9/12/20 1:05 PM, Scott Jackson wrote:
Oh well, I think this issue is fixed. Creating new issue for the MediaStore bug.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/daneren2005/Subsonic/issues/1002#issuecomment-691532306, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAFGAZJKTPUUC5PSAJVA25DSFPA7LANCNFSM4RIRLNWA.
My Pixel 3a just upgraded to Android 11, and I can no longer cache music files. The first thing I see in logcat is something about album art and ContentResolver failing. I don't have the logs nearby, but the error is simple enough to recreate.