Cancel the current download if user chooses a different channel.

In my earlier CL, to keep the implementation simple, we disallowed changing
a channel until the previous change completed in its entirety. Given that
the UI is not going to be updated for M27, such a restriction turned out
to be very confusing when playing around with channel changing. So, we
decided to implement a simple form of canceling the download if the
user selected a different channel while we're downloading the bits. This
implementation can easily be extended to support a general form of cancel
in the future, if required.

This CL also adds validation of libchromeos API calls when interpreting
the policy values. It also cleans up some bogus error messages that were
logged earlier when we abort a download.

BUG=chromium:222617
TEST=All scenarios pass on ZGB. Unit Tests pass.

Change-Id: I7cd691fe461d9ce47314299f6e2598944650ee33
Reviewed-on: https://gerrit.chromium.org/gerrit/46095
Commit-Queue: Jay Srinivasan <jaysri@chromium.org>
Reviewed-by: Jay Srinivasan <jaysri@chromium.org>
Tested-by: Jay Srinivasan <jaysri@chromium.org>
21 files changed
tree: 88e1ead1cacfd224db873b2f42acd56f9a9d1145
  1. .gitignore
  2. 99-gpio-dutflag.rules
  3. action.h
  4. action_mock.h
  5. action_pipe.h
  6. action_pipe_unittest.cc
  7. action_processor.cc
  8. action_processor.h
  9. action_processor_mock.h
  10. action_processor_unittest.cc
  11. action_unittest.cc
  12. build
  13. bzip.cc
  14. bzip.h
  15. bzip_extent_writer.cc
  16. bzip_extent_writer.h
  17. bzip_extent_writer_unittest.cc
  18. certificate_checker.cc
  19. certificate_checker.h
  20. certificate_checker_mock.h
  21. certificate_checker_unittest.cc
  22. chrome_browser_proxy_resolver.cc
  23. chrome_browser_proxy_resolver.h
  24. chrome_browser_proxy_resolver_unittest.cc
  25. chrome_proxy_resolver.cc
  26. chrome_proxy_resolver.h
  27. chrome_proxy_resolver_unittest.cc
  28. connection_manager.cc
  29. connection_manager.h
  30. connection_manager_unittest.cc
  31. constants.cc
  32. constants.h
  33. cycle_breaker.cc
  34. cycle_breaker.h
  35. cycle_breaker_unittest.cc
  36. dbus_constants.h
  37. dbus_interface.h
  38. dbus_service.cc
  39. dbus_service.h
  40. delta_diff_generator.cc
  41. delta_diff_generator.h
  42. delta_diff_generator_unittest.cc
  43. delta_performer.cc
  44. delta_performer.h
  45. delta_performer_unittest.cc
  46. download_action.cc
  47. download_action.h
  48. download_action_unittest.cc
  49. extent_mapper.cc
  50. extent_mapper.h
  51. extent_mapper_unittest.cc
  52. extent_ranges.cc
  53. extent_ranges.h
  54. extent_ranges_unittest.cc
  55. extent_writer.cc
  56. extent_writer.h
  57. extent_writer_unittest.cc
  58. file_descriptor.cc
  59. file_descriptor.h
  60. file_writer.cc
  61. file_writer.h
  62. file_writer_mock.h
  63. file_writer_unittest.cc
  64. filesystem_copier_action.cc
  65. filesystem_copier_action.h
  66. filesystem_copier_action_unittest.cc
  67. filesystem_iterator.cc
  68. filesystem_iterator.h
  69. filesystem_iterator_unittest.cc
  70. full_update_generator.cc
  71. full_update_generator.h
  72. full_update_generator_unittest.cc
  73. gen_coverage_html
  74. generate_delta_main.cc
  75. gpio_handler.cc
  76. gpio_handler.h
  77. gpio_handler_unittest.cc
  78. gpio_handler_unittest.h
  79. gpio_mock_file_descriptor.cc
  80. gpio_mock_file_descriptor.h
  81. gpio_mock_udev_interface.cc
  82. gpio_mock_udev_interface.h
  83. graph_types.h
  84. graph_utils.cc
  85. graph_utils.h
  86. graph_utils_unittest.cc
  87. http_common.cc
  88. http_common.h
  89. http_fetcher.cc
  90. http_fetcher.h
  91. http_fetcher_unittest.cc
  92. http_fetcher_unittest.h
  93. inherit-review-settings-ok
  94. install_plan.cc
  95. install_plan.h
  96. integration_unittest.cc
  97. libcurl_http_fetcher.cc
  98. libcurl_http_fetcher.h
  99. LICENSE
  100. local_coverage_rate
  101. main.cc
  102. marshal.list
  103. metadata.cc
  104. metadata.h
  105. metadata_unittest.cc
  106. mock_connection_manager.h
  107. mock_dbus_interface.h
  108. mock_file_writer.h
  109. mock_gpio_handler.h
  110. mock_http_fetcher.cc
  111. mock_http_fetcher.h
  112. mock_payload_state.h
  113. mock_system_state.cc
  114. mock_system_state.h
  115. multi_range_http_fetcher.cc
  116. multi_range_http_fetcher.h
  117. omaha_hash_calculator.cc
  118. omaha_hash_calculator.h
  119. omaha_hash_calculator_unittest.cc
  120. omaha_request_action.cc
  121. omaha_request_action.h
  122. omaha_request_action_unittest.cc
  123. omaha_request_params.cc
  124. omaha_request_params.h
  125. omaha_request_params_unittest.cc
  126. omaha_response.h
  127. omaha_response_handler_action.cc
  128. omaha_response_handler_action.h
  129. omaha_response_handler_action_unittest.cc
  130. org.chromium.UpdateEngine.service
  131. payload_signer.cc
  132. payload_signer.h
  133. payload_signer_unittest.cc
  134. payload_state.cc
  135. payload_state.h
  136. payload_state_interface.h
  137. payload_state_unittest.cc
  138. postinstall_runner_action.cc
  139. postinstall_runner_action.h
  140. postinstall_runner_action_unittest.cc
  141. prefs.cc
  142. prefs.h
  143. prefs_interface.h
  144. prefs_mock.h
  145. prefs_unittest.cc
  146. proxy_resolver.cc
  147. proxy_resolver.h
  148. real_system_state.h
  149. run_unittests
  150. sample_omaha_v3_response.xml
  151. SConstruct
  152. setup_dev_packages
  153. simple_key_value_store.cc
  154. simple_key_value_store.h
  155. simple_key_value_store_unittest.cc
  156. subprocess.cc
  157. subprocess.h
  158. subprocess_unittest.cc
  159. system_state.cc
  160. system_state.h
  161. tarjan.cc
  162. tarjan.h
  163. tarjan_unittest.cc
  164. terminator.cc
  165. terminator.h
  166. terminator_unittest.cc
  167. test_http_server.cc
  168. test_utils.cc
  169. test_utils.h
  170. testrunner.cc
  171. topological_sort.cc
  172. topological_sort.h
  173. topological_sort_unittest.cc
  174. udev_interface.h
  175. unittest_key.pem
  176. unittest_key2.pem
  177. update_attempter.cc
  178. update_attempter.h
  179. update_attempter_mock.h
  180. update_attempter_unittest.cc
  181. update_check_scheduler.cc
  182. update_check_scheduler.h
  183. update_check_scheduler_unittest.cc
  184. update_engine.xml
  185. update_engine_client.cc
  186. update_metadata.proto
  187. UpdateEngine.conf
  188. utils.cc
  189. utils.h
  190. utils_unittest.cc
  191. WATCHLISTS
  192. zip_unittest.cc