vanilla-music / vanilla

Vanilla Music Player for Android
GNU General Public License v3.0
1.19k stars 296 forks source link

Unable to Dump database #1171

Open SebiderSushi opened 1 year ago

SebiderSushi commented 1 year ago

Description

Settings > Media library > 3-dot Menu > Dump database does not work. Vanilla Music does not report any error either.

Steps to reproduce the issue

  1. Go to Settings > Media library
  2. Open the 3-dot Menu, then click Dump database

    • Vanilla Music displays the usual toast Database dumped to '/storage/emulated/0/dbdump-ch.blinkenlights.android.vanilla.sqlite'
    • The file does not exist
    • System Settings App info for Vanilla Music shows the permission Allow access to media only is granted
    • Vanilla Music is able to access Music files stored on my SD Card in my own custom folders (Outside of Android/media/ch.blinkenlights.android.vanilla or Music/ or any other default storage folder android creates.)
Error message from adb logcat
03-14 02:26:02.006  4365  5398 E MediaProvider: insertFileIfNecessary failed
03-14 02:26:02.006  4365  5398 E MediaProvider: java.lang.IllegalArgumentException: Primary directory null not allowed for content://media/external_primary/file; allowed directories are [Download, Documents]
03-14 02:26:02.006  4365  5398 E MediaProvider:     at com.android.providers.media.MediaProvider.ensureFileColumns(MediaProvider.java:2746)
03-14 02:26:02.006  4365  5398 E MediaProvider:     at com.android.providers.media.MediaProvider.ensureUniqueFileColumns(MediaProvider.java:2411)
03-14 02:26:02.006  4365  5398 E MediaProvider:     at com.android.providers.media.MediaProvider.insertFile(MediaProvider.java:3064)
03-14 02:26:02.006  4365  5398 E MediaProvider:     at com.android.providers.media.MediaProvider.insertInternal(MediaProvider.java:3616)
03-14 02:26:02.006  4365  5398 E MediaProvider:     at com.android.providers.media.MediaProvider.insert(MediaProvider.java:3332)
03-14 02:26:02.006  4365  5398 E MediaProvider:     at com.android.providers.media.MediaProvider.insertFileForFuse(MediaProvider.java:6802)
03-14 02:26:02.006  4365  5398 E MediaProvider:     at com.android.providers.media.MediaProvider.insertFileIfNecessaryForFuse(MediaProvider.java:6889)
03-14 02:26:02.007  5623  5623 V VanillaMusic: Debug dump failed: java.io.FileNotFoundException: /storage/emulated/0/dbdump-ch.blinkenlights.android.vanilla.sqlite: open failed: EPERM (Operation not permitted)
CaptainKarma commented 1 year ago

Apps are not allowed to write to that location anymore, change line 224 in;

app/src/main/java/ch/blinkenlights/android/vanilla/PreferencesMediaLibrary.java

final String path = context.getExternalFilesDir(Environment.DIRECTORY_DOWNLOADS) + "/dbdump-" + context.getPackageName() + ".sqlite";

This then dumps the file to \Phone\Android\data\ch.blinkenlights.android.vanilla\files\Download

Tested and works on my system

pancho-villa commented 3 months ago

@CaptainKarma If this doesn't get merged, is there any way I can get a copy of the sqlite file myself via ADB or something?