3

After installing an OTA update my phone bootlooped so I made a TWRP backup and did a clean install of the latest version of the ROM I'm using but restoring the backup using TWRP bootloop my phone again. I only need to restore one or two apps. I know that I can extract the files by adding .tar and opening them with WinRAR. Now my question is : What files I need to move from the backup to my phone to restore the data of a single app manually?

  • ROM : Pixel Experience Plus (Official)
  • Android : 11
  • Magisk : 22.0

I tried copying the data from /data/data/com.exemple.idk and replacing the new ones in my phone but that doesn't seem to work. Is there anything else I need to copy from the backup files?

Yox
  • 161
  • 1
  • 7
  • 1
    If the app uses the hardware backed AndroidKeystore for storing private or secret cryptographic keys you won't succeed in restoring the data as the keystone can't be restored selectively (if it can be restored at all). Therefore it depends on the app. – Robert Apr 03 '21 at 21:26
  • 1
    Is there a way to know if the app is using Android keystore system? – Yox Apr 03 '21 at 22:26
  • 1
    Does this answer your question? Backup WhatsApp from NANDROID – alecxs Apr 03 '21 at 22:34
  • for more than one app use that script and restore with this app (with some intermediate steps) – alecxs Apr 03 '21 at 22:47
  • 1
    Is the device rooted? IIRC Titanium Backup can restore parts of Nandroid backups, but it requires root. – Izzy Apr 04 '21 at 00:41
  • @alexcs I already tried that but the app just refuse to start after copying its data (did it again with 0775 same result). I forgot to mention that I didn't reinstall TWRP again because in XDA forum they said it's not fully compatible with Android 11 and it's maybe the cause of my first bootloop since it's not an official release. – Yox Apr 04 '21 at 13:04
  • @Izzy My phone is rooted but Titanium Backup is outdated and doesn't work with recent versions of Android – Yox Apr 04 '21 at 13:04
  • Indeed, the last version was released more than a year ago (11/2019), a real pity! I didn't yet reach Q, so I did not notice it won't work on Q or R. The tools directory in the devel branch of Adebar has two scripts you might wish to investigate on what data belonging to an app is used for backup/restore: root_appbackup.sh tells you what goes into an app's backup (ie what files to look for), and root_apprestore.sh how it is restored. Maybe that helps? – Izzy Apr 04 '21 at 16:12
  • if you know the app won't run on android 11 at all, this whole question is pointless... of course you can restore app data only if the app itself is working. (btw the chown step is the important one, and maybe chcon too) – alecxs Apr 04 '21 at 18:13
  • @alexcs You misunderstood me, it's not the app who doesn't work on Android 11, but the unofficial TWRP image. I already did the chown and chcon but I realized that the subfolders have a different group and that's what solved my problem. – Yox Apr 04 '21 at 22:42
  • you probably missed the -R flag very last line in the linked duplicate – alecxs Apr 05 '21 at 02:35

1 Answers1

3

Thanks to @alecxs and @Izzy I realized that the problem was related to the folder and subfolders attributes (permissions, owner and groups). I will tell you what I did to restore just a specific application from the NANDroid backup generated by TWRP (without using any command but root is required)

  1. Add .tar to the .win000 and .win001 etc (ignore the .sha2 files and any other files)

Exemple

  1. Extract everything in the same folder using WinRAR or any similar software
  2. Go to \data\data and copy the folder of the app you want to restore to the internal storage of your phone (for exemple com.exemple.idk) and remove the cache folders from inside this folder (IMPORTANT)
  3. Install Solid Explorer File Manager from the Play Store
  4. Install the app(s) you want to restore from the Play Store too
  5. Using Solid Explorer copy everything that's inside com.exemple.idk and navigate to /data/data/com.exemple.idk then paste everything
  6. Now select the cache folder FIRST and select all the folders you just pasted one by one! DON'T use the select all button! > Click on the 3 dots > Properties > Attributes (You should be able to see a similar screen with similar permissions)

Screenshot

  1. Now just check Recursive ☑ in both checkboxes and apply both.

Et voila! The application should be now restored to its previous state, if not uninstall it and try again step by step carefully.

Yox
  • 161
  • 1
  • 7