ADB: Add adb backup for TWRP.

Functionality for client side to backup
tar and image streams over adbd to the client under backup.ab.

Using adb backup on the client side you can backup the partitions
TWRP knows about.

On the client side you can do the following:
adb backup -f <filename> --twrp <options> where options are
--compress: compress data
system: backup system
cache: backup cache
data: backup data
boot: backup boot
etc for each partition.

You can string multiple options,
i.e. adb backup -f <filename> --twrp --compress cache system data

adb backup in TWRP will take any option corresponding
to TWRP fstab partitions, e.g. efs boot as well.

If you do not specify the filename with the -f option,
adb will backup your data to a filename backup.ab on the client.
You can then rename the file and encrypt it with desktop tools.

If you don't want to use command line arguments:
adb backup --twrp

will bring up the gui and allow you to choose partitions
from the backup page.

To restore the backup use the following convention:
adb restore <filename>

Structures are used to store metadata in binary inside
of the file itself. If the metadata structure is modified,
update the adb version so that it will invalidate older
backups and not cause issues on restore. When restoring,
we currently do not support picking specific partitions.
It's all or nothing.

Change-Id: Idb92c37fc9801dc8d89ed2a4570e9d12e76facf8
29 files changed
tree: 2908e48dfb44eae96c49113a177108f3cbb714f2
  1. .gitignore
  2. Android.mk
  3. CleanSpec.mk
  4. NOTICE
  5. README.md
  6. adb_install.cpp
  7. adb_install.h
  8. adbbu/
  9. applypatch/
  10. asn1_decoder.cpp
  11. asn1_decoder.h
  12. bmlutils/
  13. bootloader.cpp
  14. bootloader.h
  15. common.h
  16. crypto/
  17. data.cpp
  18. data.hpp
  19. default_device.cpp
  20. device.cpp
  21. device.h
  22. digest/
  23. dosfstools/
  24. edify/
  25. etc/
  26. exfat/
  27. fb2png/
  28. find_file.cpp
  29. find_file.hpp
  30. fixContexts.cpp
  31. fixContexts.hpp
  32. flashutils/
  33. fonts/
  34. fuse.h
  35. fuse/
  36. fuse_sdcard_provider.c
  37. fuse_sdcard_provider.h
  38. fuse_sideload.c
  39. fuse_sideload.h
  40. gpt/
  41. gui/
  42. htcdumlock/
  43. infomanager.cpp
  44. infomanager.hpp
  45. injecttwrp/
  46. install.cpp
  47. install.h
  48. interlace-frames.py
  49. legacy_properties.h
  50. legacy_property_service.c
  51. legacy_property_service.h
  52. libblkid/
  53. libcrecovery/
  54. libmincrypt/
  55. libpixelflinger/
  56. libtar/
  57. minadbd.old/
  58. minadbd/
  59. minui.old/
  60. minui/
  61. minuitwrp/
  62. minzip/
  63. mmcutils/
  64. mounts.c
  65. mounts.h
  66. mtdutils/
  67. mtp/
  68. openaes/
  69. openrecoveryscript.cpp
  70. openrecoveryscript.hpp
  71. orscmd/
  72. partition.cpp
  73. partitionmanager.cpp
  74. partitions.hpp
  75. pigz/
  76. prebuilt/
  77. progresstracking.cpp
  78. progresstracking.hpp
  79. recovery.cpp
  80. recovery_ui.h
  81. res-hdpi/
  82. res-mdpi/
  83. res-xhdpi/
  84. res-xxhdpi/
  85. res-xxxhdpi/
  86. res/
  87. roots.cpp
  88. roots.h
  89. screen_ui.cpp
  90. screen_ui.h
  91. scripts/
  92. sepolicy/
  93. set_metadata.c
  94. set_metadata.h
  95. simg2img/
  96. tarWrite.c
  97. tarWrite.h
  98. testdata/
  99. tests/
  100. toolbox/
  101. tools/
  102. toybox/
  103. tw_atomic.cpp
  104. tw_atomic.hpp
  105. twcommon.h
  106. twinstall.cpp
  107. twinstall.h
  108. twrp-functions.cpp
  109. twrp-functions.hpp
  110. twrp.cpp
  111. twrpDU.cpp
  112. twrpDU.hpp
  113. twrpDigest.cpp
  114. twrpDigest.hpp
  115. twrpTar.cpp
  116. twrpTar.h
  117. twrpTar.hpp
  118. twrpTarMain/
  119. ui.cpp
  120. ui.h
  121. uncrypt/
  122. updater/
  123. variables.h
  124. verifier.cpp
  125. verifier.h
  126. verifier_test.cpp
  127. verifier_test.sh
README.md

Team Win Recovery Project (TWRP)

You can find a compiling guide here.