Backout 90f7f032757f, 6695904a4a70, 50e98f67df1b & d26e8631514c (bug 697641) for native Android failures and 20289eb83e51 (bug 712378) because it conflicted with the backout CLOSED TREE
authorEd Morley <bmo@edmorley.co.uk>
Thu, 02 Feb 2012 10:09:40 +0000
changeset 89327 b9f70582a48ff4f77f37d71c3be50f84d7ae471a
parent 89326 73d21e8c6ce9feffb2204536a1e28fc9dd0743a1
child 89328 6837feb4fe4ddbdf80a30fd0eb9070de140c1007
push id136
push userlsblakk@mozilla.com
push dateFri, 01 Jun 2012 02:39:32 +0000
treeherdermozilla-release@7ebf7352c959 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs697641, 712378
milestone13.0a1
backs out90f7f032757f137738c43eb1d1edc81ac6a0b143
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backout 90f7f032757f, 6695904a4a70, 50e98f67df1b & d26e8631514c (bug 697641) for native Android failures and 20289eb83e51 (bug 712378) because it conflicted with the backout CLOSED TREE
dom/system/b2g/Makefile.in
embedding/android/GeckoAppShell.java
embedding/android/GeckoEvent.java
hal/Hal.cpp
hal/Hal.h
hal/HalImpl.h
hal/HalSensor.h
hal/HalTypes.h
hal/Makefile.in
hal/android/AndroidSensor.cpp
hal/fallback/FallbackHal.cpp
hal/fallback/FallbackLights.cpp
hal/fallback/FallbackSensor.cpp
hal/gonk/GonkHal.cpp
hal/sandbox/PHal.ipdl
hal/sandbox/SandboxHal.cpp
hal/sandbox/SandboxHal.h
ipc/glue/IPCMessageUtils.h
toolkit/library/Makefile.in
widget/android/AndroidBridge.cpp
widget/android/AndroidBridge.h
widget/android/AndroidJavaWrappers.cpp
widget/android/AndroidJavaWrappers.h
widget/android/nsAppShell.cpp
--- a/dom/system/b2g/Makefile.in
+++ b/dom/system/b2g/Makefile.in
@@ -1,16 +1,43 @@
 # ***** 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            = ../../..
 topsrcdir        = @top_srcdir@
 srcdir           = @srcdir@
 VPATH            = @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
--- a/embedding/android/GeckoAppShell.java
+++ b/embedding/android/GeckoAppShell.java
@@ -674,52 +674,16 @@ public class GeckoAppShell
                         lm.requestLocationUpdates(provider, 100, (float).5, view, l);
                     } else {
                         lm.removeUpdates(view);
                     }
                 }
             });
     }
 
-    /*
-     * 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);
     }
 
     public static void returnIMEQueryResult(String result, int selectionStart, int selectionLength) {
         GeckoApp.surfaceView.inputConnection.mSelectionStart = selectionStart;
         GeckoApp.surfaceView.inputConnection.mSelectionLength = selectionLength;
         try {
--- a/embedding/android/GeckoEvent.java
+++ b/embedding/android/GeckoEvent.java
@@ -74,17 +74,16 @@ public class GeckoEvent {
     public static final int SURFACE_DESTROYED = 14;
     public static final int GECKO_EVENT_SYNC = 15;
     public static final int ACTIVITY_START = 17;
     public static final int SAVE_STATE = 18;
     public static final int BROADCAST = 19;
     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;
     public static final int IME_SET_TEXT = 2;
     public static final int IME_GET_TEXT = 3;
     public static final int IME_DELETE_TEXT = 4;
     public static final int IME_SET_SELECTION = 5;
     public static final int IME_GET_SELECTION = 6;
@@ -107,17 +106,16 @@ public class GeckoEvent {
     public int[] mPointIndicies;
     public int mPointerIndex;
     public float[] mOrientations;
     public float[] mPressures;
     public Point[] mPointRadii;
     public Rect mRect;
     public double mX, mY, mZ;
     public double mAlpha, mBeta, mGamma;
-    public double mDistance;
 
     public int mMetaState, mFlags;
     public int mKeyCode, mUnicodeChar;
     public int mOffset, mCount;
     public String mCharacters, mCharactersExtra;
     public int mRangeType, mRangeStyles;
     public int mRangeForeColor, mRangeBackColor;
     public Location mLocation;
@@ -220,40 +218,29 @@ public class GeckoEvent {
             size = size*Math.min(displaymetrics.heightPixels, displaymetrics.widthPixels);
             mPointRadii[index] = new Point((int)size,(int)size);
             mOrientations[index] = 0;
         }
         mPressures[index] = event.getPressure(eventIndex);
     }
 
     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;
         }
     }
 
     public GeckoEvent(Location l, Address a) {
         mType = LOCATION_EVENT;
         mLocation = l;
         mAddress  = a;
     }
--- a/hal/Hal.cpp
+++ b/hal/Hal.cpp
@@ -1,17 +1,44 @@
 /* -*- 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 ***** */
 
 #include "Hal.h"
 #include "HalImpl.h"
 #include "HalSandbox.h"
 #include "mozilla/Util.h"
 #include "nsThreadUtils.h"
