Add cancel backup capability.
This will stop the iteration of the partition objects, kill the
current twrpTar thread and remove the backup directory.
Implement TWAtomicInt class to give us a wrapper that automatically
uses mutexes before the read and write to help ensure that the
reads and writes will be atomic based on documentation.
Change-Id: I645b22bc980a292e9c7202acb24ffd22ebe68c63
diff --git a/gui/devices/watch/res/watch.xml b/gui/devices/watch/res/watch.xml
index dc787b3..49e172e 100644
--- a/gui/devices/watch/res/watch.xml
+++ b/gui/devices/watch/res/watch.xml
@@ -1859,6 +1859,21 @@
<object type="template" name="action_page_console" />
+
+
+ <object type="template" name="progress_bar" />
+
+ <object type="button">
+ <highlight color="%highlight_color%" />
+ <placement x="%col_center_medium_x%" y="%row4_y%" />
+ <font resource="font" color="%button_text_color%" />
+ <text>Cancel</text>
+ <image resource="medium_button" />
+ <actions>
+ <action function="cancelbackup"></action>
+ </actions>
+ </object>
+
<object type="template" name="progress_bar" />
<object type="action">
@@ -1867,6 +1882,7 @@
<object type="action">
<condition var1="tw_operation_state" var2="1" />
+ <condition var1="tw_cancel_backup" var2="0" />
<actions>
<action function="set">tw_back=backup</action>
<action function="set">tw_complete_text1=Backup Complete</action>
@@ -1874,6 +1890,17 @@
<action function="page">action_complete</action>
</actions>
</object>
+
+ <object type="action">
+ <condition var1="tw_operation_state" var2="1" />
+ <condition var1="tw_cancel_backup" var2="1" />
+ <actions>
+ <action function="set">tw_back=backup</action>
+ <action function="set">tw_complete_text1=Backup Cancelled</action>
+ <action function="set">tw_show_reboot=1</action>
+ <action function="page">action_complete</action>
+ </actions>
+ </object>
</page>
<page name="restore">