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
diff --git a/gui/theme/common/watch.xml b/gui/theme/common/watch.xml
index 4516ce2..38a2a23 100644
--- a/gui/theme/common/watch.xml
+++ b/gui/theme/common/watch.xml
@@ -213,7 +213,7 @@
<text>{@backup_btn=Backup}</text>
<actions>
<action function="set">tw_back=main</action>
- <action function="page">backup_selectstorage</action>
+ <action function="page">backup</action>
</actions>
</button>
@@ -1786,7 +1786,7 @@
</action>
</page>
- <page name="backup_selectstorage">
+ <page name="backup">
<template name="page"/>
<template name="statusbar"/>
@@ -1807,7 +1807,7 @@
<image resource="q_btn_refresh"/>
<actions>
<action function="refreshsizes"/>
- <action function="page">backup_selectstorage</action>
+ <action function="page">backup</action>
</actions>
</button>
@@ -1824,7 +1824,7 @@
<highlight color="%highlight_color%"/>
<image resource="q_btn_arrow_right"/>
<actions>
- <action function="set">tw_back=backup_selectstorage</action>
+ <action function="set">tw_back=backup</action>
<action function="page">backup_selectpartitions</action>
</actions>
</button>
@@ -1869,7 +1869,7 @@
<placement x="%col1_x_left%" y="%row11_y%"/>
<highlight color="%highlight_color%"/>
<image resource="q_btn_arrow_left"/>
- <action function="page">backup_selectstorage</action>
+ <action function="page">backup</action>
</button>
<button>
@@ -1946,6 +1946,7 @@
<conditions>
<condition var1="tw_include_encrypted_backup" var2="1"/>
<condition var1="tw_encrypt_backup" var2="0"/>
+ <condition var1="tw_enable_adb_backup" op="!=" var2="1"/>
</conditions>
<placement x="%btn4_col2_x%" y="%row11_y%"/>
<highlight color="%highlight_color%"/>
@@ -1961,6 +1962,7 @@
<conditions>
<condition var1="tw_include_encrypted_backup" var2="1"/>
<condition var1="tw_encrypt_backup" var2="1"/>
+ <condition var1="tw_enable_adb_backup" op="!=" var2="1"/>
</conditions>
<placement x="%btn4_col2_x%" y="%row11_y%"/>
<highlight color="%highlight_color%"/>
@@ -2071,7 +2073,7 @@
<placement x="%center_x%" y="%row2_header_y%" w="%screen_half_width%" h="48"/>
<actions>
<action function="set">tw_back=backup_confirm</action>
- <action function="page">backup_selectstorage</action>
+ <action function="page">backup</action>
</actions>
</button>
@@ -2084,6 +2086,7 @@
<conditions>
<condition var1="tw_include_encrypted_backup" var2="1"/>
<condition var1="tw_encrypt_backup" var2="0"/>
+ <condition var1="tw_enable_adb_backup" op="!=" var2="1"/>
</conditions>
<placement x="%col1_x_right%" y="%row4a_y%"/>
<text>{@disabled=Disabled}</text>
@@ -2093,6 +2096,7 @@
<conditions>
<condition var1="tw_include_encrypted_backup" var2="1"/>
<condition var1="tw_encrypt_backup" var2="1"/>
+ <condition var1="tw_enable_adb_backup" op="!=" var2="1"/>
</conditions>
<placement x="%col1_x_right%" y="%row4a_y%"/>
<text>{@enabled=Enabled}</text>
@@ -2146,7 +2150,7 @@
<action>
<touch key="back"/>
- <action function="page">backup_selectstorage</action>
+ <action function="page">backup</action>
</action>
</page>