Backout 90f7f032757f, 6695904a4a70, 50e98f67df1b & d26e8631514c (bug 697641) for native Android failures and 20289eb83e51 (bug 712378) because it conflicted with the backout CLOSED TREE

This commit is contained in:
Ed Morley 2012-02-02 10:09:40 +00:00
Родитель 0603707c0e
Коммит 46f66f0c50
24 изменённых файлов: 319 добавлений и 858 удалений

Просмотреть файл

@ -1,11 +1,38 @@
# ***** BEGIN LICENSE BLOCK *****
# 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/. */#
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
#
# The Original Code is Telephony.
#
# The Initial Developer of the Original Code is
# The Mozilla Foundation.
# Portions created by the Initial Developer are Copyright (C) 2011
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
# Ben Turner <bent.mozilla@gmail.com> (Original Author)
#
# Alternatively, the contents of this file may be used under the terms of
# either the GNU General Public License Version 2 or later (the "GPL"), or
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
# in which case the provisions of the GPL or the LGPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
# under the terms of either the GPL or the LGPL, and not to allow others to
# use your version of this file under the terms of the MPL, indicate your
# decision by deleting the provisions above and replace them with the notice
# and other provisions required by the GPL or the LGPL. If you do not delete
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the MPL, the GPL or the LGPL.
#
# ***** END LICENSE BLOCK *****
DEPTH = ../../..

Просмотреть файл

@ -679,42 +679,6 @@ public class GeckoAppShell
});
}
/*
* Keep these values consistent with |SensorType| in Hal.h
*/
private static final int SENSOR_ORIENTATION = 1;
private static final int SENSOR_ACCELERATION = 2;
private static final int SENSOR_PROXIMITY = 3;
private static Sensor gProximitySensor = null;
public static void enableSensor(int aSensortype) {
SensorManager sm = (SensorManager)
GeckoApp.surfaceView.getContext().
getSystemService(Context.SENSOR_SERVICE);
switch(aSensortype) {
case SENSOR_PROXIMITY:
if(gProximitySensor == null)
gProximitySensor = sm.getDefaultSensor(Sensor.TYPE_PROXIMITY);
sm.registerListener(GeckoApp.surfaceView, gProximitySensor,
SensorManager.SENSOR_DELAY_GAME);
break;
}
}
public static void disableSensor(int aSensortype) {
SensorManager sm = (SensorManager)
GeckoApp.surfaceView.getContext().
getSystemService(Context.SENSOR_SERVICE);
switch(aSensortype) {
case SENSOR_PROXIMITY:
sm.unregisterListener(GeckoApp.surfaceView, gProximitySensor);
break;
}
}
public static void moveTaskToBack() {
GeckoApp.mAppContext.moveTaskToBack(true);
}

Просмотреть файл