@@ -168,17 +195,17 @@ CancelVibrate(const WindowIdentifier &id
 }
 
 template <class InfoType>
 class ObserversManager
 {
 public:
   void AddObserver(Observer<InfoType>* aObserver) {
     if (!mObservers) {
-      mObservers = new mozilla::ObserverList<InfoType>();
+      mObservers = new ObserverList<InfoType>();
     }
 
     mObservers->AddObserver(aObserver);
 
     if (mObservers->Length() == 1) {
       EnableNotifications();
     }
   }
@@ -218,17 +245,17 @@ public:
   }
 
 protected:
   virtual void EnableNotifications() = 0;
   virtual void DisableNotifications() = 0;
   virtual void GetCurrentInformationInternal(InfoType*) = 0;
 
 private:
-  mozilla::ObserverList<InfoType>* mObservers;
+  ObserverList<InfoType>* mObservers;
   InfoType                mInfo;
   bool                    mHasValidCache;
 };
 
 class BatteryObserversManager : public ObserversManager<BatteryInformation>
 {
 protected:
   void EnableNotifications() {
@@ -312,85 +339,16 @@ double GetScreenBrightness()
 }
 
 void SetScreenBrightness(double brightness)
 {
   AssertMainThread();
   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)
 {
   AssertMainThread();
   sNetworkObservers.AddObserver(aObserver);
 }
 
 void
--- a/hal/Hal.h
+++ b/hal/Hal.h
@@ -1,31 +1,57 @@
 /* -*- 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 ***** */
 
 #ifndef mozilla_Hal_h
 #define mozilla_Hal_h 1
 
 #include "mozilla/hal_sandbox/PHal.h"
 #include "base/basictypes.h"
 #include "mozilla/Types.h"
 #include "nsTArray.h"
 #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.
  *
  * By default, this file defines its functions in the hal namespace, but if
  * MOZ_HAL_NAMESPACE is defined, we'll define our functions in that namespace.
  *
  * This is used by HalImpl.h and HalSandbox.h, which define copies of all the
@@ -139,73 +165,16 @@ double GetScreenBrightness();
  * Note that we may reduce the resolution of the given brightness value before
  * sending it to the screen.  Therefore if you call SetScreenBrightness(x)
  * followed by GetScreenBrightness(), the value returned by
  * GetScreenBrightness() may not be exactly x.
  */
 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.
  */
 void RegisterNetworkObserver(NetworkObserver* aNetworkObserver);
 
 /**
  * Inform the network backend a network observer unregistered.
  * @param aNetworkObserver The observer that should be removed.
--- a/hal/HalImpl.h
+++ b/hal/HalImpl.h
@@ -1,17 +1,45 @@
 /* -*- 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
 #define mozilla_HalImpl_h
 
 #define MOZ_HAL_NAMESPACE hal_impl
 #undef mozilla_Hal_h
 #undef mozilla_HalInternal_h
deleted file mode 100644
--- a/hal/HalSensor.h
+++ /dev/null
@@ -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_ */
deleted file mode 100644
--- a/hal/HalTypes.h
+++ /dev/null
@@ -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
--- a/hal/Makefile.in
+++ b/hal/Makefile.in
@@ -56,61 +56,37 @@ FORCE_STATIC_LIB = 1
 LIBXUL_LIBRARY = 1
 EXPORT_LIBRARY = 1
 
 EXPORTS_NAMESPACES = mozilla
 EXPORTS_mozilla = \
   Hal.h \
   HalImpl.h \
   HalSandbox.h \
-  HalSensor.h \
-  HalTypes.h \
   $(NULL)
 
 CPPSRCS = \
   Hal.cpp \
   SandboxHal.cpp \
   WindowIdentifier.cpp \
   $(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
 
 CFLAGS          += $(MOZ_DBUS_GLIB_CFLAGS)
 CXXFLAGS        += $(MOZ_DBUS_GLIB_CFLAGS)
deleted file mode 100644
--- a/hal/android/AndroidSensor.cpp
+++ /dev/null
@@ -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
--- a/hal/fallback/FallbackHal.cpp
+++ b/hal/fallback/FallbackHal.cpp
@@ -1,17 +1,44 @@
 /* -*- 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 ***** */
 
 #include "Hal.h"
 #include "mozilla/dom/battery/Constants.h"
 #include "mozilla/dom/network/Constants.h"
 
 using mozilla::hal::WindowIdentifier;
deleted file mode 100644
--- a/hal/fallback/FallbackLights.cpp
+++ /dev/null
@@ -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
deleted file mode 100644
--- a/hal/fallback/FallbackSensor.cpp
+++ /dev/null
@@ -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) {
-}
-
-}
-}
--- a/hal/gonk/GonkHal.cpp
+++ b/hal/gonk/GonkHal.cpp
@@ -1,19 +1,46 @@
 /* -*- 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 ***** */
 
 #include "hardware_legacy/uevent.h"
 #include "Hal.h"
 #include "HalImpl.h"
 #include "mozilla/dom/battery/Constants.h"
 #include "mozilla/FileUtils.h"
