VR-25/migrator

ADB Shell - runtime-perms.txt - no such file or dir

everonline opened this issue · 3 comments

Hi VR-25,

First great tool you have here.

Now I copy the script and did my backup through adb shell (migrator.sh -b app), no errors, I check the tar file, apparently all good.

Went to another phone and still with adb shell (migrator.sh -rad app) and this happens:

Restoring
com.myapp.ex
App
avc: denied { read } for scontext=u:r:system_server:s0 tcontext=u:object_r:system_data_root_file:s0 tclass=file permissive=1
Data
cat: can't open 'com.myapp.ex/runtime-perms.txt': No such file or directory
Reboot & run "migrator.sh -s" to enable apps with Settings.Secure.ANDROID_ID (SSAID)

So the app is restored but the data fails with the runtime perms because when this is executed:

$bkp_runtime_perms && {
sed -n "/$pkg/,/<//p" /data/system/users/0/runtime-permissions.xml
| grep 'granted="true"'
| grep -o 'android.permission.*[A-Z]' > $bkp_dir/$pkg/runtime-perms.txt
}

There is no runtime-permissions.xml (android 11 in a pixel 4) so when you restore:

    for perm in $(cat $pkg/runtime-perms.txt); do
      pm grant $pkg $perm 2>/dev/null
    done
  done < $tmp

The error message is consistent but it affects the restore of the data, by that I mean:

1 - In one of the apps I restored the app opens but no preferences (user data) is restored, is by default - App with no SSAID
2 - On another one (email app) the app dont even open (is killed immediately after being enabled with -s) - APP with SSAID

Hope the above helps.

Y-T-G commented

Same issue for me too in Android 11.

I've experienced the same issue

VR-25 commented

If the new release still has this issue, try after pasting and running the following as root:
cp /data/adb/modules/migrator/migrator.sh /dev/ && sed '\|runtime-perms.txt)|s|)| 2>/dev/null)|' /dev/migrator.sh > /data/adb/modules/migrator/migrator.sh