2012-01-20 07:23:00 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-05-21 15:12:37 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2012-01-20 07:23:00 +04:00
|
|
|
|
2013-09-11 03:03:56 +04:00
|
|
|
interface MozWakeLockListener;
|
2012-03-07 15:03:25 +04:00
|
|
|
|
2014-07-18 05:30:47 +04:00
|
|
|
/**
|
|
|
|
* The reason for the factory reset.
|
|
|
|
* "normal" : simple factory reset.
|
|
|
|
* "wipe" : will also attempt to wipe all user storage areas.
|
2014-11-26 14:46:00 +03:00
|
|
|
* "root" : simple factory reset that also root the phone to get more
|
|
|
|
* privileges when using devtools.
|
2014-07-18 05:30:47 +04:00
|
|
|
*/
|
|
|
|
enum FactoryResetReason {
|
|
|
|
"normal",
|
2014-11-26 14:46:00 +03:00
|
|
|
"wipe",
|
|
|
|
"root"
|
2014-07-18 05:30:47 +04:00
|
|
|
};
|
|
|
|
|
2012-03-07 15:03:25 +04:00
|
|
|
/**
|
|
|
|
* This interface implements navigator.mozPower
|
|
|
|
*/
|
2016-03-12 22:51:18 +03:00
|
|
|
[CheckAnyPermissions="power"]
|
2013-09-11 03:03:56 +04:00
|
|
|
interface MozPowerManager
|
2012-01-20 07:23:00 +04:00
|
|
|
{
|
2013-09-11 03:03:56 +04:00
|
|
|
[Throws]
|
2012-03-07 15:03:25 +04:00
|
|
|
void powerOff();
|
2013-09-11 03:03:56 +04:00
|
|
|
[Throws]
|
2012-03-07 15:03:25 +04:00
|
|
|
void reboot();
|
2014-07-18 05:30:47 +04:00
|
|
|
void factoryReset(optional FactoryResetReason reason = "normal");
|
2012-03-07 15:03:25 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The listeners are notified when a resource changes its lock state to:
|
|
|
|
* - unlocked
|
|
|
|
* - locked but not visible
|
|
|
|
* - locked and visible
|
|
|
|
*/
|
2013-09-11 03:03:56 +04:00
|
|
|
void addWakeLockListener(MozWakeLockListener aListener);
|
|
|
|
void removeWakeLockListener(MozWakeLockListener aListener);
|
2012-03-07 15:03:25 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Query the wake lock state of the topic.
|
|
|
|
*
|
|
|
|
* Possible states are:
|
|
|
|
*
|
|
|
|
* - "unlocked" - nobody holds the wake lock.
|
|
|
|
*
|
|
|
|
* - "locked-foreground" - at least one window holds the wake lock,
|
|
|
|
* and it is visible.
|
|
|
|
*
|
|
|
|
* - "locked-background" - at least one window holds the wake lock,
|
|
|
|
* but all of them are hidden.
|
|
|
|
*
|
|
|
|
* @param aTopic The resource name related to the wake lock.
|
|
|
|
*/
|
2013-09-11 03:03:56 +04:00
|
|
|
[Throws]
|
|
|
|
DOMString getWakeLockState(DOMString aTopic);
|
2012-04-03 09:51:00 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Is the device's screen currently enabled? This attribute controls the
|
|
|
|
* device's screen, so setting it to false will turn off the screen.
|
|
|
|
*/
|
|
|
|
attribute boolean screenEnabled;
|
|
|
|
|
|
|
|
/**
|
2014-05-30 07:11:23 +04:00
|
|
|
* Is the device's keypad/button backlight enabled? Setting it to false will
|
|
|
|
* turn off the device's keypad/button backlight. And the brightness level
|
|
|
|
* is the same as |screenBrightness|.
|
|
|
|
*/
|
|
|
|
attribute boolean keyLightEnabled;
|
|
|
|
|
|
|
|
/**
|
2012-04-03 09:51:00 +04:00
|
|
|
* How bright is the screen's backlight, on a scale from 0 (very dim) to 1
|
|
|
|
* (full brightness)? Setting this attribute modifies the screen's
|
|
|
|
* brightness.
|
|
|
|
*
|
|
|
|
* You can read and write this attribute even when the screen is disabled,
|
|
|
|
* but the backlight is off while the screen is disabled.
|
|
|
|
*
|
|
|
|
* If you write a value of X into this attribute, the attribute may not have
|
|
|
|
* the same value X when you later read it. Most screens don't support as
|
|
|
|
* many different brightness levels as there are doubles between 0 and 1, so
|
|
|
|
* we may reduce the value's precision before storing it.
|
|
|
|
*
|
|
|
|
* @throw NS_ERROR_INVALID_ARG if brightness is not in the range [0, 1].
|
|
|
|
*/
|
2013-09-11 03:03:56 +04:00
|
|
|
[SetterThrows]
|
2012-04-03 09:51:00 +04:00
|
|
|
attribute double screenBrightness;
|
2012-04-17 02:35:33 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Is it possible that the device's CPU will sleep after the screen is
|
|
|
|
* disabled? Setting this attribute to false will prevent the device
|
|
|
|
* entering suspend state.
|
|
|
|
*/
|
|
|
|
attribute boolean cpuSleepAllowed;
|
2012-01-20 07:23:00 +04:00
|
|
|
};
|