@@ -22,18 +49,16 @@
 #include "mozilla/Monitor.h"
 #include "mozilla/Services.h"
 #include "mozilla/FileUtils.h"
 #include "nsThreadUtils.h"
 #include "nsIRunnable.h"
 #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>
 #include <fcntl.h>
 #include <errno.h>
 #include "mozilla/dom/network/Constants.h"
 
 using mozilla::hal::WindowIdentifier;
@@ -284,16 +309,17 @@ GetCurrentBatteryInformation(hal::Batter
 }
 
 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])
 {
   int fd = open(filename, O_RDONLY);
   ScopedClose autoClose(fd);
   if (fd < 0) {
     HAL_LOG(("Unable to open file %s.", filename));
@@ -343,152 +369,55 @@ SetScreenEnabled(bool enabled)
 {
   WriteToFile(screenEnabledFilename, enabled ? "on" : "mem");
   sScreenEnabled = 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
 SetScreenBrightness(double brightness)
 {
   // Don't use De Morgan's law to push the ! into this expression; we want to
   // catch NaN too.
   if (!(0 <= brightness && brightness <= 1)) {
     HAL_LOG(("SetScreenBrightness: Dropping illegal brightness %f.",
              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;
-
-  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);
-        }
-    }
-}
+  char str[4];
+  DebugOnly<int> numChars = snprintf(str, sizeof(str), "%d", val);
+  MOZ_ASSERT(numChars < static_cast<int>(sizeof(str)));
 
-/**
- * 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
 EnableNetworkNotifications()
 {}
 
 void
 DisableNetworkNotifications()
--- a/hal/sandbox/PHal.ipdl
+++ b/hal/sandbox/PHal.ipdl
@@ -34,49 +34,25 @@
  * 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 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 {
 
 namespace hal {
   struct BatteryInformation {
     double level;
     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 {
   struct NetworkInformation {
     double bandwidth;
     bool   canBeMetered;
   };
 }
@@ -84,17 +60,16 @@ namespace hal {
 namespace hal_sandbox {
 
 sync protocol PHal {
     manager PContent;
 
 child:
     NotifyBatteryChange(BatteryInformation aBatteryInfo);
     NotifyNetworkChange(NetworkInformation aNetworkInfo);
-    NotifySensorChange(SensorData aSensorData);
 
 parent:
     Vibrate(uint32[] pattern, uint64[] id, PBrowser browser);
     CancelVibrate(uint64[] id, PBrowser browser);
 
     EnableBatteryNotifications();
     DisableBatteryNotifications();
     sync GetCurrentBatteryInformation()
@@ -106,24 +81,16 @@ parent:
       returns (NetworkInformation aNetworkInfo);
 
     sync GetScreenEnabled() returns (bool enabled);
     SetScreenEnabled(bool enabled);
 
     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__();
 };
 
 } // namespace hal
 } // namespace mozilla
--- a/hal/sandbox/SandboxHal.cpp
+++ b/hal/sandbox/SandboxHal.cpp
@@ -1,17 +1,44 @@
 /* -*- 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 ***** */
 
 #include "Hal.h"
 #include "mozilla/dom/ContentChild.h"
 #include "mozilla/hal_sandbox/PHalChild.h"
 #include "mozilla/hal_sandbox/PHalParent.h"
 #include "mozilla/dom/TabParent.h"
@@ -120,58 +147,31 @@ GetScreenBrightness()
 }
 
 void
 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()
 {
   Hal()->SendReboot();
 }
 
 void
 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
   RecvVibrate(const InfallibleTArray<unsigned int>& pattern,
               const InfallibleTArray<uint64> &id,
               PBrowserParent *browserParent)
   {
     // Check whether browserParent is active.  We should have already
@@ -276,79 +276,43 @@ public:
   NS_OVERRIDE virtual bool
   RecvSetScreenBrightness(const double &brightness)
   {
     hal::SetScreenBrightness(brightness);
     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()
   {
     hal::Reboot();
     return true;
   }
 
   NS_OVERRIDE virtual bool
   RecvPowerOff()
   {
     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 {
 public:
   NS_OVERRIDE virtual bool
   RecvNotifyBatteryChange(const BatteryInformation& aBatteryInfo) {
     hal::NotifyBatteryChange(aBatteryInfo);
     return true;
   }
 
   NS_OVERRIDE virtual bool
   RecvNotifyNetworkChange(const NetworkInformation& aNetworkInfo) {
     hal::NotifyNetworkChange(aNetworkInfo);
     return true;
   }
-
-  NS_OVERRIDE virtual bool
-  RecvNotifySensorChange(const hal::SensorData &aSensorData) {
-    hal::NotifySensorChange(aSensorData);
-    return true;
-  }
 };
 
 PHalChild* CreateHalChild() {
   return new HalChild();
 }
 
 PHalParent* CreateHalParent() {
   return new HalParent();
--- a/hal/sandbox/SandboxHal.h
+++ b/hal/sandbox/SandboxHal.h
@@ -1,17 +1,45 @@
 /* -*- 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
 #define mozilla_SandboxHal_h
 
 namespace mozilla {
 namespace hal_sandbox {
 
--- a/ipc/glue/IPCMessageUtils.h
+++ b/ipc/glue/IPCMessageUtils.h
@@ -93,43 +93,27 @@ struct null_t {
 };
 
 } // namespace mozilla
 
 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) {
     MOZ_ASSERT(IsLegalValue(aValue));
     WriteParam(aMsg, (int32)aValue);
   }
 
   static bool Read(const Message* aMsg, void** aIter, paramType* aResult) {
--- a/toolkit/library/Makefile.in
+++ b/toolkit/library/Makefile.in
@@ -1,16 +1,44 @@
 #
 # ***** 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     = ../..
 topsrcdir = @top_srcdir@
 srcdir    = @srcdir@
 VPATH     = @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
--- a/widget/android/AndroidBridge.cpp
+++ b/widget/android/AndroidBridge.cpp
@@ -102,22 +102,16 @@ AndroidBridge::Init(JNIEnv *jEnv,
 
     jNotifyIME = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "notifyIME", "(II)V");
     jNotifyIMEEnabled = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "notifyIMEEnabled", "(ILjava/lang/String;Ljava/lang/String;Z)V");
     jNotifyIMEChange = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "notifyIMEChange", "(Ljava/lang/String;III)V");
     jAcknowledgeEventSync = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "acknowledgeEventSync", "()V");
 
     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");
     jGetHandlersForMimeType = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "getHandlersForMimeType", "(Ljava/lang/String;Ljava/lang/String;)[Ljava/lang/String;");
     jGetHandlersForURL = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "getHandlersForURL", "(Ljava/lang/String;Ljava/lang/String;)[Ljava/lang/String;");
     jOpenUriExternal = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "openUriExternal", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Z");
     jGetMimeTypeFromExtensions = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "getMimeTypeFromExtensions", "(Ljava/lang/String;)Ljava/lang/String;");
     jGetExtensionFromMimeType = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "getExtensionFromMimeType", "(Ljava/lang/String;)Ljava/lang/String;");
@@ -317,30 +311,16 @@ AndroidBridge::EnableLocation(bool aEnab
     JNIEnv *env = GetJNIEnv();
     if (!env)
         return;
     
     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)
 {
     ALOG_BRIDGE("AndroidBridge::ReturnIMEQueryResult");
 
     JNIEnv *env = GetJNIEnv();
     if (!env)
         return;
--- a/widget/android/AndroidBridge.h
+++ b/widget/android/AndroidBridge.h
@@ -157,20 +157,16 @@ public:
     static void NotifyIMEChange(const PRUnichar *aText, PRUint32 aTextLen, int aStart, int aEnd, int aNewEnd);
 
     void AcknowledgeEventSync();
 
     void EnableDeviceMotion(bool aEnable);
 
     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();
 
     void ScheduleRestart();
 
     void SetSoftwareLayerClient(jobject jobj);
     AndroidGeckoSoftwareLayerClient &GetSoftwareLayerClient() { return mSoftwareLayerClient; }
@@ -418,18 +414,16 @@ protected:
 
     // other things
     jmethodID jNotifyIME;
     jmethodID jNotifyIMEEnabled;
     jmethodID jNotifyIMEChange;
     jmethodID jAcknowledgeEventSync;
     jmethodID jEnableDeviceMotion;
     jmethodID jEnableLocation;
-    jmethodID jEnableSensor;
-    jmethodID jDisableSensor;
     jmethodID jReturnIMEQueryResult;
     jmethodID jNotifyAppShellReady;
     jmethodID jNotifyXreExit;
     jmethodID jScheduleRestart;
     jmethodID jGetOutstandingDrawEvents;
     jmethodID jGetHandlersForMimeType;
     jmethodID jGetHandlersForURL;
     jmethodID jOpenUriExternal;
--- a/widget/android/AndroidJavaWrappers.cpp
+++ b/widget/android/AndroidJavaWrappers.cpp
@@ -50,17 +50,16 @@ jfieldID AndroidGeckoEvent::jPressures =
 jfieldID AndroidGeckoEvent::jPointRadii = 0;
 jfieldID AndroidGeckoEvent::jOrientations = 0;
 jfieldID AndroidGeckoEvent::jAlphaField = 0;
 jfieldID AndroidGeckoEvent::jBetaField = 0;
 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;
 
 jfieldID AndroidGeckoEvent::jCharactersField = 0;
 jfieldID AndroidGeckoEvent::jCharactersExtraField = 0;
 jfieldID AndroidGeckoEvent::jKeyCodeField = 0;
 jfieldID AndroidGeckoEvent::jMetaStateField = 0;
 jfieldID AndroidGeckoEvent::jFlagsField = 0;
@@ -165,17 +164,16 @@ AndroidGeckoEvent::InitGeckoEventClass(J
     jPressures = getField("mPressures", "[F");
     jPointRadii = getField("mPointRadii", "[Landroid/graphics/Point;");
     jAlphaField = getField("mAlpha", "D");
     jBetaField = getField("mBeta", "D");
     jGammaField = getField("mGamma", "D");
     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;");
     jCharactersExtraField = getField("mCharactersExtra", "Ljava/lang/String;");
     jKeyCodeField = getField("mKeyCode", "I");
     jMetaStateField = getField("mMetaState", "I");
     jFlagsField = getField("mFlags", "I");
     jUnicodeCharField = getField("mUnicodeChar", "I");
@@ -539,21 +537,16 @@ AndroidGeckoEvent::Init(JNIEnv *jenv, jo
             break;
         }
 
         case VISITED: {
             ReadCharactersField(jenv);
             break;
         }
 
-        case PROXIMITY_EVENT: {
-            mDistance = jenv->GetDoubleField(jobj, jDistanceField);
-            break;
-        }
-
         default:
             break;
     }
 
 #ifndef DEBUG_ANDROID_EVENTS
     ALOG("AndroidGeckoEvent: %p : %d", (void*)jobj, mType);
 #endif
 }
--- a/widget/android/AndroidJavaWrappers.h
+++ b/widget/android/AndroidJavaWrappers.h
@@ -440,17 +440,16 @@ public:
     nsTArray<float> Orientations() { return mOrientations; }
     nsTArray<nsIntPoint> PointRadii() { return mPointRadii; }
     double Alpha() { return mAlpha; }
     double Beta() { return mBeta; }
     double Gamma() { return mGamma; }
     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; }
     int KeyCode() { return mKeyCode; }
     int MetaState() { return mMetaState; }
     int Flags() { return mFlags; }
     int UnicodeChar() { return mUnicodeChar; }
     int Offset() { return mOffset; }
@@ -477,17 +476,16 @@ protected:
     nsIntRect mRect;
     int mFlags, mMetaState;
     int mKeyCode, mUnicodeChar;
     int mOffset, mCount;
     int mRangeType, mRangeStyles;
     int mRangeForeColor, mRangeBackColor;
     double mAlpha, mBeta, mGamma;
     double mX, mY, mZ;
-    double mDistance;
     int mPointerIndex;
     nsString mCharacters, mCharactersExtra;
     nsRefPtr<nsGeoPosition> mGeoPosition;
     nsRefPtr<nsGeoPositionAddress> mGeoAddress;
     double mBandwidth;
     bool mCanBeMetered;
 
     void ReadIntArray(nsTArray<int> &aVals,
@@ -516,17 +514,16 @@ protected:
     static jfieldID jPressures;
     static jfieldID jPointRadii;
     static jfieldID jAlphaField;
     static jfieldID jBetaField;
     static jfieldID jGammaField;
     static jfieldID jXField;
     static jfieldID jYField;
     static jfieldID jZField;
-    static jfieldID jDistanceField;
     static jfieldID jRectField;
     static jfieldID jNativeWindowField;
 
     static jfieldID jCharactersField;
     static jfieldID jCharactersExtraField;
     static jfieldID jKeyCodeField;
     static jfieldID jMetaStateField;
     static jfieldID jFlagsField;
@@ -563,17 +560,16 @@ public:
         SURFACE_DESTROYED = 14,
         GECKO_EVENT_SYNC = 15,
         FORCED_RESIZE = 16,
         ACTIVITY_START = 17,
         BROADCAST = 19,
         VIEWPORT = 20,
         VISITED = 21,
         NETWORK_CHANGED = 22,
-        PROXIMITY_EVENT = 23,
         dummy_java_enum_list_end
     };
 
     enum {
         IME_COMPOSITION_END = 0,
         IME_COMPOSITION_BEGIN = 1,
         IME_SET_TEXT = 2,
         IME_GET_TEXT = 3,
--- a/widget/android/nsAppShell.cpp
+++ b/widget/android/nsAppShell.cpp
@@ -31,33 +31,28 @@
  * 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 ***** */
 
-// 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"
 #include "nsThreadUtils.h"
 #include "nsICommandLineRunner.h"
 #include "nsIObserverService.h"
 #include "nsIAppStartup.h"
 #include "nsIGeolocationProvider.h"
 
 #include "mozilla/Services.h"
 #include "mozilla/unused.h"
 #include "mozilla/Preferences.h"
-#include "mozilla/Hal.h"
 #include "prenv.h"
 
 #include "AndroidBridge.h"
 #include "nsDeviceMotionSystem.h"
 #include <android/log.h>
 #include <pthread.h>
 #include <wchar.h>
 
@@ -355,25 +350,16 @@ nsAppShell::ProcessNextNativeEvent(bool 
             p->SetAddress(a);
             gLocationCallback->Update(curEvent->GeoPosition());
         }
         else
             NS_WARNING("Received location event without geoposition!");
         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();
         NS_NAMED_LITERAL_STRING(minimize, "heap-minimize");
         obsServ->NotifyObservers(nsnull, "memory-pressure", minimize.get());
         obsServ->NotifyObservers(nsnull, "application-background", nsnull);
 
         break;