shill: defer resume actions until after completion of ongoing suspend actions

After powerd notifies shill that a suspend is imminent via a
SuspendImminent D-Bus signal, shill performs suspend actions, and then
upon the completion of these actions, notifies powerd that it's ready to
suspend via powerd's SuspendReadiness D-Bus method. Later, powerd
notifies that shill a suspend attempt is completed or cancelled via a
SuspendDone signal and shill performs resume actions.

However, powerd may notify shill the completion of a suspend attempt
before shill reports its readiness to suspend (e.g. when the suspend
attempt is cancelled while shill is performing the suspend actions).
It's problematic if shill performs the resume actions before it
completes the ongoing suspend actions. This CL addresses this problem by
deferring the actions taken in response to powerd's SuspendDone signal
if shill is still performing suspend actions and hasn't yet reported its
readiness to suspend.

BUG=chromium:789957
TEST=Run unit tests.
TEST=Run network_MobileSuspendResume test on a DUT with a modem.
TEST=Manually close the lid of a DUT and then quickly reopen the lid.
     Verify that shill performs resumes actions after completing suspend
     actions.

Change-Id: I97828c0ff7006816da7bba47a04a67742c269d8c
Reviewed-on: https://chromium-review.googlesource.com/800573
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Commit-Ready: Ben Chan <benchan@chromium.org>
Tested-by: Ben Chan <benchan@chromium.org>
Reviewed-by: Dan Erat <derat@chromium.org>
3 files changed
tree: d8162839f0eff6400dcd84561382f4207cd49ea7
  1. .gitignore
  2. HACKING
  3. MODULE_LICENSE_APACHE2
  4. NETLINK_MESSAGES.txt
  5. NOTICE
  6. OWNERS
  7. PRESUBMIT.cfg
  8. TESTING
  9. accessor_interface.h
  10. active_link_monitor.cc
  11. active_link_monitor.h
  12. active_link_monitor_unittest.cc
  13. adaptor_interfaces.h
  14. async_connection.cc
  15. async_connection.h
  16. async_connection_unittest.cc
  17. bin/
  18. callbacks.h
  19. cellular/
  20. certificate_file.cc
  21. certificate_file.h
  22. certificate_file_unittest.cc
  23. connection.cc
  24. connection.h
  25. connection_diagnostics.cc
  26. connection_diagnostics.h
  27. connection_diagnostics_unittest.cc
  28. connection_health_checker.cc
  29. connection_health_checker.h
  30. connection_health_checker_unittest.cc
  31. connection_info.cc
  32. connection_info.h
  33. connection_info_reader.cc
  34. connection_info_reader.h
  35. connection_info_reader_unittest.cc
  36. connection_info_unittest.cc
  37. connection_tester.cc
  38. connection_tester.h
  39. connection_tester_unittest.cc
  40. connection_unittest.cc
  41. connectivity_trial.cc
  42. connectivity_trial.h
  43. connectivity_trial_unittest.cc
  44. control_interface.h
  45. crypto_des_cbc.cc
  46. crypto_des_cbc.h
  47. crypto_des_cbc_unittest.cc
  48. crypto_interface.h
  49. crypto_provider.cc
  50. crypto_provider.h
  51. crypto_provider_unittest.cc
  52. crypto_rot47.cc
  53. crypto_rot47.h
  54. crypto_rot47_unittest.cc
  55. crypto_util_proxy.cc
  56. crypto_util_proxy.h
  57. crypto_util_proxy_unittest.cc
  58. daemon_task.cc
  59. daemon_task.h
  60. daemon_task_unittest.cc
  61. dbus/
  62. dbus_bindings/
  63. dbus_properties_proxy_interface.h
  64. default_profile.cc
  65. default_profile.h
  66. default_profile_unittest.cc
  67. device.cc
  68. device.h
  69. device_claimer.cc
  70. device_claimer.h
  71. device_claimer_unittest.cc
  72. device_id.cc
  73. device_id.h
  74. device_info.cc
  75. device_info.h
  76. device_info_unittest.cc
  77. device_stub.h
  78. device_unittest.cc
  79. dhcp/
  80. dns_client.cc
  81. dns_client.h
  82. dns_client_factory.cc
  83. dns_client_factory.h
  84. dns_client_unittest.cc
  85. dns_server_tester.cc
  86. dns_server_tester.h
  87. dns_server_tester_unittest.cc
  88. dns_util.cc
  89. dns_util.h
  90. dns_util_unittest.cc
  91. doc/
  92. eap_credentials.cc
  93. eap_credentials.h
  94. eap_credentials_unittest.cc
  95. eap_listener.cc
  96. eap_listener.h
  97. eap_listener_unittest.cc
  98. eap_protocol.h
  99. ephemeral_profile.cc
  100. ephemeral_profile.h
  101. error.cc
  102. error.h
  103. error_unittest.cc
  104. ethernet/
  105. event_dispatcher.cc
  106. event_dispatcher.h
  107. external_task.cc
  108. external_task.h
  109. external_task_unittest.cc
  110. fake_store.cc
  111. fake_store.h
  112. file_io.cc
  113. file_io.h
  114. file_reader.cc
  115. file_reader.h
  116. file_reader_unittest.cc
  117. geolocation_info.h
  118. hook_table.cc
  119. hook_table.h
  120. hook_table_unittest.cc
  121. http_request.cc
  122. http_request.h
  123. http_request_unittest.cc
  124. http_url.cc
  125. http_url.h
  126. http_url_unittest.cc
  127. icmp.cc
  128. icmp.h
  129. icmp_session.cc
  130. icmp_session.h
  131. icmp_session_factory.cc
  132. icmp_session_factory.h
  133. icmp_session_unittest.cc
  134. icmp_unittest.cc
  135. init/
  136. ip_address_store.cc
  137. ip_address_store.h
  138. ip_address_store_unittest.cc
  139. ipconfig.cc
  140. ipconfig.h
  141. ipconfig_unittest.cc
  142. json_store.cc
  143. json_store.h
  144. json_store_unittest.cc
  145. key_file_store.cc
  146. key_file_store.h
  147. key_file_store_unittest.cc
  148. key_value_store.cc
  149. key_value_store.h
  150. key_value_store_unittest.cc
  151. libshill-client-test.pc.in
  152. libshill-client.pc.in
  153. link_monitor.cc
  154. link_monitor.h
  155. link_monitor_unittest.cc
  156. logging.cc
  157. logging.h
  158. manager.cc
  159. manager.h
  160. manager_unittest.cc
  161. metrics.cc
  162. metrics.h
  163. metrics_unittest.cc
  164. mobile_operator_db/
  165. mock_active_link_monitor.cc
  166. mock_active_link_monitor.h
  167. mock_adaptors.cc
  168. mock_adaptors.h
  169. mock_ares.cc
  170. mock_ares.h
  171. mock_async_connection.cc
  172. mock_async_connection.h
  173. mock_certificate_file.cc
  174. mock_certificate_file.h
  175. mock_connection.cc
  176. mock_connection.h
  177. mock_connection_health_checker.cc
  178. mock_connection_health_checker.h
  179. mock_connection_info_reader.cc
  180. mock_connection_info_reader.h
  181. mock_connectivity_trial.cc
  182. mock_connectivity_trial.h
  183. mock_control.cc
  184. mock_control.h
  185. mock_crypto_util_proxy.cc
  186. mock_crypto_util_proxy.h
  187. mock_dbus_properties_proxy.cc
  188. mock_dbus_properties_proxy.h
  189. mock_device.cc
  190. mock_device.h
  191. mock_device_claimer.cc
  192. mock_device_claimer.h
  193. mock_device_info.cc
  194. mock_device_info.h
  195. mock_dns_client.cc
  196. mock_dns_client.h
  197. mock_dns_client_factory.cc
  198. mock_dns_client_factory.h
  199. mock_dns_server_tester.cc
  200. mock_dns_server_tester.h
  201. mock_eap_credentials.cc
  202. mock_eap_credentials.h
  203. mock_eap_listener.cc
  204. mock_eap_listener.h
  205. mock_event_dispatcher.cc
  206. mock_event_dispatcher.h
  207. mock_external_task.cc
  208. mock_external_task.h
  209. mock_file_io.h
  210. mock_http_request.cc
  211. mock_http_request.h
  212. mock_icmp.cc
  213. mock_icmp.h
  214. mock_icmp_session.cc
  215. mock_icmp_session.h
  216. mock_icmp_session_factory.cc
  217. mock_icmp_session_factory.h
  218. mock_ip_address_store.cc
  219. mock_ip_address_store.h
  220. mock_ipconfig.cc
  221. mock_ipconfig.h
  222. mock_link_monitor.cc
  223. mock_link_monitor.h
  224. mock_log.cc
  225. mock_log.h
  226. mock_log_unittest.cc
  227. mock_manager.cc
  228. mock_manager.h
  229. mock_metrics.cc
  230. mock_metrics.h
  231. mock_passive_link_monitor.cc
  232. mock_passive_link_monitor.h
  233. mock_pending_activation_store.cc
  234. mock_pending_activation_store.h
  235. mock_portal_detector.cc
  236. mock_portal_detector.h
  237. mock_power_manager.cc
  238. mock_power_manager.h
  239. mock_power_manager_proxy.cc
  240. mock_power_manager_proxy.h
  241. mock_ppp_device.cc
  242. mock_ppp_device.h
  243. mock_ppp_device_factory.cc
  244. mock_ppp_device_factory.h
  245. mock_process_manager.cc
  246. mock_process_manager.h
  247. mock_profile.cc
  248. mock_profile.h
  249. mock_property_store.cc
  250. mock_property_store.h
  251. mock_resolver.cc
  252. mock_resolver.h
  253. mock_routing_table.cc
  254. mock_routing_table.h
  255. mock_service.cc
  256. mock_service.h
  257. mock_socket_info_reader.cc
  258. mock_socket_info_reader.h
  259. mock_store.cc
  260. mock_store.h
  261. mock_throttler.cc
  262. mock_throttler.h
  263. mock_traffic_monitor.cc
  264. mock_traffic_monitor.h
  265. mock_virtual_device.cc
  266. mock_virtual_device.h
  267. net/
  268. nice_mock_control.cc
  269. nice_mock_control.h
  270. passive_link_monitor.cc
  271. passive_link_monitor.h
  272. passive_link_monitor_unittest.cc
  273. pending_activation_store.cc
  274. pending_activation_store.h
  275. pending_activation_store_unittest.cc
  276. portal_detector.cc
  277. portal_detector.h
  278. portal_detector_unittest.cc
  279. power_manager.cc
  280. power_manager.h
  281. power_manager_proxy_interface.h
  282. power_manager_unittest.cc
  283. ppp_daemon.cc
  284. ppp_daemon.h
  285. ppp_daemon_unittest.cc
  286. ppp_device.cc
  287. ppp_device.h
  288. ppp_device_factory.cc
  289. ppp_device_factory.h
  290. ppp_device_unittest.cc
  291. pppoe/
  292. process_manager.cc
  293. process_manager.h
  294. process_manager_unittest.cc
  295. profile.cc
  296. profile.h
  297. profile_unittest.cc
  298. property_accessor.h
  299. property_accessor_unittest.cc
  300. property_iterator.h
  301. property_store.cc
  302. property_store.h
  303. property_store_unittest.cc
  304. property_store_unittest.h
  305. protobuf_lite_streams.cc
  306. protobuf_lite_streams.h
  307. provider_db_unittest.bfd
  308. provider_interface.h
  309. refptr_types.h
  310. resolver.cc
  311. resolver.h
  312. resolver_unittest.cc
  313. result_aggregator.cc
  314. result_aggregator.h
  315. result_aggregator_unittest.cc
  316. routing_table.cc
  317. routing_table.h
  318. routing_table_entry.h
  319. routing_table_unittest.cc
  320. rpc_service_watcher_interface.h
  321. rpc_task.cc
  322. rpc_task.h
  323. rpc_task_unittest.cc
  324. scope_logger.cc
  325. scope_logger.h
  326. scope_logger_unittest.cc
  327. scoped_umask.cc
  328. scoped_umask.h
  329. service.cc
  330. service.h
  331. service_property_change_test.cc
  332. service_property_change_test.h
  333. service_sorter.h
  334. service_under_test.cc
  335. service_under_test.h
  336. service_unittest.cc
  337. setup_wifi/
  338. shill-client.gyp
  339. shill.gyp
  340. shill.gypi
  341. shill_ares.cc
  342. shill_ares.h
  343. shill_config.cc
  344. shill_config.h
  345. shill_daemon.cc
  346. shill_daemon.h
  347. shill_main.cc
  348. shill_test_config.cc
  349. shill_test_config.h
  350. shims/
  351. socket_info.cc
  352. socket_info.h
  353. socket_info_reader.cc
  354. socket_info_reader.h
  355. socket_info_reader_unittest.cc
  356. socket_info_unittest.cc
  357. static_ip_parameters.cc
  358. static_ip_parameters.h
  359. static_ip_parameters_unittest.cc
  360. store_interface.h
  361. stub_storage.h
  362. supplicant/
  363. technology.cc
  364. technology.h
  365. technology_unittest.cc
  366. test-scripts/
  367. test_event_dispatcher.h
  368. testing.h
  369. testrunner.cc
  370. tethering.cc
  371. tethering.h
  372. throttler.cc
  373. throttler.h
  374. throttler_unittest.cc
  375. traffic_monitor.cc
  376. traffic_monitor.h
  377. traffic_monitor_unittest.cc
  378. udev/
  379. upstart/
  380. virtual_device.cc
  381. virtual_device.h
  382. virtual_device_unittest.cc
  383. vpn/
  384. wifi/
  385. wimax/