@ -79,7 +79,6 @@ public class GeckoEvent {
public static final int VIEWPORT = 20;
public static final int VISTITED = 21;
public static final int NETWORK_CHANGED = 22;
public static final int PROXIMITY_EVENT = 23;
public static final int IME_COMPOSITION_END = 0;
public static final int IME_COMPOSITION_BEGIN = 1;
@ -112,7 +111,6 @@ public class GeckoEvent {
public Rect mRect;
public double mX, mY, mZ;
public double mAlpha, mBeta, mGamma;
public double mDistance;
public int mMetaState, mFlags;
public int mKeyCode, mUnicodeChar;
@ -225,30 +223,19 @@ public class GeckoEvent {
}
public GeckoEvent(SensorEvent s) {
int sensor_type = s.sensor.getType();
switch(sensor_type) {
case Sensor.TYPE_ACCELEROMETER:
if (s.sensor.getType() == Sensor.TYPE_ACCELEROMETER) {
mType = ACCELERATION_EVENT;
mX = s.values[0];
mY = s.values[1];
mZ = s.values[2];
break;
case Sensor.TYPE_ORIENTATION:
}
else {
mType = ORIENTATION_EVENT;
mAlpha = -s.values[0];
mBeta = -s.values[1];
mGamma = -s.values[2];
Log.i("GeckoEvent", "SensorEvent type = " + s.sensor.getType() + " " + s.sensor.getName() + " " + mAlpha + " " + mBeta + " " + mGamma );
break;
case Sensor.TYPE_PROXIMITY:
mType = PROXIMITY_EVENT;
mDistance = s.values[0];
Log.i("GeckoEvent", "SensorEvent type = " + s.sensor.getType() +
" " + s.sensor.getName() + " " + mDistance);
break;
}
}

Просмотреть файл

@ -1,12 +1,39 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set sw=2 ts=8 et ft=cpp : */
/* ***** BEGIN LICENSE BLOCK *****
* 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/.
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at:
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla Code.
*
* The Initial Developer of the Original Code is
* The Mozilla Foundation
* Portions created by the Initial Developer are Copyright (C) 2011
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Chris Jones <jones.chris.g@gmail.com>
* Jim Straus <jstraus@mozilla.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
@ -173,7 +200,7 @@ class ObserversManager
public:
void AddObserver(Observer<InfoType>* aObserver) {
if (!mObservers) {
mObservers = new mozilla::ObserverList<InfoType>();
mObservers = new ObserverList<InfoType>();
}
mObservers->AddObserver(aObserver);
@ -223,7 +250,7 @@ protected:
virtual void GetCurrentInformationInternal(InfoType*) = 0;
private:
mozilla::ObserverList<InfoType>* mObservers;
ObserverList<InfoType>* mObservers;
InfoType mInfo;
bool mHasValidCache;
};
@ -317,75 +344,6 @@ void SetScreenBrightness(double brightness)
PROXY_IF_SANDBOXED(SetScreenBrightness(clamped(brightness, 0.0, 1.0)));
}
bool SetLight(LightType light, const hal::LightConfiguration& aConfig)
{
AssertMainThread();
RETURN_PROXY_IF_SANDBOXED(SetLight(light, aConfig));
}
bool GetLight(LightType light, hal::LightConfiguration* aConfig)
{
AssertMainThread();
RETURN_PROXY_IF_SANDBOXED(GetLight(light, aConfig));
}
void
EnableSensorNotifications(SensorType aSensor) {
AssertMainThread();
PROXY_IF_SANDBOXED(EnableSensorNotifications(aSensor));
}
void
DisableSensorNotifications(SensorType aSensor) {
AssertMainThread();
PROXY_IF_SANDBOXED(DisableSensorNotifications(aSensor));
}
typedef mozilla::ObserverList<SensorData> SensorObserverList;
static SensorObserverList *gSensorObservers = NULL;
static SensorObserverList &
GetSensorObservers(SensorType sensor_type) {
MOZ_ASSERT(sensor_type < NUM_SENSOR_TYPE);
if(gSensorObservers == NULL)
gSensorObservers = new SensorObserverList[NUM_SENSOR_TYPE];
return gSensorObservers[sensor_type];
}
void
RegisterSensorObserver(SensorType aSensor, ISensorObserver *aObserver) {
SensorObserverList &observers = GetSensorObservers(aSensor);
AssertMainThread();
observers.AddObserver(aObserver);
if(observers.Length() == 1) {
EnableSensorNotifications(aSensor);
}
}
void
UnregisterSensorObserver(SensorType aSensor, ISensorObserver *aObserver) {
SensorObserverList &observers = GetSensorObservers(aSensor);
AssertMainThread();
observers.RemoveObserver(aObserver);
if(observers.Length() == 0) {
DisableSensorNotifications(aSensor);
}
}
void
NotifySensorChange(const SensorData &aSensorData) {
SensorObserverList &observers = GetSensorObservers(aSensorData.sensor());
AssertMainThread();
observers.Broadcast(aSensorData);
}
void
RegisterNetworkObserver(NetworkObserver* aObserver)
{

Просмотреть файл

@ -1,12 +1,39 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set sw=2 ts=8 et ft=cpp : */
/* ***** BEGIN LICENSE BLOCK *****
* 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/.
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at:
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla Code.
*
* The Initial Developer of the Original Code is
* The Mozilla Foundation
* Portions created by the Initial Developer are Copyright (C) 2011
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Chris Jones <jones.chris.g@gmail.com>
* Jim Straus <jstraus@mozilla.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
@ -20,7 +47,6 @@
#include "prlog.h"
#include "mozilla/dom/battery/Types.h"
#include "mozilla/dom/network/Types.h"
#include "mozilla/hal_sandbox/PHal.h"
/*
* Hal.h contains the public Hal API.
@ -143,63 +169,6 @@ double GetScreenBrightness();
*/
void SetScreenBrightness(double brightness);
/**
* Set the value of a light to a particular color, with a specific flash pattern.
* light specifices which light. See Hal.idl for the list of constants
* mode specifies user set or based on ambient light sensor
* flash specifies whether or how to flash the light
* flashOnMS and flashOffMS specify the pattern for XXX flash mode
* color specifies the color. If the light doesn't support color, the given color is
* transformed into a brightness, or just an on/off if that is all the light is capable of.
* returns true if successful and false if failed.
*/
bool SetLight(hal::LightType light, const hal::LightConfiguration& aConfig);
/**
* GET the value of a light returning a particular color, with a specific flash pattern.
* returns true if successful and false if failed.
*/
bool GetLight(hal::LightType light, hal::LightConfiguration* aConfig);
/**
* Register an observer for the sensor of given type.
*
* The observer will receive data whenever the data generated by the
* sensor is avaiable.
*/
void RegisterSensorObserver(hal::SensorType aSensor,
hal::ISensorObserver *aObserver);
/**
* Unregister an observer for the sensor of given type.
*/
void UnregisterSensorObserver(hal::SensorType aSensor,
hal::ISensorObserver *aObserver);
/**
* Post a value generated by a sensor.
*
* This API is internal to hal; clients shouldn't call it directly.
*/
void NotifySensorChange(const hal::SensorData &aSensorData);
/**
* Enable sensor notifications from the backend
*
* This method is only visible from implementation of sensor manager.
* Rest of the system should not try this.
*/
void EnableSensorNotifications(hal::SensorType aSensor);
/**
* Disable sensor notifications from the backend
*
* This method is only visible from implementation of sensor manager.
* Rest of the system should not try this.
*/
void DisableSensorNotifications(hal::SensorType aSensor);
/**
* Inform the network backend there is a new network observer.
* @param aNetworkObserver The observer that should be added.

Просмотреть файл

@ -1,12 +1,40 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set sw=2 ts=8 et ft=cpp : */
/* ***** BEGIN LICENSE BLOCK *****
* 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/.
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at:
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla Code.
*
* The Initial Developer of the Original Code is
* The Mozilla Foundation
* Portions created by the Initial Developer are Copyright (C) 2011
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Chris Jones <jones.chris.g@gmail.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef mozilla_HalImpl_h

Просмотреть файл

@ -1,83 +0,0 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: sw=2 ts=8 et ft=cpp : */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at:
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla Code.
*
* The Initial Developer of the Original Code is
* The Mozilla Foundation
* Portions created by the Initial Developer are Copyright (C) 2011
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Sinker Li <thinker@codemud.net>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef __HAL_SENSOR_H_
#define __HAL_SENSOR_H_
#include "mozilla/Observer.h"
namespace mozilla {
namespace hal {
/**
* Enumeration of sensor types. They are used to specify type while
* register or unregister an observer for a sensor of given type.
*/
enum SensorType {
SENSOR_UNKNOWN = -1,
SENSOR_ORIENTATION,
SENSOR_ACCELERATION,
SENSOR_PROXIMITY,
NUM_SENSOR_TYPE
};
class SensorData;
typedef Observer<SensorData> ISensorObserver;
}
}
#include "IPC/IPCMessageUtils.h"
namespace IPC {
/**
* Serializer for SensorType
*/
template <>
struct ParamTraits<mozilla::hal::SensorType>:
public EnumSerializer<mozilla::hal::SensorType,
mozilla::hal::SENSOR_UNKNOWN,
mozilla::hal::NUM_SENSOR_TYPE> {
};
} // namespace IPC
#endif /* __HAL_SENSOR_H_ */

Просмотреть файл

@ -1,82 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* 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/.
* Contributor(s):
* Mounir Lamouri <mounir.lamouri@mozilla.com> (Original Author)
* Jim Straus <jstraus@mozilla.com>
*
* ***** END LICENSE BLOCK ***** */
#ifndef mozilla_hal_Types_h
#define mozilla_hal_Types_h
#include "IPCMessageUtils.h"
namespace mozilla {
namespace hal {
/**
* These are defined by libhardware, specifically, hardware/libhardware/include/hardware/lights.h
* in the gonk subsystem.
* If these change and are exposed to JS, make sure nsIHal.idl is updated as well.
*/
enum LightType {
eHalLightID_Backlight = 0,
eHalLightID_Keyboard = 1,
eHalLightID_Buttons = 2,
eHalLightID_Battery = 3,
eHalLightID_Notifications = 4,
eHalLightID_Attention = 5,
eHalLightID_Bluetooth = 6,
eHalLightID_Wifi = 7,
eHalLightID_Count = 8 // This should stay at the end
};
enum LightMode {
eHalLightMode_User = 0, // brightness is managed by user setting
eHalLightMode_Sensor = 1 // brightness is managed by a light sensor
};
enum FlashMode {
eHalLightFlash_None = 0,
eHalLightFlash_Timed = 1, // timed flashing. Use flashOnMS and flashOffMS for timing
eHalLightFlash_Hardware = 2 // hardware assisted flashing
};
} // namespace hal
} // namespace mozilla
namespace IPC {
/**
* Light type serializer.
*/
template <>
struct ParamTraits<mozilla::hal::LightType>
: public EnumSerializer<mozilla::hal::LightType,
mozilla::hal::eHalLightID_Backlight,
mozilla::hal::eHalLightID_Count>
{};
/**
* Light mode serializer.
*/
template <>
struct ParamTraits<mozilla::hal::LightMode>
: public EnumSerializer<mozilla::hal::LightMode,
mozilla::hal::eHalLightMode_User,
mozilla::hal::eHalLightMode_Sensor>
{};
/**
* Flash mode serializer.
*/
template <>
struct ParamTraits<mozilla::hal::FlashMode>
: public EnumSerializer<mozilla::hal::FlashMode,
mozilla::hal::eHalLightFlash_None,
mozilla::hal::eHalLightFlash_Hardware>
{};
} // namespace IPC
#endif // mozilla_hal_Types_h

Просмотреть файл

@ -61,8 +61,6 @@ EXPORTS_mozilla = \
Hal.h \
HalImpl.h \
HalSandbox.h \
HalSensor.h \
HalTypes.h \
$(NULL)
CPPSRCS = \
@ -72,42 +70,20 @@ CPPSRCS = \
$(NULL)
ifeq (android,$(MOZ_WIDGET_TOOLKIT))
CPPSRCS += \
AndroidHal.cpp \
AndroidSensor.cpp \
$(NULL)
CPPSRCS += AndroidHal.cpp
else ifeq (gonk,$(MOZ_WIDGET_TOOLKIT))
CPPSRCS += \
GonkHal.cpp \
Power.cpp \
FallbackSensor.cpp \
$(NULL)
CPPSRCS += GonkHal.cpp Power.cpp
else ifeq (Linux,$(OS_TARGET))
CPPSRCS += \
LinuxHal.cpp \
Power.cpp \
FallbackSensor.cpp \
$(NULL)
CPPSRCS += LinuxHal.cpp Power.cpp
ifdef MOZ_ENABLE_DBUS
CPPSRCS += UPowerClient.cpp
endif
else ifeq (WINNT,$(OS_TARGET))
CPPSRCS += \
WindowsHal.cpp \
WindowsBattery.cpp \
FallbackSensor.cpp \
$(NULL)
CPPSRCS += WindowsHal.cpp WindowsBattery.cpp
else
CPPSRCS += \
FallbackHal.cpp \
FallbackSensor.cpp \
$(NULL)
CPPSRCS += FallbackHal.cpp
endif
ifneq (gonk,$(MOZ_WIDGET_TOOLKIT)) #{
CPPSRCS += FallbackLights.cpp
endif #}
include $(topsrcdir)/config/config.mk
include $(topsrcdir)/ipc/chromium/chromium-config.mk
include $(topsrcdir)/config/rules.mk

Просмотреть файл

@ -1,75 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Mozilla Foundation
* Portions created by the Initial Developer are Copyright (C) 2011
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Sinker Li <thinker@codemud.net>
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "Hal.h"
#include "AndroidBridge.h"
using namespace mozilla::hal;
namespace mozilla {
namespace hal_impl {
/**
* Translate ID of sensor type from Sensor service to Android.
*
* Must be consistent with the definition of sensor types in
* embedding/android/GeckoAppShell.java
*/
static int
MapSensorType(SensorType aSensorType) {
return (SENSOR_UNKNOWN <= aSensorType && aSensorType < NUM_SENSOR_TYPE) ?
aSensorType + 1 : -1;
}
void
EnableSensorNotifications(SensorType aSensor) {
int androidSensor = MapSensorType(aSensor);
MOZ_ASSERT(androidSensor != -1);
AndroidBridge::Bridge()->EnableSensor(androidSensor);
}
void
DisableSensorNotifications(SensorType aSensor) {
int androidSensor = MapSensorType(aSensor);
MOZ_ASSERT(androidSensor != -1);
AndroidBridge::Bridge()->DisableSensor(androidSensor);
}
} // hal_impl
} // mozilla

Просмотреть файл

@ -1,12 +1,39 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set sw=2 ts=8 et ft=cpp : */
/* ***** BEGIN LICENSE BLOCK *****
* 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/.
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at:
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla Code.
*
* The Initial Developer of the Original Code is
* The Mozilla Foundation
* Portions created by the Initial Developer are Copyright (C) 2011
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Chris Jones <jones.chris.g@gmail.com>
* Jim Straus <jstraus@mozilla.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */

Просмотреть файл

@ -1,28 +0,0 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
* vim: sw=2 ts=8 et :
*/
/* 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/. */
#include "Hal.h"
namespace mozilla {
namespace hal_impl {
bool
SetLight(hal::LightType light, const hal::LightConfiguration& aConfig)
{
return true;
}
bool
GetLight(hal::LightType light, hal::LightConfiguration* aConfig)
{
aConfig->light() = light;
// The rest of the fields are 0 by default, which is fine.
return true;
}
} // namespace hal_impl
} // namespace mozilla

Просмотреть файл

@ -1,56 +0,0 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* vim: sw=4 ts=8 et ft=cpp : */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at:
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla Code.
*
* The Initial Developer of the Original Code is
* The Mozilla Foundation
* Portions created by the Initial Developer are Copyright (C) 2011
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Sinker Li <thinker@codemud.net>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "mozilla/Hal.h"
using namespace mozilla::hal;
namespace mozilla {
namespace hal_impl {
void
EnableSensorNotifications(SensorType aSensor) {
}
void
DisableSensorNotifications(SensorType aSensor) {
}
}
}

Просмотреть файл

@ -1,14 +1,41 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set sw=2 ts=8 et ft=cpp : */
/* ***** BEGIN LICENSE BLOCK *****
* 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/.
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at:
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla Code.
*
* The Initial Developer of the Original Code is
* The Mozilla Foundation
* Portions created by the Initial Developer are Copyright (C) 2011
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Chris Jones <jones.chris.g@gmail.com>
* Michael Wu <mwu@mozilla.com>
* Justin Lebar <justin.lebar@gmail.com>
* Jim Straus <jstraus@mozilla.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
@ -27,8 +54,6 @@
#include "nsIThread.h"
#include "nsIObserver.h"
#include "nsIObserverService.h"
#include "hardware/lights.h"
#include "hardware/hardware.h"
#include "hardware_legacy/vibrator.h"
#include <stdio.h>
#include <math.h>
@ -289,6 +314,7 @@ namespace {
* RAII class to help us remember to close file descriptors.
*/
const char *screenEnabledFilename = "/sys/power/state";
const char *screenBrightnessFilename = "/sys/class/leds/lcd-backlight/brightness";
template<ssize_t n>
bool ReadFromFile(const char *filename, char (&buf)[n])
@ -348,13 +374,24 @@ SetScreenEnabled(bool enabled)
double
GetScreenBrightness()
{
hal::LightConfiguration aConfig;
hal::LightType light = hal::eHalLightID_Backlight;
char buf[32];
ReadFromFile(screenBrightnessFilename, buf);
hal::GetLight(light, &aConfig);
// backlight is brightness only, so using one of the RGB elements as value.
int brightness = aConfig.color() & 0xFF;
return brightness / 255.0;
errno = 0;
unsigned long val = strtoul(buf, NULL, 10);
if (errno) {
HAL_LOG(("Cannot parse contents of %s; expected an unsigned "
"int, but contains \"%s\".",
screenBrightnessFilename, buf));
return 1;
}
if (val > 255) {
HAL_LOG(("Got out-of-range brightness %d, truncating to 1.0", val));
val = 255;
}
return val / 255.0;
}
void
@ -368,122 +405,14 @@ SetScreenBrightness(double brightness)
return;
}
// Convert the value in [0, 1] to an int between 0 and 255 and convert to a color
// note that the high byte is FF, corresponding to the alpha channel.
// Convert the value in [0, 1] to an int between 0 and 255, then write to a
// string.
int val = static_cast<int>(round(brightness * 255));
uint32_t color = (0xff<<24) + (val<<16) + (val<<8) + val;
char str[4];
DebugOnly<int> numChars = snprintf(str, sizeof(str), "%d", val);
MOZ_ASSERT(numChars < static_cast<int>(sizeof(str)));
hal::LightConfiguration aConfig;
aConfig.mode() = hal::eHalLightMode_User;
aConfig.flash() = hal::eHalLightFlash_None;
aConfig.flashOnMS() = aConfig.flashOffMS() = 0;
aConfig.color() = color;
hal::SetLight(hal::eHalLightID_Backlight, aConfig);
}
static light_device_t* sLights[hal::eHalLightID_Count]; // will be initialized to NULL
light_device_t* GetDevice(hw_module_t* module, char const* name)
{
int err;
hw_device_t* device;
err = module->methods->open(module, name, &device);
if (err == 0) {
return (light_device_t*)device;
} else {
return NULL;
}
}
void
InitLights()
{
// assume that if backlight is NULL, nothing has been set yet
// if this is not true, the initialization will occur everytime a light is read or set!
if (!sLights[hal::eHalLightID_Backlight]) {
int err;
hw_module_t* module;
err = hw_get_module(LIGHTS_HARDWARE_MODULE_ID, (hw_module_t const**)&module);
if (err == 0) {
sLights[hal::eHalLightID_Backlight]
= GetDevice(module, LIGHT_ID_BACKLIGHT);
sLights[hal::eHalLightID_Keyboard]
= GetDevice(module, LIGHT_ID_KEYBOARD);
sLights[hal::eHalLightID_Buttons]
= GetDevice(module, LIGHT_ID_BUTTONS);
sLights[hal::eHalLightID_Battery]
= GetDevice(module, LIGHT_ID_BATTERY);
sLights[hal::eHalLightID_Notifications]
= GetDevice(module, LIGHT_ID_NOTIFICATIONS);
sLights[hal::eHalLightID_Attention]
= GetDevice(module, LIGHT_ID_ATTENTION);
sLights[hal::eHalLightID_Bluetooth]
= GetDevice(module, LIGHT_ID_BLUETOOTH);
sLights[hal::eHalLightID_Wifi]
= GetDevice(module, LIGHT_ID_WIFI);
}
}
}
/**
* The state last set for the lights until liblights supports
* getting the light state.
*/
static light_state_t sStoredLightState[hal::eHalLightID_Count];
bool
SetLight(hal::LightType light, const hal::LightConfiguration& aConfig)
{
light_state_t state;
InitLights();
if (light < 0 || light >= hal::eHalLightID_Count || sLights[light] == NULL) {
return false;
}
memset(&state, 0, sizeof(light_state_t));
state.color = aConfig.color();
state.flashMode = aConfig.flash();
state.flashOnMS = aConfig.flashOnMS();
state.flashOffMS = aConfig.flashOffMS();
state.brightnessMode = aConfig.mode();
sLights[light]->set_light(sLights[light], &state);
sStoredLightState[light] = state;
return true;
}
bool
GetLight(hal::LightType light, hal::LightConfiguration* aConfig)
{
light_state_t state;
#ifdef HAVEGETLIGHT
InitLights();
#endif
if (light < 0 || light >= hal::eHalLightID_Count || sLights[light] == NULL) {
return false;
}
memset(&state, 0, sizeof(light_state_t));
#ifdef HAVEGETLIGHT
sLights[light]->get_light(sLights[light], &state);
#else
state = sStoredLightState[light];
#endif
aConfig->light() = light;
aConfig->color() = state.color;
aConfig->flash() = hal::FlashMode(state.flashMode);
aConfig->flashOnMS() = state.flashOnMS;
aConfig->flashOffMS() = state.flashOffMS;
aConfig->mode() = hal::LightMode(state.brightnessMode);
return true;
WriteToFile(screenBrightnessFilename, str);
}
void

Просмотреть файл

@ -39,15 +39,6 @@
include protocol PContent;
include protocol PBrowser;
include "nspr/prtime.h";
include "mozilla/HalSensor.h";
include "mozilla/HalTypes.h";
using PRTime;
using mozilla::hal::FlashMode;
using mozilla::hal::LightType;
using mozilla::hal::LightMode;
using mozilla::hal::SensorType;
namespace mozilla {
@ -57,21 +48,6 @@ namespace hal {
bool charging;
double remainingTime;
};
struct LightConfiguration {
LightType light;
LightMode mode;
FlashMode flash;
uint32_t flashOnMS;
uint32_t flashOffMS;
uint32_t color;
};
struct SensorData {
SensorType sensor;
PRTime timestamp;
float[] values;
};
}
namespace hal {
@ -89,7 +65,6 @@ sync protocol PHal {
child:
NotifyBatteryChange(BatteryInformation aBatteryInfo);
NotifyNetworkChange(NetworkInformation aNetworkInfo);
NotifySensorChange(SensorData aSensorData);
parent:
Vibrate(uint32[] pattern, uint64[] id, PBrowser browser);
@ -111,17 +86,9 @@ parent:
sync GetScreenBrightness() returns (double brightness);
SetScreenBrightness(double brightness);
sync SetLight(LightType light, LightConfiguration aConfig)
returns (bool status);
sync GetLight(LightType light)
returns (LightConfiguration aConfig, bool status);
Reboot();
PowerOff();
EnableSensorNotifications(SensorType aSensor);
DisableSensorNotifications(SensorType aSensor);
__delete__();
};

Просмотреть файл

@ -1,12 +1,39 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set sw=2 ts=8 et ft=cpp : */
/* ***** BEGIN LICENSE BLOCK *****
* 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/.
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at:
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla Code.
*
* The Initial Developer of the Original Code is
* The Mozilla Foundation
* Portions created by the Initial Developer are Copyright (C) 2011
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Chris Jones <jones.chris.g@gmail.com>
* Jim Straus <jstraus@mozilla.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
@ -125,22 +152,6 @@ SetScreenBrightness(double brightness)
Hal()->SendSetScreenBrightness(brightness);
}
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;
}
void
Reboot()
{
@ -153,20 +164,9 @@ PowerOff()
Hal()->SendPowerOff();
}
void
EnableSensorNotifications(SensorType aSensor) {
Hal()->SendEnableSensorNotifications(aSensor);
}
void
DisableSensorNotifications(SensorType aSensor) {
Hal()->SendDisableSensorNotifications(aSensor);
}
class HalParent : public PHalParent
, public BatteryObserver
, public NetworkObserver
, public ISensorObserver
{
public:
NS_OVERRIDE virtual bool
@ -280,20 +280,6 @@ public:
return true;
}
NS_OVERRIDE virtual bool
RecvSetLight(const LightType& aLight, const hal::LightConfiguration& aConfig, bool *status)
{
*status = hal::SetLight(aLight, aConfig);
return true;
}
NS_OVERRIDE virtual bool
RecvGetLight(const LightType& aLight, LightConfiguration* aConfig, bool* status)
{
*status = hal::GetLight(aLight, aConfig);
return true;
}
NS_OVERRIDE virtual bool
RecvReboot()
{
@ -307,22 +293,6 @@ public:
hal::PowerOff();
return true;
}
NS_OVERRIDE virtual bool
RecvEnableSensorNotifications(const SensorType &aSensor) {
hal::RegisterSensorObserver(aSensor, this);
return true;
}
NS_OVERRIDE virtual bool
RecvDisableSensorNotifications(const SensorType &aSensor) {
hal::UnregisterSensorObserver(aSensor, this);
return true;
}
void Notify(const SensorData& aSensorData) {
unused << SendNotifySensorChange(aSensorData);
}
};
class HalChild : public PHalChild {
@ -338,12 +308,6 @@ public:
hal::NotifyNetworkChange(aNetworkInfo);
return true;
}
NS_OVERRIDE virtual bool
RecvNotifySensorChange(const hal::SensorData &aSensorData) {
hal::NotifySensorChange(aSensorData);
return true;
}
};
PHalChild* CreateHalChild() {

Просмотреть файл

@ -1,12 +1,40 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set sw=2 ts=8 et ft=cpp : */
/* ***** BEGIN LICENSE BLOCK *****
* 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/.
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at:
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla Code.
*
* The Initial Developer of the Original Code is
* The Mozilla Foundation
* Portions created by the Initial Developer are Copyright (C) 2011
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Chris Jones <jones.chris.g@gmail.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef mozilla_SandboxHal_h

Просмотреть файл

@ -98,33 +98,17 @@ namespace IPC {
/**
* Generic enum serializer.
*
* This is a generic serializer for any enum type used in IPDL.
* Programmers can define ParamTraits<E> for enum type E by deriving
* EnumSerializer<E, smallestLegal, highGuard>.
*
* The serializer would check value againts a range specified by
* smallestLegal and highGuard. Only values from smallestLegal to
* highGuard are valid, include smallestLegal but highGuard.
*
* For example, following is definition of serializer for enum type FOO.
* \code
* enum FOO { FOO_FIRST, FOO_SECOND, FOO_LAST, NUM_FOO };
*
* template <>
* struct ParamTraits<FOO>:
* public EnumSerializer<FOO, FOO_FIRST, NUM_FOO> {};
* \endcode
* FOO_FIRST, FOO_SECOND, and FOO_LAST are valid value.
*
* \sa https://developer.mozilla.org/en/IPDL/Type_Serialization
* E is the enum type.
* lowBound is the lowest allowed value of the enum.
* highBound is the value higher than highest allowed value of the enum.
* In other words, it's the lowest unallowed value.
*/
template <typename E, E smallestLegal, E highBound>
template <typename E, E lowBound, E highBound>
struct EnumSerializer {
typedef E paramType;
static bool IsLegalValue(const paramType &aValue) {
return smallestLegal <= aValue && aValue < highBound;
return lowBound <= aValue && aValue < highBound;
}
static void Write(Message* aMsg, const paramType& aValue) {

Просмотреть файл

@ -1,11 +1,39 @@
#
# ***** BEGIN LICENSE BLOCK *****
# 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/.
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is
# Benjamin Smedberg <benjamin@smedbergs.us>
# Portions created by the Initial Developer are Copyright (C) 1998
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
# Shawn Wilsher <me@shawnwilsher.com>
#
# Alternatively, the contents of this file may be used under the terms of
# either of the GNU General Public License Version 2 or later (the "GPL"),
# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
# in which case the provisions of the GPL or the LGPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
# under the terms of either the GPL or the LGPL, and not to allow others to
# use your version of this file under the terms of the MPL, indicate your
# decision by deleting the provisions above and replace them with the notice
# and other provisions required by the GPL or the LGPL. If you do not delete
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the MPL, the GPL or the LGPL.
#
# ***** END LICENSE BLOCK *****
DEPTH = ../..

Просмотреть файл

@ -107,12 +107,6 @@ AndroidBridge::Init(JNIEnv *jEnv,
jEnableDeviceMotion = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "enableDeviceMotion", "(Z)V");
jEnableLocation = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "enableLocation", "(Z)V");
jEnableSensor =
(jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass,
"enableSensor", "(I)V");
jDisableSensor =
(jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass,
"disableSensor", "(I)V");
jReturnIMEQueryResult = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "returnIMEQueryResult", "(Ljava/lang/String;II)V");
jScheduleRestart = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "scheduleRestart", "()V");
jNotifyXreExit = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "onXreExit", "()V");
@ -321,20 +315,6 @@ AndroidBridge::EnableLocation(bool aEnable)
env->CallStaticVoidMethod(mGeckoAppShellClass, jEnableLocation, aEnable);
}
void
AndroidBridge::EnableSensor(int aSensorType) {
ALOG_BRIDGE("AndroidBridge::EnableSensor");
mJNIEnv->CallStaticVoidMethod(mGeckoAppShellClass, jEnableSensor,
aSensorType);
}
void
AndroidBridge::DisableSensor(int aSensorType) {
ALOG_BRIDGE("AndroidBridge::DisableSensor");
mJNIEnv->CallStaticVoidMethod(mGeckoAppShellClass, jDisableSensor,
aSensorType);
}
void
AndroidBridge::ReturnIMEQueryResult(const PRUnichar *aResult, PRUint32 aLen,
int aSelStart, int aSelLen)

