chr56 / Phonograph_Plus

A fork of kabouzeid/Phonograph in maintenance and development
GNU General Public License v3.0
348 stars 19 forks source link

[Bug] Unable to Import Preferences Backups #79

Open moriel5 opened 1 year ago

moriel5 commented 1 year ago

Device: Razer Phone 2 OS: Stock Android 9 (99% AOSP) Version(s) Affected: 0.6.1, 0.6.2-dev1

It would appear as though Phonograph is unable to import it's own backups via the Android file picker API, at least on Android 9.

Atempting to export the database results in errors regarding song_play_count.db, history.db, and favorite.db, but otherwise succeeds without them (this also happens with 3rd party file pickers).

Atempting to export the preferences JSON succeeds without any issues whatsoever.

Atempting to import the the database, however considering that the only files to be imported were blacklist.db and music_playback_state.db with a clean install, there wasn't really any changes.

Atempting to import the settings JSON... gets nowhere, since the file is greyed out in the file picker.

Choosing the file via a 3rd party file picker, such as MiXplorer, let's me choose the file without issues, however not all settings are applied (such as the theme).

chr56 commented 1 year ago
  1. Exported settings from old versions can not be imported in newer version.
  2. Database can not be transported across different devices.
  3. Currently, only jsons ( mime type application/json) can be selected. If system filepicker (Storage Access Framework) can not select them (grey-ed), I have no idea about this. This is the fault of your system.
  4. I need the detailed error report about how databases exporting failed.
  5. The theme setting is not included in setting backups.
moriel5 commented 1 year ago
  1. I tested exporting and then importing (after clearing app data) within the same version. I had simply tested this on both of the versions mentioned.

  2. The same device with the same OS was used, this was a controlled test that only lasted a few moments.

  3. That is certainly possible, however Razer has made no changes to the file picker and it's API beyond the app icon, so I am guessing that this will also affect any device running AOSP 9.

  4. I'll do that a bit later, once I'll have time.

  5. Thanks, that would certainly explain things (and I would have taken a look at the contents of the JSON, that would have saved some time).

Thank you very much for answering, I'll make sure to return with the necessary reports later, when I have the time to run the tests again.

chr56 commented 1 year ago

1.Sorry, I forget mentioning that, in most cases, you must reboot the application after importing (you'd better kill the app). 2.I would allow selecting any file types soon, if so. 3.I am not satisfied about current backup system. I am planning to remake them. So, save your time, do not spend too much on "giving me feedback on current one"

moriel5 commented 1 year ago

@chr56 No problem, while I did close and reopen the app, I did not try to kill it, and since I am currently still testing Phonograph Plus, so I can wait for a proper backups system to be first implemented, and since the JSON can be imported via 3rd party file pickers, I believe this can rest for the time being.

chr56 commented 1 year ago

Looks almost done!

This is a preview. New Backup System is introduced now.

If you are available, welcome to help me test it and give me suggestions or feedback.

File: PhonographPlus_0.6.2-dev-preview-d6d846e93.zip

moriel5 commented 1 year ago

Thanks, I'll make sure to test it out later, once I finish with chores here.

The changelog certainly looks good.

moriel5 commented 1 year ago

Backing up the database still results in the same results, with the same errors.

Here they are:

Internal Error:

Package name:    player.phonograph.plus.preview
App version:     0.6.2-dev1 (511)
Git Commit Hash: d6d846e935e285942628
Android version: 9 (SDK 28)
Device brand:    razer  (by Razer)
Device model:    Phone 2 (code: aura)
Product name:    cheryl2
Build version:   P-SMR3-RC002-RZR-200226.3141 
                 (3141)
Hardware:        qcom
Language:        en

File song_play_count.db is not a file
java.lang.IllegalStateException
    at ec.a.addToZipFile(SourceFile:67)
    at a0.w.C(Unknown Source:45)
    at a0.w.B(Unknown Source:29)
    at player.phonograph.ui.activities.t0.invokeSuspend(SourceFile:40)
    at h6.a.resumeWith(Unknown Source:8)
    at y6.o0.run(Unknown Source:102)
    at kotlinx.coroutines.internal.i.run(Unknown Source:12)
    at kotlinx.coroutines.scheduling.j.run(Unknown Source:2)
    at kotlinx.coroutines.scheduling.a$a.run(SourceFile:63)
}
 Internal Error:

Package name:    player.phonograph.plus.preview
App version:     0.6.2-dev1 (511)
Git Commit Hash: d6d846e935e285942628
Android version: 9 (SDK 28)
Device brand:    razer  (by Razer)
Device model:    Phone 2 (code: aura)
Product name:    cheryl2
Build version:   P-SMR3-RC002-RZR-200226.3141 
                 (3141)
Hardware:        qcom
Language:        en

File song_play_count.db is not a file
java.lang.IllegalStateException
    at ec.a.addToZipFile(SourceFile:67)
    at a0.w.C(Unknown Source:45)
    at a0.w.B(Unknown Source:29)
    at player.phonograph.ui.activities.t0.invokeSuspend(SourceFile:40)
    at h6.a.resumeWith(Unknown Source:8)
    at y6.o0.run(Unknown Source:102)
    at kotlinx.coroutines.internal.i.run(Unknown Source:12)
    at kotlinx.coroutines.scheduling.j.run(Unknown Source:2)
    at kotlinx.coroutines.scheduling.a$a.run(SourceFile:63)
}
Internal Error:

Package name:    player.phonograph.plus.preview
App version:     0.6.2-dev1 (511)
Git Commit Hash: d6d846e935e285942628
Android version: 9 (SDK 28)
Device brand:    razer  (by Razer)
Device model:    Phone 2 (code: aura)
Product name:    cheryl2
Build version:   P-SMR3-RC002-RZR-200226.3141 
                 (3141)
Hardware:        qcom
Language:        en

File song_play_count.db is not a file
java.lang.IllegalStateException
    at ec.a.addToZipFile(SourceFile:67)
    at a0.w.C(Unknown Source:45)
    at a0.w.B(Unknown Source:29)
    at player.phonograph.ui.activities.t0.invokeSuspend(SourceFile:40)
    at h6.a.resumeWith(Unknown Source:8)
    at y6.o0.run(Unknown Source:102)
    at kotlinx.coroutines.internal.i.run(Unknown Source:12)
    at kotlinx.coroutines.scheduling.j.run(Unknown Source:2)
    at kotlinx.coroutines.scheduling.a$a.run(SourceFile:63)
}

I shall now commence to exporting up just the settings, and attempting to import the exported files.

moriel5 commented 1 year ago

As expected, attempting to importing the database results in the following error:

Crash Report:

Package name:    player.phonograph.plus.preview
App version:     0.6.2-dev1 (511)
Git Commit Hash: d6d846e935e285942628
Android version: 9 (SDK 28)
Device brand:    razer  (by Razer)
Device model:    Phone 2 (code: aura)
Product name:    cheryl2
Build version:   P-SMR3-RC002-RZR-200226.3141 
                 (3141)
Hardware:        qcom
Language:        en

java.lang.IllegalArgumentException: /data/user/0/player.phonograph.plus.preview/cache/favorite.db doesn't exits!
 at zb.b.d(SourceFile:125)
 at a0.w.N(SourceFile:78)
 at a0.w.O(Unknown Source:33)
 at player.phonograph.ui.activities.x0.invokeSuspend(SourceFile:40)
 at h6.a.resumeWith(Unknown Source:8)
 at y6.o0.run(Unknown Source:102)
 at kotlinx.coroutines.internal.i.run(Unknown Source:12)
 at kotlinx.coroutines.scheduling.j.run(Unknown Source:2)
 at kotlinx.coroutines.scheduling.a$a.run(SourceFile:63)
 Suppressed: y6.m0: [y1{Cancelling}@2d68dd7, Dispatchers.IO]
moriel5 commented 1 year ago

Attempting to export the backup failed, and provided me with the following error:

Internal Error:

Package name:    player.phonograph.plus.preview
App version:     0.6.2-dev1 (511)
Git Commit Hash: d6d846e935e285942628
Android version: 9 (SDK 28)
Device brand:    razer  (by Razer)
Device model:    Phone 2 (code: aura)
Product name:    cheryl2
Build version:   P-SMR3-RC002-RZR-200226.3141 
                 (3141)
Hardware:        qcom
Language:        en

failed!
java.io.FileNotFoundException: /data/user/0/player.phonograph.plus.preview/databases/history.db (No such file or directory)
    at java.io.FileInputStream.open0(Native Method)
    at java.io.FileInputStream.open(FileInputStream.java:231)
    at java.io.FileInputStream.<init>(FileInputStream.java:165)
    at l6.c.a(SourceFile:3)
    at za.h.invoke(SourceFile:25)
    at za.k.a(Unknown Source:5)
    at za.i.a(Unknown Source:10)
    at za.a$a.a(SourceFile:90)
    at ub.r.invokeSuspend(SourceFile:54)
    at h6.a.resumeWith(Unknown Source:8)
    at y6.o0.run(Unknown Source:102)
    at kotlinx.coroutines.internal.i.run(Unknown Source:12)
    at kotlinx.coroutines.scheduling.j.run(Unknown Source:2)
    at kotlinx.coroutines.scheduling.a$a.run(SourceFile:63)
}
moriel5 commented 1 year ago

Exporting just the music playback state in the backup succeeded without any issues, and this includes the manifest.

Update: Including the settings as well also succeeded, which means that the issue did not like with multiple files in the archive. I shall now attempt to import the exported backup at startup, after clearing app storage data.

Update 2: The import including both the playback state and the settings succeeded, albeit with the expected caveat (theme settings were not backed up), and fit some odd reason it appeared to never finish, however closing the app (without force close) and reopening showed the backed up settings in use.

Update 3: It seems that "database_history"and "database_song_play_count" are responsible for the failures, prompting the previous history.db error, unless I uncheck "database_history"in which case I presented with the following error:

Internal Error:

Package name:    player.phonograph.plus.preview
App version:     0.6.2-dev1 (511)
Git Commit Hash: d6d846e935e285942628
Android version: 9 (SDK 28)
Device brand:    razer  (by Razer)
Device model:    Phone 2 (code: aura)
Product name:    cheryl2
Build version:   P-SMR3-RC002-RZR-200226.3141 
                 (3141)
Hardware:        qcom
Language:        en

failed!
java.io.FileNotFoundException: /data/user/0/player.phonograph.plus.preview/databases/song_play_count.db (No such file or directory)
    at java.io.FileInputStream.open0(Native Method)
    at java.io.FileInputStream.open(FileInputStream.java:231)
    at java.io.FileInputStream.<init>(FileInputStream.java:165)
    at l6.c.a(SourceFile:3)
    at za.v.invoke(SourceFile:25)
    at za.k.a(Unknown Source:5)
    at za.w.a(Unknown Source:10)
    at za.a$a.a(SourceFile:90)
    at ub.r.invokeSuspend(SourceFile:54)
    at h6.a.resumeWith(Unknown Source:8)
    at y6.o0.run(Unknown Source:102)
    at kotlinx.coroutines.internal.i.run(Unknown Source:12)
    at kotlinx.coroutines.scheduling.j.run(Unknown Source:2)
    at kotlinx.coroutines.scheduling.a$a.run(SourceFile:63)
}

Unchecking both exports the backup with no issue whatsoever, and importing works as well.

And when attempting to import the backup, I can select it even with the native Android file picker, although that is because it allows me to select any file, even if not compatible.

chr56 commented 1 year ago

Thank you for your feedback.

I would figure out them later.

chr56 commented 1 year ago

Well, currently:

1) these FileNotFound or files-missing problems should be fixed now. 2) theme colors and localization settings can not be backups right now. Maybe soon? 3) the endless progress should be fixed as well.

Preview Version: v0.6.2-dev2

moriel5 commented 1 year ago

That is certainly understandable.

Since I am currently in the middle of chores, I'll test the new preview version later.