2011-10-05 22:15:45 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2011-10-20 21:38:39 +00:00
|
|
|
/* vim: set sw=2 ts=8 et ft=cpp : */
|
2012-02-10 10:04:44 +00:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
2012-02-02 06:09:00 +00:00
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
2012-02-10 10:04:44 +00:00
|
|
|
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2011-10-05 22:15:45 +00:00
|
|
|
|
|
|
|
#include "Hal.h"
|
2012-12-22 11:53:38 +00:00
|
|
|
#include "mozilla/AppProcessChecker.h"
|
2011-10-05 22:15:45 +00:00
|
|
|
#include "mozilla/dom/ContentChild.h"
|
2013-06-03 10:14:37 +00:00
|
|
|
#include "mozilla/dom/ContentParent.h"
|
2011-10-05 22:15:45 +00:00
|
|
|
#include "mozilla/hal_sandbox/PHalChild.h"
|
|
|
|
#include "mozilla/hal_sandbox/PHalParent.h"
|
2011-09-30 07:00:48 +00:00
|
|
|
#include "mozilla/dom/TabParent.h"
|
|
|
|
#include "mozilla/dom/TabChild.h"
|
2011-11-02 15:14:01 +00:00
|
|
|
#include "mozilla/dom/battery/Types.h"
|
2012-01-16 13:39:57 +00:00
|
|
|
#include "mozilla/dom/network/Types.h"
|
2012-03-13 16:42:46 +00:00
|
|
|
#include "mozilla/dom/ScreenOrientation.h"
|
2011-11-02 15:14:01 +00:00
|
|
|
#include "mozilla/Observer.h"
|
|
|
|
#include "mozilla/unused.h"
|
2011-12-17 21:04:26 +00:00
|
|
|
#include "WindowIdentifier.h"
|
2011-10-05 22:15:45 +00:00
|
|
|
|
|
|
|
using namespace mozilla;
|
|
|
|
using namespace mozilla::dom;
|
|
|
|
using namespace mozilla::hal;
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace hal_sandbox {
|
|
|
|
|
2013-02-12 04:09:25 +00:00
|
|
|
static bool sHalChildDestroyed = false;
|
2012-10-07 01:53:22 +00:00
|
|
|
|
|
|
|
bool
|
2013-02-12 04:09:25 +00:00
|
|
|
HalChildDestroyed()
|
2012-10-07 01:53:22 +00:00
|
|
|
{
|
2013-02-12 04:09:25 +00:00
|
|
|
return sHalChildDestroyed;
|
2012-10-07 01:53:22 +00:00
|
|
|
}
|
|
|
|
|
2011-10-05 22:15:45 +00:00
|
|
|
static PHalChild* sHal;
|
|
|
|
static PHalChild*
|
|
|
|
Hal()
|
|
|
|
{
|
|
|
|
if (!sHal) {
|
|
|
|
sHal = ContentChild::GetSingleton()->SendPHalConstructor();
|
|
|
|
}
|
|
|
|
return sHal;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2012-05-25 07:18:30 +00:00
|
|
|
Vibrate(const nsTArray<uint32_t>& pattern, const WindowIdentifier &id)
|
2011-10-05 22:15:45 +00:00
|
|
|
{
|
2011-09-30 07:00:48 +00:00
|
|
|
HAL_LOG(("Vibrate: Sending to parent process."));
|
|
|
|
|
2012-05-25 07:18:30 +00:00
|
|
|
AutoInfallibleTArray<uint32_t, 8> p(pattern);
|
2011-09-30 07:00:48 +00:00
|
|
|
|
|
|
|
WindowIdentifier newID(id);
|
|
|
|
newID.AppendProcessID();
|
2013-09-12 19:24:11 +00:00
|
|
|
Hal()->SendVibrate(p, newID.AsArray(), TabChild::GetFrom(newID.GetWindow()));
|
2011-09-30 07:00:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
CancelVibrate(const WindowIdentifier &id)
|
|
|
|
{
|
|
|
|
HAL_LOG(("CancelVibrate: Sending to parent process."));
|
|
|
|
|
|
|
|
WindowIdentifier newID(id);
|
|
|
|
newID.AppendProcessID();
|
2013-09-12 19:24:11 +00:00
|
|
|
Hal()->SendCancelVibrate(newID.AsArray(), TabChild::GetFrom(newID.GetWindow()));
|
2011-10-05 22:15:45 +00:00
|
|
|
}
|
|
|
|
|
2011-11-02 15:14:01 +00:00
|
|
|
void
|
|
|
|
EnableBatteryNotifications()
|
|
|
|
{
|
|
|
|
Hal()->SendEnableBatteryNotifications();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
DisableBatteryNotifications()
|
|
|
|
{
|
|
|
|
Hal()->SendDisableBatteryNotifications();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
GetCurrentBatteryInformation(BatteryInformation* aBatteryInfo)
|
|
|
|
{
|
|
|
|
Hal()->SendGetCurrentBatteryInformation(aBatteryInfo);
|
|
|
|
}
|
|
|
|
|
2012-01-16 13:39:57 +00:00
|
|
|
void
|
|
|
|
EnableNetworkNotifications()
|
|
|
|
{
|
|
|
|
Hal()->SendEnableNetworkNotifications();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
DisableNetworkNotifications()
|
|
|
|
{
|
|
|
|
Hal()->SendDisableNetworkNotifications();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
GetCurrentNetworkInformation(NetworkInformation* aNetworkInfo)
|
|
|
|
{
|
|
|
|
Hal()->SendGetCurrentNetworkInformation(aNetworkInfo);
|
|
|
|
}
|
|
|
|
|
2012-03-13 16:42:46 +00:00
|
|
|
void
|
2012-05-08 21:36:07 +00:00
|
|
|
EnableScreenConfigurationNotifications()
|
2012-03-13 16:42:46 +00:00
|
|
|
{
|
2012-05-08 21:36:07 +00:00
|
|
|
Hal()->SendEnableScreenConfigurationNotifications();
|
2012-03-13 16:42:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2012-05-08 21:36:07 +00:00
|
|
|
DisableScreenConfigurationNotifications()
|
2012-03-13 16:42:46 +00:00
|
|
|
{
|
2012-05-08 21:36:07 +00:00
|
|
|
Hal()->SendDisableScreenConfigurationNotifications();
|
2012-03-13 16:42:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2012-05-08 21:36:07 +00:00
|
|
|
GetCurrentScreenConfiguration(ScreenConfiguration* aScreenConfiguration)
|
2012-03-13 16:42:46 +00:00
|
|
|
{
|
2012-05-08 21:36:07 +00:00
|
|
|
Hal()->SendGetCurrentScreenConfiguration(aScreenConfiguration);
|
2012-03-13 16:42:46 +00:00
|
|
|
}
|
|
|
|
|
2012-03-29 19:43:16 +00:00
|
|
|
bool
|
|
|
|
LockScreenOrientation(const dom::ScreenOrientation& aOrientation)
|
|
|
|
{
|
|
|
|
bool allowed;
|
|
|
|
Hal()->SendLockScreenOrientation(aOrientation, &allowed);
|
|
|
|
return allowed;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
UnlockScreenOrientation()
|
|
|
|
{
|
|
|
|
Hal()->SendUnlockScreenOrientation();
|
|
|
|
}
|
|
|
|
|
2011-12-04 17:07:00 +00:00
|
|
|
bool
|
|
|
|
GetScreenEnabled()
|
|
|
|
{
|
|
|
|
bool enabled = false;
|
|
|
|
Hal()->SendGetScreenEnabled(&enabled);
|
|
|
|
return enabled;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
SetScreenEnabled(bool enabled)
|
|
|
|
{
|
|
|
|
Hal()->SendSetScreenEnabled(enabled);
|
|
|
|
}
|
|
|
|
|
2012-04-16 22:35:33 +00:00
|
|
|
bool
|
|
|
|
GetCpuSleepAllowed()
|
|
|
|
{
|
|
|
|
bool allowed = true;
|
|
|
|
Hal()->SendGetCpuSleepAllowed(&allowed);
|
|
|
|
return allowed;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
SetCpuSleepAllowed(bool allowed)
|
|
|
|
{
|
|
|
|
Hal()->SendSetCpuSleepAllowed(allowed);
|
|
|
|
}
|
|
|
|
|
2011-12-04 17:07:00 +00:00
|
|
|
double
|
|
|
|
GetScreenBrightness()
|
|
|
|
{
|
|
|
|
double brightness = 0;
|
|
|
|
Hal()->SendGetScreenBrightness(&brightness);
|
|
|
|
return brightness;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
SetScreenBrightness(double brightness)
|
|
|
|
{
|
|
|
|
Hal()->SendSetScreenBrightness(brightness);
|
|
|
|
}
|
|
|
|
|
2012-02-02 06:09:00 +00:00
|
|
|
bool
|
|
|
|
SetLight(hal::LightType light, const hal::LightConfiguration& aConfig)
|
|
|
|
{
|
|
|
|
bool status;
|
|
|
|
Hal()->SendSetLight(light, aConfig, &status);
|
|
|
|
return status;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
GetLight(hal::LightType light, hal::LightConfiguration* aConfig)
|
|
|
|
{
|
|
|
|
bool status;
|
|
|
|
Hal()->SendGetLight(light, aConfig, &status);
|
|
|
|
return status;
|
|
|
|
}
|
|
|
|
|
2012-02-17 10:44:00 +00:00
|
|
|
void
|
2012-09-26 03:51:29 +00:00
|
|
|
AdjustSystemClock(int64_t aDeltaMilliseconds)
|
2012-02-17 10:44:00 +00:00
|
|
|
{
|
|
|
|
Hal()->SendAdjustSystemClock(aDeltaMilliseconds);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
SetTimezone(const nsCString& aTimezoneSpec)
|
|
|
|
{
|
|
|
|
Hal()->SendSetTimezone(nsCString(aTimezoneSpec));
|
|
|
|
}
|
|
|
|
|
2012-08-23 09:00:00 +00:00
|
|
|
nsCString
|
|
|
|
GetTimezone()
|
|
|
|
{
|
|
|
|
nsCString timezone;
|
|
|
|
Hal()->SendGetTimezone(&timezone);
|
|
|
|
return timezone;
|
|
|
|
}
|
|
|
|
|
2013-10-15 08:43:53 +00:00
|
|
|
int32_t
|
|
|
|
GetTimezoneOffset()
|
|
|
|
{
|
|
|
|
int32_t timezoneOffset;
|
|
|
|
Hal()->SendGetTimezoneOffset(&timezoneOffset);
|
|
|
|
return timezoneOffset;
|
|
|
|
}
|
|
|
|
|
2012-09-23 17:00:32 +00:00
|
|
|
void
|
2012-10-23 07:15:43 +00:00
|
|
|
EnableSystemClockChangeNotifications()
|
2012-09-23 17:00:32 +00:00
|
|
|
{
|
2012-10-23 07:15:43 +00:00
|
|
|
Hal()->SendEnableSystemClockChangeNotifications();
|
2012-09-23 17:00:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2012-10-23 07:15:43 +00:00
|
|
|
DisableSystemClockChangeNotifications()
|
2012-09-23 17:00:32 +00:00
|
|
|
{
|
2012-10-23 07:15:43 +00:00
|
|
|
Hal()->SendDisableSystemClockChangeNotifications();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
EnableSystemTimezoneChangeNotifications()
|
|
|
|
{
|
|
|
|
Hal()->SendEnableSystemTimezoneChangeNotifications();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
DisableSystemTimezoneChangeNotifications()
|
|
|
|
{
|
|
|
|
Hal()->SendDisableSystemTimezoneChangeNotifications();
|
2012-09-23 17:00:32 +00:00
|
|
|
}
|
|
|
|
|
2012-01-31 06:08:00 +00:00
|
|
|
void
|
|
|
|
Reboot()
|
|
|
|
{
|
2012-09-26 09:12:33 +00:00
|
|
|
NS_RUNTIMEABORT("Reboot() can't be called from sandboxed contexts.");
|
2012-01-31 06:08:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
PowerOff()
|
|
|
|
{
|
2012-09-26 09:12:33 +00:00
|
|
|
NS_RUNTIMEABORT("PowerOff() can't be called from sandboxed contexts.");
|
2012-01-31 06:08:00 +00:00
|
|
|
}
|
|
|
|
|
2012-10-02 07:26:32 +00:00
|
|
|
void
|
|
|
|
StartForceQuitWatchdog(ShutdownMode aMode, int32_t aTimeoutSecs)
|
|
|
|
{
|
|
|
|
NS_RUNTIMEABORT("StartForceQuitWatchdog() can't be called from sandboxed contexts.");
|
|
|
|
}
|
|
|
|
|
2012-02-05 19:51:06 +00:00
|
|
|
void
|
|
|
|
EnableSensorNotifications(SensorType aSensor) {
|
|
|
|
Hal()->SendEnableSensorNotifications(aSensor);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
DisableSensorNotifications(SensorType aSensor) {
|
|
|
|
Hal()->SendDisableSensorNotifications(aSensor);
|
|
|
|
}
|
|
|
|
|
2011-08-03 18:12:08 +00:00
|
|
|
//TODO: bug 852944 - IPC implementations of these
|
|
|
|
void StartMonitoringGamepadStatus()
|
|
|
|
{}
|
|
|
|
|
|
|
|
void StopMonitoringGamepadStatus()
|
|
|
|
{}
|
|
|
|
|
2012-03-07 11:03:25 +00:00
|
|
|
void
|
|
|
|
EnableWakeLockNotifications()
|
|
|
|
{
|
|
|
|
Hal()->SendEnableWakeLockNotifications();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
DisableWakeLockNotifications()
|
|
|
|
{
|
|
|
|
Hal()->SendDisableWakeLockNotifications();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2013-02-14 20:41:30 +00:00
|
|
|
ModifyWakeLock(const nsAString &aTopic,
|
|
|
|
WakeLockControl aLockAdjust,
|
|
|
|
WakeLockControl aHiddenAdjust,
|
|
|
|
uint64_t aProcessID)
|
2012-03-07 11:03:25 +00:00
|
|
|
{
|
2013-02-14 20:41:30 +00:00
|
|
|
MOZ_ASSERT(aProcessID != CONTENT_PROCESS_ID_UNKNOWN);
|
2012-11-17 15:05:18 +00:00
|
|
|
Hal()->SendModifyWakeLock(nsString(aTopic), aLockAdjust, aHiddenAdjust, aProcessID);
|
2012-03-07 11:03:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
GetWakeLockInfo(const nsAString &aTopic, WakeLockInformation *aWakeLockInfo)
|
|
|
|
{
|
|
|
|
Hal()->SendGetWakeLockInfo(nsString(aTopic), aWakeLockInfo);
|
|
|
|
}
|
|
|
|
|
2012-04-22 18:09:22 +00:00
|
|
|
void
|
|
|
|
EnableSwitchNotifications(SwitchDevice aDevice)
|
|
|
|
{
|
|
|
|
Hal()->SendEnableSwitchNotifications(aDevice);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
DisableSwitchNotifications(SwitchDevice aDevice)
|
|
|
|
{
|
|
|
|
Hal()->SendDisableSwitchNotifications(aDevice);
|
|
|
|
}
|
|
|
|
|
|
|
|
SwitchState
|
|
|
|
GetCurrentSwitchState(SwitchDevice aDevice)
|
|
|
|
{
|
|
|
|
SwitchState state;
|
|
|
|
Hal()->SendGetCurrentSwitchState(aDevice, &state);
|
|
|
|
return state;
|
|
|
|
}
|
|
|
|
|
2012-07-06 10:42:10 +00:00
|
|
|
bool
|
|
|
|
EnableAlarm()
|
|
|
|
{
|
|
|
|
NS_RUNTIMEABORT("Alarms can't be programmed from sandboxed contexts. Yet.");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
DisableAlarm()
|
|
|
|
{
|
|
|
|
NS_RUNTIMEABORT("Alarms can't be programmed from sandboxed contexts. Yet.");
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
2012-08-22 15:56:38 +00:00
|
|
|
SetAlarm(int32_t aSeconds, int32_t aNanoseconds)
|
2012-07-06 10:42:10 +00:00
|
|
|
{
|
|
|
|
NS_RUNTIMEABORT("Alarms can't be programmed from sandboxed contexts. Yet.");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2012-08-05 05:09:39 +00:00
|
|
|
void
|
2013-05-09 20:27:06 +00:00
|
|
|
SetProcessPriority(int aPid,
|
|
|
|
ProcessPriority aPriority,
|
2013-10-01 03:54:59 +00:00
|
|
|
ProcessCPUPriority aCPUPriority,
|
|
|
|
uint32_t aBackgroundLRU)
|
2012-08-05 05:09:39 +00:00
|
|
|
{
|
2013-05-09 20:27:06 +00:00
|
|
|
NS_RUNTIMEABORT("Only the main process may set processes' priorities.");
|
2012-08-05 05:09:39 +00:00
|
|
|
}
|
|
|
|
|
2012-09-19 15:17:13 +00:00
|
|
|
void
|
|
|
|
EnableFMRadio(const hal::FMRadioSettings& aSettings)
|
|
|
|
{
|
2012-12-04 16:57:31 +00:00
|
|
|
NS_RUNTIMEABORT("FM radio cannot be called from sandboxed contexts.");
|
2012-09-19 15:17:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
DisableFMRadio()
|
|
|
|
{
|
2012-12-04 16:57:31 +00:00
|
|
|
NS_RUNTIMEABORT("FM radio cannot be called from sandboxed contexts.");
|
2012-09-19 15:17:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
FMRadioSeek(const hal::FMRadioSeekDirection& aDirection)
|
|
|
|
{
|
2012-12-04 16:57:31 +00:00
|
|
|
NS_RUNTIMEABORT("FM radio cannot be called from sandboxed contexts.");
|
2012-09-19 15:17:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
GetFMRadioSettings(FMRadioSettings* aSettings)
|
|
|
|
{
|
2012-12-04 16:57:31 +00:00
|
|
|
NS_RUNTIMEABORT("FM radio cannot be called from sandboxed contexts.");
|
2012-09-19 15:17:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
SetFMRadioFrequency(const uint32_t aFrequency)
|
|
|
|
{
|
2012-12-04 16:57:31 +00:00
|
|
|
NS_RUNTIMEABORT("FM radio cannot be called from sandboxed contexts.");
|
2012-09-19 15:17:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
uint32_t
|
|
|
|
GetFMRadioFrequency()
|
|
|
|
{
|
2012-12-04 16:57:31 +00:00
|
|
|
NS_RUNTIMEABORT("FM radio cannot be called from sandboxed contexts.");
|
|
|
|
return 0;
|
2012-09-19 15:17:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
IsFMRadioOn()
|
|
|
|
{
|
2012-12-04 16:57:31 +00:00
|
|
|
NS_RUNTIMEABORT("FM radio cannot be called from sandboxed contexts.");
|
|
|
|
return false;
|
2012-09-19 15:17:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
uint32_t
|
|
|
|
GetFMRadioSignalStrength()
|
|
|
|
{
|
2012-12-04 16:57:31 +00:00
|
|
|
NS_RUNTIMEABORT("FM radio cannot be called from sandboxed contexts.");
|
|
|
|
return 0;
|
2012-09-19 15:17:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
CancelFMRadioSeek()
|
|
|
|
{
|
2012-12-04 16:57:31 +00:00
|
|
|
NS_RUNTIMEABORT("FM radio cannot be called from sandboxed contexts.");
|
2012-09-19 15:17:13 +00:00
|
|
|
}
|
|
|
|
|
2012-10-04 09:28:34 +00:00
|
|
|
void
|
|
|
|
FactoryReset()
|
|
|
|
{
|
|
|
|
Hal()->SendFactoryReset();
|
|
|
|
}
|
|
|
|
|
2013-05-09 22:57:31 +00:00
|
|
|
void
|
|
|
|
StartDiskSpaceWatcher()
|
|
|
|
{
|
|
|
|
NS_RUNTIMEABORT("StartDiskSpaceWatcher() can't be called from sandboxed contexts.");
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
StopDiskSpaceWatcher()
|
|
|
|
{
|
|
|
|
NS_RUNTIMEABORT("StopDiskSpaceWatcher() can't be called from sandboxed contexts.");
|
|
|
|
}
|
|
|
|
|
2011-11-02 15:14:01 +00:00
|
|
|
class HalParent : public PHalParent
|
2012-01-16 13:39:57 +00:00
|
|
|
, public BatteryObserver
|
|
|
|
, public NetworkObserver
|
2012-02-05 19:51:06 +00:00
|
|
|
, public ISensorObserver
|
2012-03-07 11:03:25 +00:00
|
|
|
, public WakeLockObserver
|
2012-05-08 21:36:07 +00:00
|
|
|
, public ScreenConfigurationObserver
|
2012-04-22 18:09:22 +00:00
|
|
|
, public SwitchObserver
|
2012-10-23 07:15:43 +00:00
|
|
|
, public SystemClockChangeObserver
|
|
|
|
, public SystemTimezoneChangeObserver
|
2012-01-16 13:39:57 +00:00
|
|
|
{
|
2011-10-05 22:15:45 +00:00
|
|
|
public:
|
2012-09-06 21:58:36 +00:00
|
|
|
virtual void
|
|
|
|
ActorDestroy(ActorDestroyReason aWhy) MOZ_OVERRIDE
|
|
|
|
{
|
|
|
|
// NB: you *must* unconditionally unregister your observer here,
|
|
|
|
// if it *may* be registered below.
|
|
|
|
hal::UnregisterBatteryObserver(this);
|
|
|
|
hal::UnregisterNetworkObserver(this);
|
|
|
|
hal::UnregisterScreenConfigurationObserver(this);
|
|
|
|
for (int32_t sensor = SENSOR_UNKNOWN + 1;
|
|
|
|
sensor < NUM_SENSOR_TYPE; ++sensor) {
|
|
|
|
hal::UnregisterSensorObserver(SensorType(sensor), this);
|
|
|
|
}
|
|
|
|
hal::UnregisterWakeLockObserver(this);
|
2012-10-23 07:15:43 +00:00
|
|
|
hal::UnregisterSystemClockChangeObserver(this);
|
|
|
|
hal::UnregisterSystemTimezoneChangeObserver(this);
|
2012-12-21 08:37:58 +00:00
|
|
|
for (int32_t switchDevice = SWITCH_DEVICE_UNKNOWN + 1;
|
|
|
|
switchDevice < NUM_SWITCH_DEVICE; ++switchDevice) {
|
|
|
|
hal::UnregisterSwitchObserver(SwitchDevice(switchDevice), this);
|
|
|
|
}
|
2012-09-06 21:58:36 +00:00
|
|
|
}
|
|
|
|
|
2012-07-06 18:15:45 +00:00
|
|
|
virtual bool
|
2011-09-30 07:00:48 +00:00
|
|
|
RecvVibrate(const InfallibleTArray<unsigned int>& pattern,
|
2012-05-25 07:18:30 +00:00
|
|
|
const InfallibleTArray<uint64_t> &id,
|
2012-07-06 18:15:45 +00:00
|
|
|
PBrowserParent *browserParent) MOZ_OVERRIDE
|
2011-09-30 07:00:48 +00:00
|
|
|
{
|
2012-08-16 19:34:53 +00:00
|
|
|
// We give all content vibration permission.
|
2011-09-30 07:00:48 +00:00
|
|
|
TabParent *tabParent = static_cast<TabParent*>(browserParent);
|
|
|
|
nsCOMPtr<nsIDOMWindow> window =
|
|
|
|
do_QueryInterface(tabParent->GetBrowserDOMWindow());
|
|
|
|
WindowIdentifier newID(id, window);
|
2012-12-19 01:16:06 +00:00
|
|
|
hal::Vibrate(pattern, newID);
|
2011-09-30 07:00:48 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2012-07-06 18:15:45 +00:00
|
|
|
virtual bool
|
2012-05-25 07:18:30 +00:00
|
|
|
RecvCancelVibrate(const InfallibleTArray<uint64_t> &id,
|
2012-07-06 18:15:45 +00:00
|
|
|
PBrowserParent *browserParent) MOZ_OVERRIDE
|
2011-09-30 07:00:48 +00:00
|
|
|
{
|
|
|
|
TabParent *tabParent = static_cast<TabParent*>(browserParent);
|
|
|
|
nsCOMPtr<nsIDOMWindow> window =
|
|
|
|
do_QueryInterface(tabParent->GetBrowserDOMWindow());
|
|
|
|
WindowIdentifier newID(id, window);
|
|
|
|
hal::CancelVibrate(newID);
|
2011-10-05 22:15:45 +00:00
|
|
|
return true;
|
|
|
|
}
|
2011-11-02 15:14:01 +00:00
|
|
|
|
2012-07-06 18:15:45 +00:00
|
|
|
virtual bool
|
|
|
|
RecvEnableBatteryNotifications() MOZ_OVERRIDE {
|
2012-08-16 19:34:53 +00:00
|
|
|
// We give all content battery-status permission.
|
2011-11-02 15:14:01 +00:00
|
|
|
hal::RegisterBatteryObserver(this);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2012-07-06 18:15:45 +00:00
|
|
|
virtual bool
|
|
|
|
RecvDisableBatteryNotifications() MOZ_OVERRIDE {
|
2011-11-02 15:14:01 +00:00
|
|
|
hal::UnregisterBatteryObserver(this);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2012-07-06 18:15:45 +00:00
|
|
|
virtual bool
|
|
|
|
RecvGetCurrentBatteryInformation(BatteryInformation* aBatteryInfo) MOZ_OVERRIDE {
|
2012-08-16 19:34:53 +00:00
|
|
|
// We give all content battery-status permission.
|
2011-11-02 15:14:01 +00:00
|
|
|
hal::GetCurrentBatteryInformation(aBatteryInfo);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2012-07-06 18:15:45 +00:00
|
|
|
void Notify(const BatteryInformation& aBatteryInfo) MOZ_OVERRIDE {
|
2011-11-02 15:14:01 +00:00
|
|
|
unused << SendNotifyBatteryChange(aBatteryInfo);
|
|
|
|
}
|
2011-12-04 17:07:00 +00:00
|
|
|
|
2012-07-06 18:15:45 +00:00
|
|
|
virtual bool
|
|
|
|
RecvEnableNetworkNotifications() MOZ_OVERRIDE {
|
2012-08-16 19:34:53 +00:00
|
|
|
// We give all content access to this network-status information.
|
2012-01-16 13:39:57 +00:00
|
|
|
hal::RegisterNetworkObserver(this);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2012-07-06 18:15:45 +00:00
|
|
|
virtual bool
|
|
|
|
RecvDisableNetworkNotifications() MOZ_OVERRIDE {
|
2012-01-16 13:39:57 +00:00
|
|
|
hal::UnregisterNetworkObserver(this);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2012-07-06 18:15:45 +00:00
|
|
|
virtual bool
|
|
|
|
RecvGetCurrentNetworkInformation(NetworkInformation* aNetworkInfo) MOZ_OVERRIDE {
|
2012-01-16 13:39:57 +00:00
|
|
|
hal::GetCurrentNetworkInformation(aNetworkInfo);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Notify(const NetworkInformation& aNetworkInfo) {
|
|
|
|
unused << SendNotifyNetworkChange(aNetworkInfo);
|
|
|
|
}
|
|
|
|
|
2012-07-06 18:15:45 +00:00
|
|
|
virtual bool
|
|
|
|
RecvEnableScreenConfigurationNotifications() MOZ_OVERRIDE {
|
2012-08-16 19:34:53 +00:00
|
|
|
// Screen configuration is used to implement CSS and DOM
|
|
|
|
// properties, so all content already has access to this.
|
2012-05-08 21:36:07 +00:00
|
|
|
hal::RegisterScreenConfigurationObserver(this);
|
2012-03-13 16:42:46 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2012-07-06 18:15:45 +00:00
|
|
|
virtual bool
|
|
|
|
RecvDisableScreenConfigurationNotifications() MOZ_OVERRIDE {
|
2012-05-08 21:36:07 +00:00
|
|
|
hal::UnregisterScreenConfigurationObserver(this);
|
2012-03-13 16:42:46 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2012-07-06 18:15:45 +00:00
|
|
|
virtual bool
|
|
|
|
RecvGetCurrentScreenConfiguration(ScreenConfiguration* aScreenConfiguration) MOZ_OVERRIDE {
|
2012-05-08 21:36:07 +00:00
|
|
|
hal::GetCurrentScreenConfiguration(aScreenConfiguration);
|
2012-03-13 16:42:46 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2012-07-06 18:15:45 +00:00
|
|
|
virtual bool
|
|
|
|
RecvLockScreenOrientation(const dom::ScreenOrientation& aOrientation, bool* aAllowed) MOZ_OVERRIDE
|
2012-03-29 19:43:16 +00:00
|
|
|
{
|
2012-08-16 19:34:53 +00:00
|
|
|
// FIXME/bug 777980: unprivileged content may only lock
|
|
|
|
// orientation while fullscreen. We should check whether the
|
|
|
|
// request comes from an actor in a process that might be
|
|
|
|
// fullscreen. We don't have that information currently.
|
2012-03-29 19:43:16 +00:00
|
|
|
*aAllowed = hal::LockScreenOrientation(aOrientation);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2012-07-06 18:15:45 +00:00
|
|
|
virtual bool
|
|
|
|
RecvUnlockScreenOrientation() MOZ_OVERRIDE
|
2012-03-29 19:43:16 +00:00
|
|
|
{
|
|
|
|
hal::UnlockScreenOrientation();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2012-05-08 21:36:07 +00:00
|
|
|
void Notify(const ScreenConfiguration& aScreenConfiguration) {
|
|
|
|
unused << SendNotifyScreenConfigurationChange(aScreenConfiguration);
|
2012-03-13 16:42:46 +00:00
|
|
|
}
|
|
|
|
|
2012-07-06 18:15:45 +00:00
|
|
|
virtual bool
|
|
|
|
RecvGetScreenEnabled(bool *enabled) MOZ_OVERRIDE
|
2011-12-04 17:07:00 +00:00
|
|
|
{
|
2012-09-25 18:52:30 +00:00
|
|
|
if (!AssertAppProcessPermission(this, "power")) {
|
2012-08-16 19:34:53 +00:00
|
|
|
return false;
|
|
|
|
}
|
2011-12-04 17:07:00 +00:00
|
|
|
*enabled = hal::GetScreenEnabled();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2012-07-06 18:15:45 +00:00
|
|
|
virtual bool
|
|
|
|
RecvSetScreenEnabled(const bool &enabled) MOZ_OVERRIDE
|
2011-12-04 17:07:00 +00:00
|
|
|
{
|
2012-09-25 18:52:30 +00:00
|
|
|
if (!AssertAppProcessPermission(this, "power")) {
|
2012-08-16 19:34:53 +00:00
|
|
|
return false;
|
|
|
|
}
|
2011-12-04 17:07:00 +00:00
|
|
|
hal::SetScreenEnabled(enabled);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2012-07-06 18:15:45 +00:00
|
|
|
virtual bool
|
|
|
|
RecvGetCpuSleepAllowed(bool *allowed) MOZ_OVERRIDE
|
2012-04-16 22:35:33 +00:00
|
|
|
{
|
2012-09-25 18:52:30 +00:00
|
|
|
if (!AssertAppProcessPermission(this, "power")) {
|
2012-08-16 19:34:53 +00:00
|
|
|
return false;
|
|
|
|
}
|
2012-04-16 22:35:33 +00:00
|
|
|
*allowed = hal::GetCpuSleepAllowed();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2012-07-06 18:15:45 +00:00
|
|
|
virtual bool
|
|
|
|
RecvSetCpuSleepAllowed(const bool &allowed) MOZ_OVERRIDE
|
2012-04-16 22:35:33 +00:00
|
|
|
{
|
2012-09-25 18:52:30 +00:00
|
|
|
if (!AssertAppProcessPermission(this, "power")) {
|
2012-08-16 19:34:53 +00:00
|
|
|
return false;
|
|
|
|
}
|
2012-04-16 22:35:33 +00:00
|
|
|
hal::SetCpuSleepAllowed(allowed);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2012-07-06 18:15:45 +00:00
|
|
|
virtual bool
|
|
|
|
RecvGetScreenBrightness(double *brightness) MOZ_OVERRIDE
|
2011-12-04 17:07:00 +00:00
|
|
|
{
|
2012-09-25 18:52:30 +00:00
|
|
|
if (!AssertAppProcessPermission(this, "power")) {
|
2012-08-16 19:34:53 +00:00
|
|
|
return false;
|
|
|
|
}
|
2011-12-04 17:07:00 +00:00
|
|
|
*brightness = hal::GetScreenBrightness();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2012-07-06 18:15:45 +00:00
|
|
|
virtual bool
|
|
|
|
RecvSetScreenBrightness(const double &brightness) MOZ_OVERRIDE
|
2011-12-04 17:07:00 +00:00
|
|
|
{
|
2012-09-25 18:52:30 +00:00
|
|
|
if (!AssertAppProcessPermission(this, "power")) {
|
2012-08-16 19:34:53 +00:00
|
|
|
return false;
|
|
|
|
}
|
2011-12-04 17:07:00 +00:00
|
|
|
hal::SetScreenBrightness(brightness);
|
|
|
|
return true;
|
|
|
|
}
|
2012-01-31 06:08:00 +00:00
|
|
|
|
2012-07-06 18:15:45 +00:00
|
|
|
virtual bool
|
|
|
|
RecvSetLight(const LightType& aLight, const hal::LightConfiguration& aConfig, bool *status) MOZ_OVERRIDE
|
2012-02-02 06:09:00 +00:00
|
|
|
{
|
2012-08-16 19:34:53 +00:00
|
|
|
// XXX currently, the hardware key light and screen backlight are
|
|
|
|
// controlled as a unit. Those are set through the power API, and
|
|
|
|
// there's no other way to poke lights currently, so we require
|
|
|
|
// "power" privileges here.
|
2012-09-25 18:52:30 +00:00
|
|
|
if (!AssertAppProcessPermission(this, "power")) {
|
2012-08-16 19:34:53 +00:00
|
|
|
return false;
|
|
|
|
}
|
2012-02-02 06:09:00 +00:00
|
|
|
*status = hal::SetLight(aLight, aConfig);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2012-07-06 18:15:45 +00:00
|
|
|
virtual bool
|
|
|
|
RecvGetLight(const LightType& aLight, LightConfiguration* aConfig, bool* status) MOZ_OVERRIDE
|
2012-02-02 06:09:00 +00:00
|
|
|
{
|
2012-09-25 18:52:30 +00:00
|
|
|
if (!AssertAppProcessPermission(this, "power")) {
|
2012-08-16 19:34:53 +00:00
|
|
|
return false;
|
|
|
|
}
|
2012-02-02 06:09:00 +00:00
|
|
|
*status = hal::GetLight(aLight, aConfig);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2012-07-06 18:15:45 +00:00
|
|
|
virtual bool
|
2012-09-26 03:51:29 +00:00
|
|
|
RecvAdjustSystemClock(const int64_t &aDeltaMilliseconds) MOZ_OVERRIDE
|
2012-02-17 10:44:00 +00:00
|
|
|
{
|
2012-09-25 18:52:30 +00:00
|
|
|
if (!AssertAppProcessPermission(this, "time")) {
|
2012-08-16 19:34:53 +00:00
|
|
|
return false;
|
|
|
|
}
|
2012-02-17 10:44:00 +00:00
|
|
|
hal::AdjustSystemClock(aDeltaMilliseconds);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2012-07-06 18:15:45 +00:00
|
|
|
virtual bool
|
|
|
|
RecvSetTimezone(const nsCString& aTimezoneSpec) MOZ_OVERRIDE
|
2012-02-17 10:44:00 +00:00
|
|
|
{
|
2012-09-25 18:52:30 +00:00
|
|
|
if (!AssertAppProcessPermission(this, "time")) {
|
2012-08-16 19:34:53 +00:00
|
|
|
return false;
|
|
|
|
}
|
2012-02-17 10:44:00 +00:00
|
|
|
hal::SetTimezone(aTimezoneSpec);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2012-08-23 09:00:00 +00:00
|
|
|
virtual bool
|
|
|
|
RecvGetTimezone(nsCString *aTimezoneSpec) MOZ_OVERRIDE
|
|
|
|
{
|
2012-09-25 18:52:30 +00:00
|
|
|
if (!AssertAppProcessPermission(this, "time")) {
|
2012-08-23 09:00:00 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
*aTimezoneSpec = hal::GetTimezone();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2013-10-15 08:43:53 +00:00
|
|
|
virtual bool
|
|
|
|
RecvGetTimezoneOffset(int32_t *aTimezoneOffset) MOZ_OVERRIDE
|
|
|
|
{
|
|
|
|
if (!AssertAppProcessPermission(this, "time")) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
*aTimezoneOffset = hal::GetTimezoneOffset();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2012-09-23 17:00:32 +00:00
|
|
|
virtual bool
|
2012-10-23 07:15:43 +00:00
|
|
|
RecvEnableSystemClockChangeNotifications() MOZ_OVERRIDE
|
|
|
|
{
|
|
|
|
hal::RegisterSystemClockChangeObserver(this);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual bool
|
|
|
|
RecvDisableSystemClockChangeNotifications() MOZ_OVERRIDE
|
2012-09-23 17:00:32 +00:00
|
|
|
{
|
2012-10-23 07:15:43 +00:00
|
|
|
hal::UnregisterSystemClockChangeObserver(this);
|
2012-09-23 17:00:32 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual bool
|
2012-10-23 07:15:43 +00:00
|
|
|
RecvEnableSystemTimezoneChangeNotifications() MOZ_OVERRIDE
|
2012-09-23 17:00:32 +00:00
|
|
|
{
|
2012-10-23 07:15:43 +00:00
|
|
|
hal::RegisterSystemTimezoneChangeObserver(this);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual bool
|
|
|
|
RecvDisableSystemTimezoneChangeNotifications() MOZ_OVERRIDE
|
|
|
|
{
|
|
|
|
hal::UnregisterSystemTimezoneChangeObserver(this);
|
2012-09-23 17:00:32 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2012-07-06 18:15:45 +00:00
|
|
|
virtual bool
|
|
|
|
RecvEnableSensorNotifications(const SensorType &aSensor) MOZ_OVERRIDE {
|
2012-08-16 19:34:53 +00:00
|
|
|
// We currently allow any content to register device-sensor
|
|
|
|
// listeners.
|
2012-02-05 19:51:06 +00:00
|
|
|
hal::RegisterSensorObserver(aSensor, this);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2012-07-06 18:15:45 +00:00
|
|
|
virtual bool
|
|
|
|
RecvDisableSensorNotifications(const SensorType &aSensor) MOZ_OVERRIDE {
|
2012-02-05 19:51:06 +00:00
|
|
|
hal::UnregisterSensorObserver(aSensor, this);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Notify(const SensorData& aSensorData) {
|
|
|
|
unused << SendNotifySensorChange(aSensorData);
|
|
|
|
}
|
2012-03-07 11:03:25 +00:00
|
|
|
|
2012-07-06 18:15:45 +00:00
|
|
|
virtual bool
|
2012-11-17 15:05:18 +00:00
|
|
|
RecvModifyWakeLock(const nsString& aTopic,
|
|
|
|
const WakeLockControl& aLockAdjust,
|
|
|
|
const WakeLockControl& aHiddenAdjust,
|
|
|
|
const uint64_t& aProcessID) MOZ_OVERRIDE
|
2012-03-07 11:03:25 +00:00
|
|
|
{
|
2013-02-14 20:41:30 +00:00
|
|
|
MOZ_ASSERT(aProcessID != CONTENT_PROCESS_ID_UNKNOWN);
|
|
|
|
|
2012-08-25 22:38:04 +00:00
|
|
|
// We allow arbitrary content to use wake locks.
|
2013-02-14 20:41:30 +00:00
|
|
|
hal::ModifyWakeLock(aTopic, aLockAdjust, aHiddenAdjust, aProcessID);
|
2012-03-07 11:03:25 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2012-07-06 18:15:45 +00:00
|
|
|
virtual bool
|
|
|
|
RecvEnableWakeLockNotifications() MOZ_OVERRIDE
|
2012-03-07 11:03:25 +00:00
|
|
|
{
|
2012-08-25 22:38:04 +00:00
|
|
|
// We allow arbitrary content to use wake locks.
|
2012-03-07 11:03:25 +00:00
|
|
|
hal::RegisterWakeLockObserver(this);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2012-07-06 18:15:45 +00:00
|
|
|
virtual bool
|
|
|
|
RecvDisableWakeLockNotifications() MOZ_OVERRIDE
|
2012-03-07 11:03:25 +00:00
|
|
|
{
|
|
|
|
hal::UnregisterWakeLockObserver(this);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2012-07-06 18:15:45 +00:00
|
|
|
virtual bool
|
|
|
|
RecvGetWakeLockInfo(const nsString &aTopic, WakeLockInformation *aWakeLockInfo) MOZ_OVERRIDE
|
2012-03-07 11:03:25 +00:00
|
|
|
{
|
|
|
|
hal::GetWakeLockInfo(aTopic, aWakeLockInfo);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Notify(const WakeLockInformation& aWakeLockInfo)
|
|
|
|
{
|
|
|
|
unused << SendNotifyWakeLockChange(aWakeLockInfo);
|
|
|
|
}
|
2012-04-22 18:09:22 +00:00
|
|
|
|
2012-07-06 18:15:45 +00:00
|
|
|
virtual bool
|
|
|
|
RecvEnableSwitchNotifications(const SwitchDevice& aDevice) MOZ_OVERRIDE
|
2012-04-22 18:09:22 +00:00
|
|
|
{
|
2012-08-16 19:34:53 +00:00
|
|
|
// Content has no reason to listen to switch events currently.
|
2012-11-29 22:52:02 +00:00
|
|
|
hal::RegisterSwitchObserver(aDevice, this);
|
|
|
|
return true;
|
2012-04-22 18:09:22 +00:00
|
|
|
}
|
|
|
|
|
2012-07-06 18:15:45 +00:00
|
|
|
virtual bool
|
|
|
|
RecvDisableSwitchNotifications(const SwitchDevice& aDevice) MOZ_OVERRIDE
|
2012-04-22 18:09:22 +00:00
|
|
|
{
|
|
|
|
hal::UnregisterSwitchObserver(aDevice, this);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Notify(const SwitchEvent& aSwitchEvent)
|
|
|
|
{
|
|
|
|
unused << SendNotifySwitchChange(aSwitchEvent);
|
|
|
|
}
|
|
|
|
|
2012-07-06 18:15:45 +00:00
|
|
|
virtual bool
|
|
|
|
RecvGetCurrentSwitchState(const SwitchDevice& aDevice, hal::SwitchState *aState) MOZ_OVERRIDE
|
2012-04-22 18:09:22 +00:00
|
|
|
{
|
2012-08-16 19:34:53 +00:00
|
|
|
// Content has no reason to listen to switch events currently.
|
2012-11-29 22:52:02 +00:00
|
|
|
*aState = hal::GetCurrentSwitchState(aDevice);
|
|
|
|
return true;
|
2012-04-22 18:09:22 +00:00
|
|
|
}
|
2012-08-05 05:09:39 +00:00
|
|
|
|
2012-10-23 07:15:43 +00:00
|
|
|
void Notify(const int64_t& aClockDeltaMS)
|
|
|
|
{
|
|
|
|
unused << SendNotifySystemClockChange(aClockDeltaMS);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Notify(const SystemTimezoneChangeInformation& aSystemTimezoneChangeInfo)
|
2012-09-11 06:40:00 +00:00
|
|
|
{
|
2012-10-23 07:15:43 +00:00
|
|
|
unused << SendNotifySystemTimezoneChange(aSystemTimezoneChangeInfo);
|
2012-09-11 06:40:00 +00:00
|
|
|
}
|
2012-09-19 15:17:13 +00:00
|
|
|
|
2012-10-04 09:28:34 +00:00
|
|
|
virtual bool
|
|
|
|
RecvFactoryReset()
|
|
|
|
{
|
|
|
|
if (!AssertAppProcessPermission(this, "power")) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
hal::FactoryReset();
|
|
|
|
return true;
|
|
|
|
}
|
2013-06-03 10:14:37 +00:00
|
|
|
|
|
|
|
virtual mozilla::ipc::IProtocol*
|
|
|
|
CloneProtocol(Channel* aChannel,
|
|
|
|
mozilla::ipc::ProtocolCloneContext* aCtx) MOZ_OVERRIDE
|
|
|
|
{
|
|
|
|
ContentParent* contentParent = aCtx->GetContentParent();
|
|
|
|
nsAutoPtr<PHalParent> actor(contentParent->AllocPHalParent());
|
|
|
|
if (!actor || !contentParent->RecvPHalConstructor(actor)) {
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
return actor.forget();
|
|
|
|
}
|
2011-10-05 22:15:45 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class HalChild : public PHalChild {
|
|
|
|
public:
|
2012-10-07 01:53:22 +00:00
|
|
|
virtual void
|
|
|
|
ActorDestroy(ActorDestroyReason aWhy) MOZ_OVERRIDE
|
|
|
|
{
|
2013-02-12 04:09:25 +00:00
|
|
|
sHalChildDestroyed = true;
|
2012-10-07 01:53:22 +00:00
|
|
|
}
|
|
|
|
|
2012-07-06 18:15:45 +00:00
|
|
|
virtual bool
|
|
|
|
RecvNotifyBatteryChange(const BatteryInformation& aBatteryInfo) MOZ_OVERRIDE {
|
2011-11-02 15:14:01 +00:00
|
|
|
hal::NotifyBatteryChange(aBatteryInfo);
|
|
|
|
return true;
|
|
|
|
}
|
2012-01-16 13:39:57 +00:00
|
|
|
|
2012-07-06 18:15:45 +00:00
|
|
|
virtual bool
|
|
|
|
RecvNotifySensorChange(const hal::SensorData &aSensorData) MOZ_OVERRIDE;
|
2012-02-05 19:51:06 +00:00
|
|
|
|
2012-07-06 18:15:45 +00:00
|
|
|
virtual bool
|
|
|
|
RecvNotifyNetworkChange(const NetworkInformation& aNetworkInfo) MOZ_OVERRIDE {
|
2012-01-16 13:39:57 +00:00
|
|
|
hal::NotifyNetworkChange(aNetworkInfo);
|
|
|
|
return true;
|
|
|
|
}
|
2012-03-07 11:03:25 +00:00
|
|
|
|
2012-07-06 18:15:45 +00:00
|
|
|
virtual bool
|
|
|
|
RecvNotifyWakeLockChange(const WakeLockInformation& aWakeLockInfo) MOZ_OVERRIDE {
|
2012-03-07 11:03:25 +00:00
|
|
|
hal::NotifyWakeLockChange(aWakeLockInfo);
|
|
|
|
return true;
|
|
|
|
}
|
2012-03-13 16:42:46 +00:00
|
|
|
|
2012-07-06 18:15:45 +00:00
|
|
|
virtual bool
|
|
|
|
RecvNotifyScreenConfigurationChange(const ScreenConfiguration& aScreenConfiguration) MOZ_OVERRIDE {
|
2012-05-08 21:36:07 +00:00
|
|
|
hal::NotifyScreenConfigurationChange(aScreenConfiguration);
|
2012-03-13 16:42:46 +00:00
|
|
|
return true;
|
|
|
|
}
|
2012-04-22 18:09:22 +00:00
|
|
|
|
2012-07-06 18:15:45 +00:00
|
|
|
virtual bool
|
|
|
|
RecvNotifySwitchChange(const mozilla::hal::SwitchEvent& aEvent) MOZ_OVERRIDE {
|
2012-04-22 18:09:22 +00:00
|
|
|
hal::NotifySwitchChange(aEvent);
|
|
|
|
return true;
|
|
|
|
}
|
2012-09-11 06:40:00 +00:00
|
|
|
|
|
|
|
virtual bool
|
2012-10-23 07:15:43 +00:00
|
|
|
RecvNotifySystemClockChange(const int64_t& aClockDeltaMS) {
|
|
|
|
hal::NotifySystemClockChange(aClockDeltaMS);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual bool
|
|
|
|
RecvNotifySystemTimezoneChange(
|
|
|
|
const SystemTimezoneChangeInformation& aSystemTimezoneChangeInfo) {
|
|
|
|
hal::NotifySystemTimezoneChange(aSystemTimezoneChangeInfo);
|
2012-09-11 06:40:00 +00:00
|
|
|
return true;
|
|
|
|
}
|
2011-10-05 22:15:45 +00:00
|
|
|
};
|
|
|
|
|
2012-02-05 19:51:06 +00:00
|
|
|
bool
|
|
|
|
HalChild::RecvNotifySensorChange(const hal::SensorData &aSensorData) {
|
|
|
|
hal::NotifySensorChange(aSensorData);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2011-10-05 22:15:45 +00:00
|
|
|
PHalChild* CreateHalChild() {
|
|
|
|
return new HalChild();
|
|
|
|
}
|
|
|
|
|
|
|
|
PHalParent* CreateHalParent() {
|
|
|
|
return new HalParent();
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace hal_sandbox
|
|
|
|
} // namespace mozilla
|