Backout 789f244f34f8, 1bea53f2d067, 577cba6021d2, 4191fe602648 (bug 697641) for win build bustage
authorMarco Bonardo <mbonardo@mozilla.com>
Mon, 16 Jan 2012 15:43:46 +0100
changeset 85815 48b579a0492519c08535360e11c1dc3337fe29a8
parent 85814 789f244f34f8c45d9102cc9d7e59da07cb7862e5
child 85816 82ee45c3759e10732d15d213b1eac46c80e5fc2b
push id805
push userakeybl@mozilla.com
push dateWed, 01 Feb 2012 18:17:35 +0000
treeherdermozilla-aurora@6fb3bf232436 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs697641
milestone12.0a1
backs out789f244f34f8c45d9102cc9d7e59da07cb7862e5
Backout 789f244f34f8, 1bea53f2d067, 577cba6021d2, 4191fe602648 (bug 697641) for win build bustage
embedding/android/GeckoAppShell.java
embedding/android/GeckoEvent.java
hal/Hal.cpp
hal/Hal.h
hal/HalSensor.h
hal/Makefile.in
hal/android/AndroidSensor.cpp
hal/fallback/FallbackSensor.cpp
hal/sandbox/PHal.ipdl
hal/sandbox/SandboxHal.cpp
ipc/glue/IPCMessageUtils.h
widget/android/AndroidBridge.cpp
widget/android/AndroidBridge.h
widget/android/AndroidJavaWrappers.cpp
widget/android/AndroidJavaWrappers.h
widget/android/nsAppShell.cpp
--- a/embedding/android/GeckoAppShell.java
+++ b/embedding/android/GeckoAppShell.java
@@ -660,52 +660,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
@@ -70,17 +70,16 @@ public class GeckoEvent {
     public static final int ACTIVITY_SHUTDOWN = 11;
     public static final int LOAD_URI = 12;
     public static final int SURFACE_CREATED = 13;
     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 PROXIMITY_EVENT = 20;
 
     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;
@@ -98,17 +97,16 @@ public class GeckoEvent {
 
     public int mType;
     public int mAction;
     public long mTime;
     public Point mP0, mP1;
     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;
@@ -142,40 +140,29 @@ public class GeckoEvent {
         mMetaState = m.getMetaState();
         mP0 = new Point((int)m.getX(0), (int)m.getY(0));
         mCount = m.getPointerCount();
         if (mCount > 1)
             mP1 = new Point((int)m.getX(1), (int)m.getY(1));
     }
 
     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
@@ -321,68 +321,10 @@ double GetScreenBrightness()
 }
 
 void SetScreenBrightness(double brightness)
 {
   AssertMainThread();
   PROXY_IF_SANDBOXED(SetScreenBrightness(clamped(brightness, 0.0, 1.0)));
 }
 
-
-void
-EnableSensorNotifications(SensorType aSensor) {
-  AssertMainThread();
-  PROXY_IF_SANDBOXED(EnableSensorNotifications(aSensor));
-}
-
-void
-DisableSensorNotifications(SensorType aSensor) {
-  AssertMainThread();
-  PROXY_IF_SANDBOXED(DisableSensorNotifications(aSensor));
-}
-
-typedef 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);
-}
-
 } // namespace hal
 } // namespace mozilla
--- a/hal/Hal.h
+++ b/hal/Hal.h
@@ -41,17 +41,16 @@
 #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/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
@@ -164,55 +163,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);
 
-
-/**
- * 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);
-
 } // namespace MOZ_HAL_NAMESPACE
 } // namespace mozilla
 
 #ifdef MOZ_DEFINED_HAL_NAMESPACE
 # undef MOZ_DEFINED_HAL_NAMESPACE
 # undef MOZ_HAL_NAMESPACE
 #endif
 
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_ */
--- a/hal/Makefile.in
+++ b/hal/Makefile.in
@@ -56,47 +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 \
   $(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
 else ifeq (Linux,$(OS_TARGET))
-CPPSRCS += \
-  LinuxHal.cpp \
-  FallbackSensor.cpp \
-  $(NULL)
+CPPSRCS += LinuxHal.cpp
 ifdef MOZ_ENABLE_DBUS
 CPPSRCS += UPowerClient.cpp
 endif
 else ifeq (WINNT,$(OS_TARGET))
 CPPSRCS += WindowsHal.cpp WindowsBattery.cpp
 else
-CPPSRCS += \
-  FallbackHal.cpp \
-  FallbackSensor.cpp \
-  $(NULL)
+CPPSRCS += FallbackHal.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
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/sandbox/PHal.ipdl
+++ b/hal/sandbox/PHal.ipdl
@@ -34,36 +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";
-
-using PRTime;
-using mozilla::hal::SensorType;
 
 namespace mozilla {
 
 namespace hal {
   struct BatteryInformation {
     double level;
     bool   charging;
     double remainingTime;
   };
-  
-  struct SensorData {
-    SensorType sensor;
-    PRTime timestamp;
-    float[] values;
-  };
 }
 
 namespace hal_sandbox {
 
 sync protocol PHal {
     manager PContent;
 
 child:
@@ -79,20 +68,13 @@ parent:
       returns (BatteryInformation aBatteryInfo);
 
     sync GetScreenEnabled() returns (bool enabled);
     SetScreenEnabled(bool enabled);
 
     sync GetScreenBrightness() returns (double brightness);
     SetScreenBrightness(double brightness);
 
-child:
-    NotifySensorChange(SensorData aSensorData);
-
-parent:    
-    EnableSensorNotifications(SensorType aSensor);
-    DisableSensorNotifications(SensorType aSensor);
-
     __delete__();
 };
 
 } // namespace hal
 } // namespace mozilla
--- a/hal/sandbox/SandboxHal.cpp
+++ b/hal/sandbox/SandboxHal.cpp
@@ -128,31 +128,18 @@ GetScreenBrightness()
 }
 
 void
 SetScreenBrightness(double brightness)
 {
   Hal()->SendSetScreenBrightness(brightness);
 }
 
