TWRP Backup

Материал из Home Wiki
Перейти к навигации Перейти к поиску

Восстановление данных конкретного приложения

https://www.semipol.de/2016/07/30/android-restoring-apps-from-twrp-backup.html

First of all - install application.

Backup of TWRP makes files like this:

boot.emmc.win
boot.emmc.win.md5
data.ext4.win000
data.ext4.win000.md5
data.ext4.win001
data.ext4.win001.md5
data.ext4.win002
data.ext4.win002.md5
data.info
recovery.log
system.ext4.win
system.ext4.win.md5
system.info

The app data is stored inside the data partition. So the first step is to extract this partition:

tar -xvf data.ext4.win000

Restart adb on the phone with root permissions:

adb root

Individual application data folders can be pushed to the telephone, e.g.:

adb push data/data/com.example.app /data/data/com.example.app

Android uses a single Unix user per application. First, the pushed files need to become owned bu the user of the application.

For this purpose, first the user id of the application needs to be found out. For this purpose the application needs to be installed already. On the phone, e.g. through adb shell do:

dumpsys package com.example.app | grep userId

This will print out the user id of the app, with which the files can be changed:

chown -R $id:$id /data/data/com.example.app

This is still not sufficient for the app to function properly again. If you try to launch the app now, chances are high that it complains about SQLite databases not being readable. This seems to be caused by SELinux, which is used by Android. The SELinux attributes of the files need to be restore, as described here:

restorecon -Rv /data/data/com.example.app

Finally, the app should be restored.