Просмотреть файл

@ -162,10 +162,6 @@ public:
void EnableLocation(bool aEnable);
void EnableSensor(int aSensorType);
void DisableSensor(int aSensorType);
void ReturnIMEQueryResult(const PRUnichar *aResult, PRUint32 aLen, int aSelStart, int aSelLen);
void NotifyXreExit();
@ -423,8 +419,6 @@ protected:
jmethodID jAcknowledgeEventSync;
jmethodID jEnableDeviceMotion;
jmethodID jEnableLocation;
jmethodID jEnableSensor;
jmethodID jDisableSensor;
jmethodID jReturnIMEQueryResult;
jmethodID jNotifyAppShellReady;
jmethodID jNotifyXreExit;

Просмотреть файл

@ -55,7 +55,6 @@ jfieldID AndroidGeckoEvent::jGammaField = 0;
jfieldID AndroidGeckoEvent::jXField = 0;
jfieldID AndroidGeckoEvent::jYField = 0;
jfieldID AndroidGeckoEvent::jZField = 0;
jfieldID AndroidGeckoEvent::jDistanceField = 0;
jfieldID AndroidGeckoEvent::jRectField = 0;
jfieldID AndroidGeckoEvent::jNativeWindowField = 0;
@ -170,7 +169,6 @@ AndroidGeckoEvent::InitGeckoEventClass(JNIEnv *jEnv)
jXField = getField("mX", "D");
jYField = getField("mY", "D");
jZField = getField("mZ", "D");
jDistanceField = getField("mDistance", "D");
jRectField = getField("mRect", "Landroid/graphics/Rect;");
jCharactersField = getField("mCharacters", "Ljava/lang/String;");
@ -544,11 +542,6 @@ AndroidGeckoEvent::Init(JNIEnv *jenv, jobject jobj)
break;
}
case PROXIMITY_EVENT: {
mDistance = jenv->GetDoubleField(jobj, jDistanceField);
break;
}
default:
break;
}

