tiefkuehlpizze / oandbackupx Goto Github PK
View Code? Open in Web Editor NEWThis project forked from neoapplications/neo-backup
backup manager for android
License: GNU Affero General Public License v3.0
This project forked from neoapplications/neo-backup
backup manager for android
License: GNU Affero General Public License v3.0
It would be nice, to have a logfile again with some contents.
I'm trying to backup the phone and app settings using OAndBackupX. It seems to be working because it is creating files in the folder specificed for the backup. However, I get an error message for each item I try to backup. Using AntennaPod as an example: 'AntennaPod: unable to stat "/proc/self/exe": No such file or directory. Any idea of what it might be?
I'm running Lineage4MicroG based on Android 9.
Backing up or restoring a system app lets OABX kill all processes of the owning UID which is 1000 in a system app's case.
This is equal to killing the operating system.
Two steps have to be taken:
Additional steps:
@hg42x did some great testing on this topic and shared it in the Telegram channel:
example test: using clock display (showing seconds)
pm suspend com.google.android.deskclock ; sleep 5 ; pm unsuspend com.google.android.deskclock
works somehow but closes the app, makes the widget showing it's icon, then resumes the widget, but the clock remains closed. You also get a refresh of the whole home screen on suspend and unsuspend (I saw this on another backup app, may be buggybackup).
The command:
kill -STOP 13799 ; sleep 5 ; kill -CONT 13799
works without closing, the secsonds stop and resume afterwards.
I used this to find the PID:
# ps -A | grep com\.google\.android\.deskclock u0_a205 13799 717 5594500 170908 SyS_epoll_wait 0 S com.google.android.deskclock
may be there are better ways
I think a complete group of corresponding processes (the app may have sub processes and a service etc.) should be suspended. I never used that, but it seems, a process group is the corresponding "thing".use e.g.:
ps -A -o PGID,PPID,PID,USER,GROUP,CMDLINE | sort
to show the groups (first number) sorted.
On my phone I have a lot of processes in group 717, which is the PID of zygote64.If I use:
kill -STOP -717 ; sleep 5 ; kill -CONT -717
(note the -PGID parameter)
they all will be stopped.
I tested thsi by looking at different apps like internet radio or clock. They are all stopped until CONT is sent.Oh...that will not help, because all user apps run in this group (unless suspending all to gether, but OABX would stop itself).
Listing all PIDs of the app user should do the same
There are codepaths in restore procedure, that define installation from different paths to for restoring apks.
The expected way to restore apks is to use the staging directory /data/local/tmp
because this is the only path the package manager accepts to install apks from (alternatively stream the apk contents like adb install
does).
The second way is used, when the staging directory does not exist and the backup directory is oandbackupx's own data directory. (I don't know how to configure oandbackupx to use this as backup path. Backup location is always on the external storage). The strategy is to copy the apk to the external storage and install it then.
With the definition from above, that package manager would refuse to install from another path than the /dat/local/tmp
this would fail on recent Android versions. This might be a relict that works on older, unsupported versions.
I would suggest to drop this and see if anybody reports issues when restoring. Maybe a niche vendor uses a broken Android configuration that would need this.
Third way is to install the backup from the location where it is. I would assume this would happen more likely than the second way and then there is a chance that it would succeed.
Without having it tested, it might make sense to always use apk streaming.
Just a quick update, before I'm leaving for a short night:
I'm reworking the whole core backup stuff (namely ShellCommands.java).
At some points, I ran into issues just related to SDK <26 (namely Android 7.x). I'm currently testing on Android 7 and I've noticed that many apps are not available on the Play Store (many Games and Spotify). I guess it's because of split APK. So Titanium Backup would probably perform well on Android 7.x.
As you might have seen, I have .tar.gz
archiving implemented. It's working fine and I think, I even got the crypto running (some password to key expansion with PBKDF2 and then wrap the tar.gz output stream through it).
But now the bummer: I already mentioned the problem with symlinks and zipfiles the other day and when I was testing the restore function, I've noticed issues with the lib
directory in the app's data because it's a symlink. Too many symlinks. Well. The backup procedure does not create symlinks in the tar.gz archive. Even when I tried to implement it. That's because it's copying the data to the external storage first which is formatted in FAT. And FAT does not support symlinks.
I guess, the restore of the data works in the released versions, because it's dereferencing the symlinks and replaces it with the actual files. This might go well for some time, but I guess the time will come, when the app updates the original file and you'll have mixed versions in your data. Either you'll have to fix it manually or you'll have to delete the app's data.
I can think of another solution which is to use toybox's tar command to create the archive right from the data directory and to the encryption afterwards. It would double the writes on the storage if you have encryption enabled because it would first create the archive and then encrypt it (and being picky: it leaves the traces of the unencrypted deleted archive, so an attacker could be able to restore the data).
Last for today, I want to mention a potential bug with the AppInfo
class, because it stores and restores the original data directories, which is fine on the same device. On my emulator, I have adopted storage and then it tries to restore the data to /mnt/expand/86e4a97c-661b-4611-971a-b66b093be72e/user/0/com.supercell.clashofclans
. Obviously a dynamic path that is different after a wipe or change of device. So I needed to get the fresh path from the package manager.
I guess you also have noticed, that the app does not do a good job updating the information an action and here it even causes issues on the technical site.
That's so far from my site. I'll go on tomorrow. I need some sleep now.
drwxr-x--x 4 u0_a94 u0_a94 4096 2019-11-15 13:05 com.google.android.launcher
drwxrwx--x 12 u0_a121 u0_a121 4096 2020-06-28 12:25 com.spotify.music
drwx------ 8 u0_a123 u0_a123 4096 2020-06-28 12:25 com.sunborn.girlsfrontline.en
com.spotify.music
has been restored while com.sunborn.girlsfrontline.en
was installed by Google Play.
But also some other system apps have these permissions set.
It does not seem to break anything, but data privacy might be reduced.
Just dropping some notes:
ACTION_OPEN_DOCUMENT_TREE
is no longer allowed to return the root directory of the storageDescription
The list is not stored neither restored or processed
Steps To Reproduce
Expected behavior
List shows previously checked elements and processes them
Screenshots
None
System Information(please complete the following information):
I'm just noting this down, because it's a mess. Just to create it as official issue later.
Asking for permissions with 3 or more ways to exit. I'm trying to add the necessary query for the backup directory if it's not set (or accessible). It's spaghetti.
It would be nice, if we could have a nice and friendly setup guide. The app launches, it checks what is missing and adds setup pages to the user's todo list.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.