1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
   24
   25
   26
   27
   28
   29
   30
   31
   32
   33
   34
   35
   36
   37
   38
   39
   40
   41
   42
   43
   44
   45
   46
   47
   48
   49
   50
   51
   52
   53
   54
   55
   56
   57
   58
   59
   60
   61
   62
   63
   64
   65
   66
   67
   68
   69
   70
   71
   72
   73
   74
   75
   76
   77
   78
   79
   80
   81
   82
   83
   84
   85
   86
   87
   88
   89
   90
   91
   92
   93
   94
   95
   96
   97
   98
   99
  100
  101
  102
  103
  104
  105
  106
  107
  108
  109
  110
  111
  112
  113
  114
  115
  116
  117
  118
  119
  120
  121
  122
  123
  124
  125
  126
  127
  128
  129
  130
  131
  132
  133
  134
  135
  136
  137
  138
  139
  140
  141
  142
  143
  144
  145
  146
  147

ash / components / arc / mojom / power.mojom [blame]

// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// Next MinVersion: 11

module arc.mojom;

import "ash/components/arc/mojom/anr.mojom";

// Enumerates the modes of CPU restrictions.
// This enum should be synced with CpuRestrictionState in
// src/third_party/cros_system_api/dbus/vm_concierge/concierge_service.proto
[Extensible]
enum CpuRestrictionState {
  // The CPU usage is relaxed.
  CPU_RESTRICTION_FOREGROUND = 0,
  // The CPU usage is tightly restricted.
  CPU_RESTRICTION_BACKGROUND = 1,
};

// Enumerates the types of wake lock the ARC instance can request from the
// host.
[Extensible]
enum DisplayWakeLockType {
  // Does not allow the screen to dim, turn off, or lock; prevents
  // idle suspend.
  BRIGHT = 0,

  // Allows dimming the screen, but prevents it from turning off or locking.
  // Also prevents idle suspend.
  DIM = 1
};

// Enumerates the types of wakefullness modes.
// Must match to PowerManager.WAKEFULNESS_* constants.
[Extensible]
enum WakefulnessMode {
  // Device mode is unknown.
  UNKNOWN = -1,

  // The device is asleep.  It can only be awoken.
  // The device typically passes through the dozing state first.
  ASLEEP = 0,

  // The device is fully awake.  It can be put to sleep.
  // When the user activity timeout expires, the device may start dreaming
  // or go to sleep.
  AWAKE,

  // The device is dreaming.  It can be awoken which ends the dream.
  DREAMING,

  // The device is dozing.  It is almost asleep but is allowing a special
  // low-power "doze" dream to run which keeps the display on but lets the
  //  application processor be suspended.  It can be awoken which ends the
  // dream.The device fully goes to sleep if the dream cannot be started or
  // ends on its own.
  DOZING
};

// Enumerates the types of idle states.
[Extensible]
enum IdleState {
  // Device is active.
  [Default] ACTIVE = 0,
  // Device is inactive.
  INACTIVE = 1,
  // Device is force-inactive.
  FORCE_INACTIVE = 2
};

// Details about the current state of battery saver mode.
// This struct is a subset of BatterySaverModeState in
// system_api/dbus/power_manager/battery_saver.proto.
struct BatterySaverModeState {
  // The overall state of battery saver mode.
  bool active;
};

// Next method ID: 9
[Uuid="df491e4a-b035-4930-8351-6db499ef9247"]
interface PowerHost {
  // Acquire and release wake locks on the host side.
  OnAcquireDisplayWakeLock@0(DisplayWakeLockType type);
  OnReleaseDisplayWakeLock@1(DisplayWakeLockType type);

  // Notifies wakefulness mode is changed.
  [MinVersion=6] OnWakefulnessChanged@5(WakefulnessMode mode);

  // Checks if there is a display on.
  [MinVersion=1] IsDisplayOn@2() => (bool is_on);

  // Request that the screen brightness be changed to |percent|.
  // |percent| is of the range [0, 100]
  [MinVersion=3] OnScreenBrightnessUpdateRequest@3(double percent);

  // Notifies that the system is in pre-ANR mode. This means real ANR crash may
  // happen soon.
  [MinVersion=8] OnPreAnr@6(AnrType type);

  // Notifies that ANR recovery failed and ANR crash has happened.
  [MinVersion=8] OnAnrRecoveryFailed@7(AnrType type);

  // Gets the current state of ChromeOS battery saver mode.
  [MinVersion=9] GetBatterySaverModeState@8() => (BatterySaverModeState state);
};

// Deprecated method IDs: 0, 1
// Next method ID: 11
interface PowerInstance {
  // Establishes full-duplex communication with the host.
  [MinVersion=4] Init@5(pending_remote<PowerHost> host_remote) => ();

  // DEPRECATED: Use SetIdleState@10 instead.
  [MinVersion=1] SetInteractiveDeprecated@1(bool enabled);

  // Called when the system is about to suspend. The callback will be invoked
  // when pre-suspend work is complete.
  [MinVersion=2] Suspend@2() => ();

  // Called when the system has just resumed.
  [MinVersion=2] Resume@3();

  // Update Android brightness settings.
  // |percent| is of the range [0, 100]
  [MinVersion=3] UpdateScreenBrightnessSettings@4(double percent);

  // Called when the power supply information is updated.
  // TODO(b/136427446): Rearchitect ARC power info management with more
  // explicit data / event passing.
  [MinVersion=5] PowerSupplyInfoChanged@6();

  // Requests current wakefulness mode.
  [MinVersion=6] GetWakefulnessMode@7() => (WakefulnessMode mode);

  // Notifies that CPU restriction was changed. This message is sent from
  // Chrome in response to ARC CPU group is changed event. The destination
  // is ARC handler that resides in Android system server process.
  [MinVersion=7] OnCpuRestrictionChanged@8(CpuRestrictionState state);

  // Notifies that the state of ChromeOS battery saver mode is changed.
  [MinVersion=9] OnBatterySaverModeStateChanged@9(BatterySaverModeState state);

  // Set the idle state to the instance when host interactive status change.
  [MinVersion=10] SetIdleState@10(IdleState state);
};