Switch to use libdm to bind loop devices

This is a speculative fix of the flaky unit test. There used to be a
race condition when the test tries to find a free loop device and binds
to it. Switch to libdm in android to address the race.

In the local test, the device gets into a state where kernel fails to open
the loop device returned by LOOP_CTL_GET_FREE. This cl tries to prevent the
device from entering the erroneous state. Though it's not clear if the test
itself put the device into such state. It's still worth trying if there'is
less flakiness after this cl.

Bug: 145706147
Test: unit tests pass

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