NeoApplications / Neo-Backup

backup manager for android
GNU Affero General Public License v3.0
2.64k stars 127 forks source link

[Bug] Specials Wifi access point, fingerprint and wallpaper not backing up on lineageos 21 as the targetted xmls are somewhere else #902

Open dwardor opened 2 months ago

dwardor commented 2 months ago

Description The 3 Specials "Wifi access point, fingerprint, and wallpaper" are not backing up for me on lineageos 21

Steps To Reproduce

  1. Launch a backup of these specials
  2. Each backup fails claiming "No such file or directory - null"
    /data/misc/wifi/WifiConfigStore.xml: No such file or directory - Null
    /data/user/0/settings_fingerprint.xml: No such file or directory - Null
    /data/user/0/wallpaper_info.xml: No such file or directory - Null

Such fails are normal as the files are in these alternative locations on lineageos 21:

-rw------- 1 system system 275124 2024-09-08 11:18 /data/misc/apexdata/com.android.wifi/WifiConfigStore.xml <-- seems to be the correct one
-rw------- 1 system system   1731 2024-09-08 11:18 /data/misc_ce/0/apexdata/com.android.wifi/WifiConfigStore.xml <-- does not contin all SSID available in the UI

-rw------- 1 system system 365 2023-08-25 22:05 /data/system/users/0/settings_fingerprint.xml

-rw------- 1 system system 7616 2024-09-07 21:26 /data/system/users/0/wallpaper_info.xml

Expected behavior They get backed up

Screenshots Screenshot_20240908-110335_WhatsApp

System Information(please complete the following information):

PS I did notice the "up_to_sdk29" for Wifi Access point backup, and am intrigued why it running as it should know the OS is android 14 so sdk 34...

dwardor commented 2 months ago

Possibly related to https://github.com/NeoApplications/Neo-Backup/issues/860

hg42 commented 1 month ago

the big question with such things is, does it work for all A14 or only on LOS21 or even only on your system etc.?

It's not guarantied at all, that a file can be found at a certain place. A manufacturer could change that position, a custom ROM developer could do weird things, or an update like A14 QPR3 could place it somewhere else.

We are only two devs sporadically working on NB. So, we don't even try to find out where these files live. There is enough to do on more basic things (nobody pays us! and we don't want it anyways).

Because of all that, I lately added a plugin system as a first step. Users can now create their own file lists. I imagine a kind of repository where users can post plugins and where they can discuss them. May be something similar to userscripts or similar. Though that's a long way to go.

See DevTools/plugins for an editor (no docs have been written). Note it's in an early stage, that's why it is in DevTools and will probably always stay there.

You have builtin and user plugins. If you open a builtin plugin and save it, it's now a user plugin.

I have some ideas to add conditions to the system, e.g. Android version, manufacturer, device model, maybe certain chips. But I think this is not worth the effort, because it will never work, because someone creating a file will only have a few devices and will never have a clue how the exact conditions for a file location (or anything else, like APIs) are. E.g. I added the fingerprint based on my Realme X2 device and don't have a clue for which devices it works. On the long run a plugin repo could allow to add conditions that worked for someone. But I guess there are so many errors from users, that it doesn't help.

The only defined things are what is documented by Google etc. And that never includes locations of files.

The proper way would be to use APIs like e.g. the SMS special package handler does. That's something that needs a developer, that can write Kotlin/Android. Still, that doesn't help much, because most of the data is not public. E.g. you cannot access the passwords of wifi connections via public APIs.

That's why you need to break the official access methods anyways. And that means accessing files directly.

I separated the previous two wifi file locations, that were handled by the wifi special package before, into two files. That's why we now have two packages. "up_to_sdk29" is a guess, its not verified in any way that this is a sufficient condition. That's also why I don't want to restrict it.

Now we would have a third location of the wifi files. Now, what is apexdata? I don't know and I don't have time or motivation to investigate.

You could create a new plugin for it, determine the conditions and choose an appropriate name, then send it to me for inclusion (plus some comments). Or you could create a pull request here, if you are able to do this. see folder src/main/assets/files/plugin/ in this repo.

hg42 commented 1 month ago

the wifi location was wrong for some time after implementing the plugins (some simple copying error) and the path was already fixed after that:

/apexdata/com.android.wifi/WifiConfigStore.xml but plugin updates did not work (they only worked in pumpkin apks so I didn't notice it), and this was fixed 2024-09-18.
dwardor commented 1 month ago

Wifi access point backup issue solved by blacklisting "wifi access points up to sdk29" --> I'm guessing it was erroneously getting run instead of "wifi access points" although I had not selected it... --> thre must be a nug there somewhere...

For the rest I've tried creating my personal ".special_files" in "/data/user/0/com.machiav3lli.backup/files/plugins" (by copy/modify but they are not getting proposed... in the UI.

is a placeholder for "/data/user/0" it seems... what is the palceholdder for "/data/system/users/0" ?
hg42 commented 1 month ago

Wifi access point backup issue solved by blacklisting "wifi access points up to sdk29" --> I'm guessing it was erroneously getting run instead of "wifi access points" although I had not selected it... --> thre must be a nug there somewhere...

I would say this is unlikely

For the rest I've tried creating my personal ".special_files" in "/data/user/0/com.machiav3lli.backup/files/plugins" (by copy/modify but they are not getting proposed... in the UI

that's not the way to do it... I said this:

See DevTools/plugins for an editor (no docs have been written). Note it's in an early stage, that's why it is in DevTools and will probably always stay there.

DevTools is long press on title e.g. on "Homepage"

and this:

You have builtin and user plugins. If you open a builtin plugin and save it, it's now a user plugin.

has a side effect: the file is copied to the .../Android/data/... folder (I call it user plugin folder).

The directories are not observed all the time, that doesn't make sense for such a rare event. Especially the builtin plugins folder is only scanned when NB starts.

Not sure about the user folder. I didn't think about it, because we already have a plugin management page and it has a Reload button to scan both folders again. Editing/copying/creating plugins does this automatically. Also, plugins you do not want to use, can be disabled via the check box (they are renamed, the "_off" suffix). The background color of the card item should change, if it becomes a user plugin (those are "more in front" or "higher" in material speak).

hg42 commented 1 month ago

what is the palceholdder for "/data/system/users/0" ?

you can see the current list in: SpecialFilesPlugin.kt

currently these:

"userId"            to userId.toString(),
"miscData"          to "/data/misc",
"systemData"        to "/data/system",
"systemUserData"    to "/data/system/users/$userId",
"systemCeUserData"  to "/data/system_ce/$userId",
"vendorDeUserData"  to "/data/vendor_de/$userId",
"userData"          to "/data/user/$userId",
"userDeData"        to "/data/user_de/$userId",
"extUserData"       to "/storage/emulated/$userId/Android/data",
"extUserMedia"      to "/storage/emulated/$userId/Android/media",
"extUserObb"        to "/storage/emulated/$userId/Android/obb",

note, this might still be subject to changes, I want to keep this logical

dwardor commented 1 month ago

Thanks for the last instructions. I created the plugings the righway normally now as per the 2 screenshots below Screenshot_20241014-233729_Neo Backup Screenshot_20241017-173045_Neo Backup

However I still get an error message suggesting <systemUserData> is not getting replaced correctly ! 1001034557

Any clue ?

hg42 commented 1 month ago

sorry, for answering late... if you have 8.3.8 fdroid, the fix is not yet included. you need a pumpkin apk to have most of my commits after a release you find them in the telegram group (topic Bugs...)