1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 interface MozWakeLockListener;
9 * The reason for the factory reset.
10 * "normal" : simple factory reset.
11 * "wipe" : will also attempt to wipe all user storage areas.
13 enum FactoryResetReason {
19 * This interface implements navigator.mozPower
21 interface MozPowerManager
27 void factoryReset(optional FactoryResetReason reason = "normal");
30 * The listeners are notified when a resource changes its lock state to:
32 * - locked but not visible
33 * - locked and visible
35 void addWakeLockListener(MozWakeLockListener aListener);
36 void removeWakeLockListener(MozWakeLockListener aListener);
39 * Query the wake lock state of the topic.
41 * Possible states are:
43 * - "unlocked" - nobody holds the wake lock.
45 * - "locked-foreground" - at least one window holds the wake lock,
48 * - "locked-background" - at least one window holds the wake lock,
49 * but all of them are hidden.
51 * @param aTopic The resource name related to the wake lock.
54 DOMString getWakeLockState(DOMString aTopic);
57 * Is the device's screen currently enabled? This attribute controls the
58 * device's screen, so setting it to false will turn off the screen.
60 attribute boolean screenEnabled;
63 * Is the device's keypad/button backlight enabled? Setting it to false will
64 * turn off the device's keypad/button backlight. And the brightness level
65 * is the same as |screenBrightness|.
67 attribute boolean keyLightEnabled;
70 * How bright is the screen's backlight, on a scale from 0 (very dim) to 1
71 * (full brightness)? Setting this attribute modifies the screen's
74 * You can read and write this attribute even when the screen is disabled,
75 * but the backlight is off while the screen is disabled.
77 * If you write a value of X into this attribute, the attribute may not have
78 * the same value X when you later read it. Most screens don't support as
79 * many different brightness levels as there are doubles between 0 and 1, so
80 * we may reduce the value's precision before storing it.
82 * @throw NS_ERROR_INVALID_ARG if brightness is not in the range [0, 1].
85 attribute double screenBrightness;
88 * Is it possible that the device's CPU will sleep after the screen is
89 * disabled? Setting this attribute to false will prevent the device
90 * entering suspend state.
92 attribute boolean cpuSleepAllowed;