GoogleGit

blob: 4e4594c6796402301552e4b9ce993b3dec978e02 [file] [log] [blame]
  1. // Copyright 2014 The Chromium OS Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. syntax = "proto2";
  5. option optimize_for = LITE_RUNTIME;
  6. package power_manager;
  7. // Included in powerd's SuspendImminent signal, sent when the system is about to
  8. // suspend. If any clients previously called RegisterSuspendDelay, suspending
  9. // will be deferred until they've called powerd's HandleSuspendReadiness method.
  10. //
  11. // The general flow is as follows:
  12. //
  13. // 1. A client that needs to perform some work before the system can be
  14. // suspended listens for SuspendImminent and SuspendDone signals from powerd.
  15. // 2. The client passes a RegisterSuspendDelayRequest message to powerd's
  16. // RegisterSuspendDelay method and receives a RegisterSuspendDelayReply
  17. // message in response. The client saves the |delay_id| field from the
  18. // response.
  19. // 3. When the power manager is about to suspend the system, it emits a
  20. // SuspendImminent signal containing a SuspendImminent message.
  21. // 4. Upon receipt of the signal, the client performs any last minute work
  22. // that it needs to do and then calls powerd's HandleSuspendReadiness method,
  23. // including a SuspendReadinessInfo message with its |delay_id| and the
  24. // |suspend_id| field from the SuspendImminent signal.
  25. // 5. Once powerd has received notification that all registered clients are
  26. // ready to suspend, the system will be suspended. If the initial suspend
  27. // attempt fails, it will be retried automatically, but additional
  28. // SuspendImminent signals will not be emitted.
  29. // 6. After the suspend request is complete, powerd emits a SuspendDone signal
  30. // containing a SuspendDone message. The client should undo any pre-suspend
  31. // work that was done in response to the SuspendImminent signal.
  32. // 7. Before the client exits, it calls UnregisterSuspendDelayRequest with a
  33. // UnregisterSuspendDelayRequest message containing its delay ID.
  34. message SuspendImminent {
  35. // Next ID to use: 2
  36. // Unique ID corresponding to this suspend request. This is included in the
  37. // SuspendReadinessInfo message passed via HandleSuspendReadiness.
  38. optional int32 suspend_id = 1;
  39. }
  40. // Included in powerd's SuspendDone signal, sent after the system has completed
  41. // a suspend request. Each SuspendImminent signal will be followed by a
  42. // SuspendDone signal.
  43. message SuspendDone {
  44. // Next ID to use: 3
  45. // Unique ID corresponding to the suspend request.
  46. optional int32 suspend_id = 1;
  47. // Wall time that the system was suspended, as given by
  48. // base::TimeDelta::ToInternalValue().
  49. optional int64 suspend_duration = 2;
  50. }
  51. // Included in calls to powerd's RegisterSuspendDelay method.
  52. message RegisterSuspendDelayRequest {
  53. // Next ID to use: 3
  54. // Upper bound on the amount of time that the power manager will wait for this
  55. // client to call HandleSuspendReadiness before suspending the system, as
  56. // given by base::TimeDelta::ToInternalValue().
  57. optional int64 timeout = 1;
  58. // Human-readable description of the delay's purpose (e.g. the name of
  59. // the daemon that requested the delay). Only used for debugging.
  60. optional string description = 2;
  61. }
  62. // Included in responses to powerd's RegisterSuspendDelay method.
  63. message RegisterSuspendDelayReply {
  64. // Next ID to use: 2
  65. // Unique ID assigned to the client that registered this suspend delay. This
  66. // is included in later HandleSuspendReadiness and UnregisterSuspendDelay
  67. // calls.
  68. optional int32 delay_id = 1;
  69. }
  70. // Included in calls to powerd's UnregisterSuspendDelay method.
  71. message UnregisterSuspendDelayRequest {
  72. // Next ID to use: 2
  73. // ID that was returned in response to the original RegisterSuspendDelay call.
  74. optional int32 delay_id = 1;
  75. }
  76. // Included in calls to powerd's HandleSuspendReadiness method.
  77. message SuspendReadinessInfo {
  78. // Next ID to use: 3
  79. // ID that was returned to the client in response to its invocation of
  80. // RegisterSuspendDelay.
  81. optional int32 delay_id = 1;
  82. // ID that was included in the SuspendImminent signal that provoked this
  83. // readiness call.
  84. optional int32 suspend_id = 2;
  85. }
  86. // Included in calls to powerd's RecordDarkResumeWakeReason method.
  87. message DarkResumeWakeReason {
  88. // Next ID to use: 2
  89. // Wake reason that caused the current dark resume.
  90. optional string wake_reason = 1;
  91. }