Просмотреть файл

@ -445,7 +445,6 @@ public:
double X() { return mX; }
double Y() { return mY; }
double Z() { return mZ; }
double Distance() { return mDistance; }
const nsIntRect& Rect() { return mRect; }
nsAString& Characters() { return mCharacters; }
nsAString& CharactersExtra() { return mCharactersExtra; }
@ -482,7 +481,6 @@ protected:
int mRangeForeColor, mRangeBackColor;
double mAlpha, mBeta, mGamma;
double mX, mY, mZ;
double mDistance;
int mPointerIndex;
nsString mCharacters, mCharactersExtra;
nsRefPtr<nsGeoPosition> mGeoPosition;
@ -521,7 +519,6 @@ protected:
static jfieldID jXField;
static jfieldID jYField;
static jfieldID jZField;
static jfieldID jDistanceField;
static jfieldID jRectField;
static jfieldID jNativeWindowField;
@ -568,7 +565,6 @@ public:
VIEWPORT = 20,
VISITED = 21,
NETWORK_CHANGED = 22,
PROXIMITY_EVENT = 23,
dummy_java_enum_list_end
};

Просмотреть файл

@ -36,10 +36,6 @@
*
* ***** END LICENSE BLOCK ***** */
// Make sure the order of included headers
#include "base/basictypes.h"
#include "nspr/prtypes.h"
#include "mozilla/Hal.h"
#include "nsAppShell.h"
#include "nsWindow.h"
@ -52,7 +48,6 @@
#include "mozilla/Services.h"
#include "mozilla/unused.h"
#include "mozilla/Preferences.h"
#include "mozilla/Hal.h"
#include "prenv.h"
#include "AndroidBridge.h"
@ -360,15 +355,6 @@ nsAppShell::ProcessNextNativeEvent(bool mayWait)
break;
}
case AndroidGeckoEvent::PROXIMITY_EVENT: {
InfallibleTArray<float> values;
values.AppendElement(curEvent->Distance());
hal::SensorData sdata(hal::SENSOR_PROXIMITY, PR_Now(), values);
hal::NotifySensorChange(sdata);
break;
}
case AndroidGeckoEvent::ACTIVITY_STOPPING: {
nsCOMPtr<nsIObserverService> obsServ =
mozilla::services::GetObserverService();