update_engine: Run backuptool script before normal postinstall script

* Check if the currently running /system has ever been mounted R/W.
  If it has, we can assume that running backuptool_ab scripts won't
  do anything catastrophic like break verity. Also this is a good
  indicator that the partition has been messed with since the initial
  installation of the rom (for instance if a gapps or su package had
  been added).

* Mount the new target slot's /system partition at /postinstall R/W,
  before the normal dex preopt script is run, and perform backuptool_ab
  operations. This will allow retaining addon packages, similar to what
  we've historically used in recovery flashes for non-A/B devices. This,
  since it mounts the new /system R/W, will also ensure it gets triggered
  again on the next flash.

* This assume that all backuptool operations are contained in /system
  and that we won't ever screw around with retaining things on /vendor.

Change-Id: I00ca479ccc24080bf3457334a6c9e4c07dd20f45
1 file changed
tree: 6288d5641c8f34d5297efb787c4406d0db2d3d35
  1. binder_bindings/
  2. client_library/
  3. common/
  4. dbus_bindings/
  5. fuzz/
  6. init/
  7. payload_consumer/
  8. payload_generator/
  9. sample_images/
  10. scripts/
  11. update_engine/
  12. update_manager/
  13. update_payload_key/
  14. .clang-format
  15. .gitignore
  16. .gitreview
  17. Android.bp
  18. binder_service_android.cc
  19. binder_service_android.h
  20. binder_service_brillo.cc
  21. binder_service_brillo.h
  22. boot_control_android.cc
  23. boot_control_android.h
  24. boot_control_android_unittest.cc
  25. boot_control_chromeos.cc
  26. boot_control_chromeos.h
  27. boot_control_chromeos_unittest.cc
  28. certificate_checker.cc
  29. certificate_checker.h
  30. certificate_checker_unittest.cc
  31. chrome_browser_proxy_resolver.cc
  32. chrome_browser_proxy_resolver.h
  33. COMMIT-QUEUE.ini
  34. common_service.cc
  35. common_service.h
  36. common_service_unittest.cc
  37. connection_manager.cc
  38. connection_manager.h
  39. connection_manager_android.cc
  40. connection_manager_android.h
  41. connection_manager_interface.h
  42. connection_manager_unittest.cc
  43. connection_utils.cc
  44. connection_utils.h
  45. CPPLINT.cfg
  46. daemon.cc
  47. daemon.h
  48. daemon_state_android.cc
  49. daemon_state_android.h
  50. daemon_state_interface.h
  51. dbus_connection.cc
  52. dbus_connection.h
  53. dbus_service.cc
  54. dbus_service.h
  55. dbus_test_utils.h
  56. dlcservice_chromeos.cc
  57. dlcservice_chromeos.h
  58. dynamic_partition_control_android.cc
  59. dynamic_partition_control_android.h
  60. dynamic_partition_control_interface.h
  61. fake_file_writer.h
  62. fake_p2p_manager.h
  63. fake_p2p_manager_configuration.h
  64. fake_shill_proxy.cc
  65. fake_shill_proxy.h
  66. fake_system_state.cc
  67. fake_system_state.h
  68. generate_pc_file.sh
  69. hardware_android.cc
  70. hardware_android.h
  71. hardware_chromeos.cc
  72. hardware_chromeos.h
  73. hardware_chromeos_unittest.cc
  74. image_properties.h
  75. image_properties_android.cc
  76. image_properties_android_unittest.cc
  77. image_properties_chromeos.cc
  78. image_properties_chromeos_unittest.cc
  79. libcurl_http_fetcher.cc
  80. libcurl_http_fetcher.h
  81. libupdate_engine-client-test.pc.in
  82. libupdate_engine-client.pc.in
  83. local_coverage_rate
  84. main.cc
  85. metrics_constants.h
  86. metrics_reporter_android.cc
  87. metrics_reporter_android.h
  88. metrics_reporter_interface.h
  89. metrics_reporter_omaha.cc
  90. metrics_reporter_omaha.h
  91. metrics_reporter_omaha_unittest.cc
  92. metrics_reporter_stub.cc
  93. metrics_reporter_stub.h
  94. metrics_utils.cc
  95. metrics_utils.h
  96. metrics_utils_unittest.cc
  97. mock_boot_control_hal.h
  98. mock_certificate_checker.h
  99. mock_connection_manager.h
  100. mock_dynamic_partition_control.h
  101. mock_file_writer.h
  102. mock_metrics_reporter.h
  103. mock_omaha_request_params.h
  104. mock_p2p_manager.h
  105. mock_payload_state.h
  106. mock_power_manager.h
  107. mock_service_observer.h
  108. mock_update_attempter.h
  109. MODULE_LICENSE_APACHE2
  110. network_selector.h
  111. network_selector_android.cc
  112. network_selector_android.h
  113. network_selector_interface.h
  114. network_selector_stub.cc
  115. network_selector_stub.h
  116. NOTICE
  117. omaha_request_action.cc
  118. omaha_request_action.h
  119. omaha_request_action_fuzzer.cc
  120. omaha_request_action_unittest.cc
  121. omaha_request_params.cc
  122. omaha_request_params.h
  123. omaha_request_params_unittest.cc
  124. omaha_response.h
  125. omaha_response_handler_action.cc
  126. omaha_response_handler_action.h
  127. omaha_response_handler_action_unittest.cc
  128. omaha_utils.cc
  129. omaha_utils.h
  130. omaha_utils_unittest.cc
  131. OWNERS
  132. p2p_manager.cc
  133. p2p_manager.h
  134. p2p_manager_unittest.cc
  135. parcelable_update_engine_status.cc
  136. parcelable_update_engine_status.h
  137. parcelable_update_engine_status_unittest.cc
  138. payload_state.cc
  139. payload_state.h
  140. payload_state_interface.h
  141. payload_state_unittest.cc
  142. power_manager_android.cc
  143. power_manager_android.h
  144. power_manager_chromeos.cc
  145. power_manager_chromeos.h
  146. power_manager_interface.h
  147. PRESUBMIT.cfg
  148. PREUPLOAD.cfg
  149. pylintrc
  150. real_system_state.cc
  151. real_system_state.h
  152. run_unittests
  153. sample_omaha_v3_response.xml
  154. service_delegate_android_interface.h
  155. service_observer_interface.h
  156. shill_proxy.cc
  157. shill_proxy.h
  158. shill_proxy_interface.h
  159. sideload_main.cc
  160. system_state.h
  161. tar_bunzip2.gypi
  162. test_http_server.cc
  163. test_subprocess.cc
  164. testrunner.cc
  165. unittest_key.pem
  166. unittest_key2.pem
  167. unittest_key_RSA4096.pem
  168. update_attempter.cc
  169. update_attempter.h
  170. update_attempter_android.cc
  171. update_attempter_android.h
  172. update_attempter_android_unittest.cc
  173. update_attempter_unittest.cc
  174. update_boot_flags_action.cc
  175. update_boot_flags_action.h
  176. update_boot_flags_action_unittest.cc
  177. update_engine-client.gyp
  178. update_engine.conf
  179. update_engine.gyp
  180. update_engine.rc
  181. update_engine_client.cc
  182. update_engine_client_android.cc
  183. update_metadata.proto
  184. update_status_utils.cc
  185. update_status_utils.h
  186. UpdateEngine.conf