update_engine: Modify Update Time Restrictions to block downloads

This makes Update Time Restrictions policy block downloads rather than
checks. This will allow for better capturing of metrics. Furthermore,
this change makes Update Time Restrictions only apply for kiosks, per
the discussion with security and PM.
The following changes are made:
* Use UpdateCanBeApplied rather than UpdateCheckAllowed in
UpdateTimeRestrictionsPolicyImpl.
* ChromeOSPolicy::UpdateCanBeApplied now checks for forced updates.
Modify the corresponding classes to implement UpdateCanBeApplied.
* Add the auto_launched_kiosk_app_id variable from libbrillo to the
policy provider, this variable lets us know if the device is in
kiosk-mode.
* If the device is not in kiosk mode, this policy won't be used.
* Change chromeos_policy to check for policies in UpdateCanBeApplied.
* Add unit tests accounting for the new changes.

BUG=chromium:852860
TEST=cros_workon_make update_engine --test

Change-Id: Iba52fa0fd1f89cc55e5009776036f8949e01e3a0
Reviewed-on: https://chromium-review.googlesource.com/1144435
Commit-Ready: Adolfo Higueros <adokar@google.com>
Tested-by: Adolfo Higueros <adokar@google.com>
Reviewed-by: Amin Hassani <ahassani@chromium.org>
12 files changed
tree: d9c8f21c983e1c723ce5f13667942bf05b057215
  1. binder_bindings/
  2. client_library/
  3. common/
  4. dbus_bindings/
  5. init/
  6. payload_consumer/
  7. payload_generator/
  8. sample_images/
  9. scripts/
  10. update_manager/
  11. update_payload_key/
  12. .clang-format
  13. .gitignore
  14. Android.bp
  15. Android.mk
  16. binder_service_android.cc
  17. binder_service_android.h
  18. binder_service_brillo.cc
  19. binder_service_brillo.h
  20. boot_control_android.cc
  21. boot_control_android.h
  22. boot_control_chromeos.cc
  23. boot_control_chromeos.h
  24. boot_control_chromeos_unittest.cc
  25. boot_control_recovery.cc
  26. boot_control_recovery.h
  27. boot_control_recovery_stub.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. fake_file_writer.h
  57. fake_p2p_manager.h
  58. fake_p2p_manager_configuration.h
  59. fake_shill_proxy.cc
  60. fake_shill_proxy.h
  61. fake_system_state.cc
  62. fake_system_state.h
  63. generate_pc_file.sh
  64. hardware_android.cc
  65. hardware_android.h
  66. hardware_chromeos.cc
  67. hardware_chromeos.h
  68. hardware_chromeos_unittest.cc
  69. image_properties.h
  70. image_properties_android.cc
  71. image_properties_android_unittest.cc
  72. image_properties_chromeos.cc
  73. image_properties_chromeos_unittest.cc
  74. libcurl_http_fetcher.cc
  75. libcurl_http_fetcher.h
  76. libupdate_engine-client-test.pc.in
  77. libupdate_engine-client.pc.in
  78. local_coverage_rate
  79. main.cc
  80. metrics_constants.h
  81. metrics_reporter_android.cc
  82. metrics_reporter_android.h
  83. metrics_reporter_interface.h
  84. metrics_reporter_omaha.cc
  85. metrics_reporter_omaha.h
  86. metrics_reporter_omaha_unittest.cc
  87. metrics_reporter_stub.cc
  88. metrics_reporter_stub.h
  89. metrics_utils.cc
  90. metrics_utils.h
  91. metrics_utils_unittest.cc
  92. mock_certificate_checker.h
  93. mock_connection_manager.h
  94. mock_file_writer.h
  95. mock_metrics_reporter.h
  96. mock_omaha_request_params.h
  97. mock_p2p_manager.h
  98. mock_payload_state.h
  99. mock_power_manager.h
  100. mock_proxy_resolver.h
  101. mock_service_observer.h
  102. mock_update_attempter.h
  103. MODULE_LICENSE_APACHE2
  104. network_selector.h
  105. network_selector_android.cc
  106. network_selector_android.h
  107. network_selector_interface.h
  108. network_selector_stub.cc
  109. network_selector_stub.h
  110. NOTICE
  111. omaha_request_action.cc
  112. omaha_request_action.h
  113. omaha_request_action_unittest.cc
  114. omaha_request_params.cc
  115. omaha_request_params.h
  116. omaha_request_params_unittest.cc
  117. omaha_response.h
  118. omaha_response_handler_action.cc
  119. omaha_response_handler_action.h
  120. omaha_response_handler_action_unittest.cc
  121. omaha_utils.cc
  122. omaha_utils.h
  123. omaha_utils_unittest.cc
  124. OWNERS
  125. p2p_manager.cc
  126. p2p_manager.h
  127. p2p_manager_unittest.cc
  128. parcelable_update_engine_status.cc
  129. parcelable_update_engine_status.h
  130. parcelable_update_engine_status_unittest.cc
  131. payload_state.cc
  132. payload_state.h
  133. payload_state_interface.h
  134. payload_state_unittest.cc
  135. power_manager_android.cc
  136. power_manager_android.h
  137. power_manager_chromeos.cc
  138. power_manager_chromeos.h
  139. power_manager_interface.h
  140. PRESUBMIT.cfg
  141. PREUPLOAD.cfg
  142. proxy_resolver.cc
  143. proxy_resolver.h
  144. proxy_resolver_unittest.cc
  145. pylintrc
  146. real_system_state.cc
  147. real_system_state.h
  148. run_unittests
  149. sample_omaha_v3_response.xml
  150. service_delegate_android_interface.h
  151. service_observer_interface.h
  152. shill_proxy.cc
  153. shill_proxy.h
  154. shill_proxy_interface.h
  155. sideload_main.cc
  156. system_state.h
  157. tar_bunzip2.gypi
  158. test_http_server.cc
  159. test_subprocess.cc
  160. testrunner.cc
  161. unittest_key.pem
  162. unittest_key2.pem
  163. update_attempter.cc
  164. update_attempter.h
  165. update_attempter_android.cc
  166. update_attempter_android.h
  167. update_attempter_android_unittest.cc
  168. update_attempter_unittest.cc
  169. update_boot_flags_action.cc
  170. update_boot_flags_action.h
  171. update_boot_flags_action_unittest.cc
  172. update_engine-client.gyp
  173. update_engine.conf
  174. update_engine.gyp
  175. update_engine.rc
  176. update_engine_client.cc
  177. update_engine_client_android.cc
  178. update_metadata.proto
  179. update_status_utils.cc
  180. update_status_utils.h
  181. UpdateEngine.conf
  182. utils_android.cc
  183. utils_android.h