-
-void
-EnableSensorNotifications(SensorType aSensor) {
-  Hal()->SendEnableSensorNotifications(aSensor);
-}
-
-void
-DisableSensorNotifications(SensorType aSensor) {
-  Hal()->SendDisableSensorNotifications(aSensor);
-}
-
-
 class HalParent : public PHalParent
-                , public BatteryObserver
-                , public ISensorObserver {
+                , public BatteryObserver {
 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
     // checked that the corresponding window is active, but this check
@@ -232,55 +219,27 @@ public:
   }
 
   NS_OVERRIDE virtual bool
   RecvSetScreenBrightness(const double &brightness)
   {
     hal::SetScreenBrightness(brightness);
     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
-  RecvNotifySensorChange(const hal::SensorData &aSensorData);
 };
 
-bool
-HalChild::RecvNotifySensorChange(const hal::SensorData &aSensorData) {
-  hal::NotifySensorChange(aSensorData);
-  
-  return true;
-}
-
-
 PHalChild* CreateHalChild() {
   return new HalChild();
 }
 
 PHalParent* CreateHalParent() {
   return new HalParent();
 }
 
--- 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/widget/android/AndroidBridge.cpp
+++ b/widget/android/AndroidBridge.cpp
@@ -115,22 +115,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;");
@@ -350,30 +344,16 @@ AndroidBridge::EnableDeviceMotion(bool a
 void
 AndroidBridge::EnableLocation(bool aEnable)
 {
     ALOG_BRIDGE("AndroidBridge::EnableLocation");
     mJNIEnv->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");
     jvalue args[3];
     AutoLocalJNIFrame jniFrame(1);
     args[0].l = mJNIEnv->NewString(aResult, aLen);
     args[1].i = aSelStart;
--- a/widget/android/AndroidBridge.h
+++ b/widget/android/AndroidBridge.h
@@ -137,20 +137,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; }
@@ -374,18 +370,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
@@ -47,17 +47,16 @@ jfieldID AndroidGeckoEvent::jTimeField =
 jfieldID AndroidGeckoEvent::jP0Field = 0;
 jfieldID AndroidGeckoEvent::jP1Field = 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;
@@ -157,17 +156,16 @@ AndroidGeckoEvent::InitGeckoEventClass(J
     jP0Field = getField("mP0", "Landroid/graphics/Point;");
     jP1Field = getField("mP1", "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");
@@ -488,21 +486,16 @@ AndroidGeckoEvent::Init(JNIEnv *jenv, jo
 
         case VIEWPORT:
         case BROADCAST: {
             ReadCharactersField(jenv);
             ReadCharactersExtraField(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
@@ -435,17 +435,16 @@ public:
     const nsIntPoint& P0() { return mP0; }
     const nsIntPoint& P1() { return mP1; }
     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; }
@@ -466,17 +465,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;
     nsString mCharacters, mCharactersExtra;
     nsRefPtr<nsGeoPosition> mGeoPosition;
     nsRefPtr<nsGeoPositionAddress> mGeoAddress;
 
     void ReadP0Field(JNIEnv *jenv);
     void ReadP1Field(JNIEnv *jenv);
     void ReadRectField(JNIEnv *jenv);
     void ReadCharactersField(JNIEnv *jenv);
@@ -489,17 +487,16 @@ protected:
     static jfieldID jP0Field;
     static jfieldID jP1Field;
     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;
@@ -532,17 +529,16 @@ public:
         SURFACE_DESTROYED = 14,
         GECKO_EVENT_SYNC = 15,
         FORCED_RESIZE = 16,
         ACTIVITY_START = 17,
         BROADCAST = 19,
         VIEWPORT = 20,
         TILE_SIZE = 21,
         VISITED = 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,32 +31,27 @@
  * 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 "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>
 
@@ -354,25 +349,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;