Bug 1289208 - Remove gamepad events from GeckoEvent; r=snorp
authorJim Chen <nchen@mozilla.com>
Thu, 04 Aug 2016 09:16:05 -0400
changeset 308205 40578d56c4ff22bb260209ee626372edd758de00
parent 308204 86b4155ce94b3ac028dc4c62a62452f439e1a20b
child 308206 79374eef5dcee186392595e1de8a4eea1c69ce67
push id31092
push usercbook@mozilla.com
push dateFri, 05 Aug 2016 10:16:59 +0000
treeherderautoland@b97dd7dd3cb9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssnorp
bugs1289208
milestone51.0a1
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
Bug 1289208 - Remove gamepad events from GeckoEvent; r=snorp Remove the now-obsolete gamepad events from GeckoEvent, along with a few other used fields in GeckoEvent.
mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoEvent.java
widget/android/AndroidJavaWrappers.cpp
widget/android/AndroidJavaWrappers.h
widget/android/nsAppShell.cpp
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoEvent.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoEvent.java
@@ -64,119 +64,51 @@ public class GeckoEvent {
     // AndroidGeckoEvent in widget/android/AndroidJavaWrappers.h
     @JNITarget
     public enum NativeGeckoEvent {
         MOTION_EVENT(2),
         VIEWPORT(20),
         NATIVE_GESTURE_EVENT(31),
         CALL_OBSERVER(33),
         REMOVE_OBSERVER(34),
-        GAMEPAD_ADDREMOVE(45),
-        GAMEPAD_DATA(46),
         LONG_PRESS(47);
 
         public final int value;
 
         private NativeGeckoEvent(int value) {
             this.value = value;
         }
     }
 
     public static final int ACTION_MAGNIFY_START = 11;
     public static final int ACTION_MAGNIFY = 12;
     public static final int ACTION_MAGNIFY_END = 13;
 
-    public static final int ACTION_GAMEPAD_ADDED = 1;
-    public static final int ACTION_GAMEPAD_REMOVED = 2;
-
-    public static final int ACTION_GAMEPAD_BUTTON = 1;
-    public static final int ACTION_GAMEPAD_AXES = 2;
-
     private final int mType;
     private int mAction;
     private long mTime;
     private Point[] mPoints;
     private int[] mPointIndicies;
     private int mPointerIndex; // index of the point that has changed
     private float[] mOrientations;
     private float[] mPressures;
     private int[] mToolTypes;
     private Point[] mPointRadii;
-    private Rect mRect;
     private double mX;
-    private double mY;
-    private double mZ;
-    private double mW;
 
     private int mMetaState;
-    private int mFlags;
     private int mCount;
     private String mCharacters;
     private String mCharactersExtra;
     private String mData;
 
-    private int mWidth;
-    private int mHeight;
-
-    private int mID;
-    private int mGamepadButton;
-    private boolean mGamepadButtonPressed;
-    private float mGamepadButtonValue;
-    private float[] mGamepadValues;
-
     private GeckoEvent(NativeGeckoEvent event) {
         mType = event.value;
     }
 
-    /**
-     * This method is a replacement for the the KeyEvent.isGamepadButton method to be
-     * compatible with Build.VERSION.SDK_INT < 12. This is an implementation of the
-     * same method isGamepadButton available after SDK 12.
-     * @param keyCode int with the key code (Android key constant from KeyEvent).
-     * @return True if the keycode is a gamepad button, such as {@link #KEYCODE_BUTTON_A}.
-     */
-    private static boolean isGamepadButton(int keyCode) {
-        switch (keyCode) {
-            case KeyEvent.KEYCODE_BUTTON_A:
-            case KeyEvent.KEYCODE_BUTTON_B:
-            case KeyEvent.KEYCODE_BUTTON_C:
-            case KeyEvent.KEYCODE_BUTTON_X:
-            case KeyEvent.KEYCODE_BUTTON_Y:
-            case KeyEvent.KEYCODE_BUTTON_Z:
-            case KeyEvent.KEYCODE_BUTTON_L1:
-            case KeyEvent.KEYCODE_BUTTON_R1:
-            case KeyEvent.KEYCODE_BUTTON_L2:
-            case KeyEvent.KEYCODE_BUTTON_R2:
-            case KeyEvent.KEYCODE_BUTTON_THUMBL:
-            case KeyEvent.KEYCODE_BUTTON_THUMBR:
-            case KeyEvent.KEYCODE_BUTTON_START:
-            case KeyEvent.KEYCODE_BUTTON_SELECT:
-            case KeyEvent.KEYCODE_BUTTON_MODE:
-            case KeyEvent.KEYCODE_BUTTON_1:
-            case KeyEvent.KEYCODE_BUTTON_2:
-            case KeyEvent.KEYCODE_BUTTON_3:
-            case KeyEvent.KEYCODE_BUTTON_4:
-            case KeyEvent.KEYCODE_BUTTON_5:
-            case KeyEvent.KEYCODE_BUTTON_6:
-            case KeyEvent.KEYCODE_BUTTON_7:
-            case KeyEvent.KEYCODE_BUTTON_8:
-            case KeyEvent.KEYCODE_BUTTON_9:
-            case KeyEvent.KEYCODE_BUTTON_10:
-            case KeyEvent.KEYCODE_BUTTON_11:
-            case KeyEvent.KEYCODE_BUTTON_12:
-            case KeyEvent.KEYCODE_BUTTON_13:
-            case KeyEvent.KEYCODE_BUTTON_14:
-            case KeyEvent.KEYCODE_BUTTON_15:
-            case KeyEvent.KEYCODE_BUTTON_16:
-                return true;
-            default:
-                return false;
-        }
-    }
-
     public static GeckoEvent createNativeGestureEvent(int action, PointF pt, double size) {
         try {
             GeckoEvent event = GeckoEvent.get(NativeGeckoEvent.NATIVE_GESTURE_EVENT);
             event.mAction = action;
             event.mCount = 1;
             event.mPoints = new Point[1];
 
             PointF geckoPoint = new PointF(pt.x, pt.y);
@@ -333,50 +265,9 @@ public class GeckoEvent {
         return event;
     }
 
     public static GeckoEvent createRemoveObserverEvent(String observerKey) {
         GeckoEvent event = GeckoEvent.get(NativeGeckoEvent.REMOVE_OBSERVER);
         event.mCharacters = observerKey;
         return event;
     }
-
-    public static GeckoEvent createGamepadAddRemoveEvent(int id, boolean added) {
-        GeckoEvent event = GeckoEvent.get(NativeGeckoEvent.GAMEPAD_ADDREMOVE);
-        event.mID = id;
-        event.mAction = added ? ACTION_GAMEPAD_ADDED : ACTION_GAMEPAD_REMOVED;
-        return event;
-    }
-
-    private static int boolArrayToBitfield(boolean[] array) {
-        int bits = 0;
-        for (int i = 0; i < array.length; i++) {
-            if (array[i]) {
-                bits |= 1 << i;
-            }
-        }
-        return bits;
-    }
-
-    public static GeckoEvent createGamepadButtonEvent(int id,
-                                                      int which,
-                                                      boolean pressed,
-                                                      float value) {
-        GeckoEvent event = GeckoEvent.get(NativeGeckoEvent.GAMEPAD_DATA);
-        event.mID = id;
-        event.mAction = ACTION_GAMEPAD_BUTTON;
-        event.mGamepadButton = which;
-        event.mGamepadButtonPressed = pressed;
-        event.mGamepadButtonValue = value;
-        return event;
-    }
-
-    public static GeckoEvent createGamepadAxisEvent(int id, boolean[] valid,
-                                                    float[] values) {
-        GeckoEvent event = GeckoEvent.get(NativeGeckoEvent.GAMEPAD_DATA);
-        event.mID = id;
-        event.mAction = ACTION_GAMEPAD_AXES;
-        event.mFlags = boolArrayToBitfield(valid);
-        event.mCount = values.length;
-        event.mGamepadValues = values;
-        return event;
-    }
 }
--- a/widget/android/AndroidJavaWrappers.cpp
+++ b/widget/android/AndroidJavaWrappers.cpp
@@ -21,36 +21,23 @@ jfieldID AndroidGeckoEvent::jTypeField =
 jfieldID AndroidGeckoEvent::jTimeField = 0;
 jfieldID AndroidGeckoEvent::jPoints = 0;
 jfieldID AndroidGeckoEvent::jPointIndicies = 0;
 jfieldID AndroidGeckoEvent::jPressures = 0;
 jfieldID AndroidGeckoEvent::jToolTypes = 0;
 jfieldID AndroidGeckoEvent::jPointRadii = 0;
 jfieldID AndroidGeckoEvent::jOrientations = 0;
 jfieldID AndroidGeckoEvent::jXField = 0;
-jfieldID AndroidGeckoEvent::jYField = 0;
-jfieldID AndroidGeckoEvent::jZField = 0;
-jfieldID AndroidGeckoEvent::jWField = 0;
-jfieldID AndroidGeckoEvent::jDistanceField = 0;
-jfieldID AndroidGeckoEvent::jRectField = 0;
 
 jfieldID AndroidGeckoEvent::jCharactersField = 0;
 jfieldID AndroidGeckoEvent::jCharactersExtraField = 0;
 jfieldID AndroidGeckoEvent::jDataField = 0;
 jfieldID AndroidGeckoEvent::jMetaStateField = 0;
-jfieldID AndroidGeckoEvent::jFlagsField = 0;
 jfieldID AndroidGeckoEvent::jCountField = 0;
 jfieldID AndroidGeckoEvent::jPointerIndexField = 0;
-jfieldID AndroidGeckoEvent::jWidthField = 0;
-jfieldID AndroidGeckoEvent::jHeightField = 0;
-jfieldID AndroidGeckoEvent::jIDField = 0;
-jfieldID AndroidGeckoEvent::jGamepadButtonField = 0;
-jfieldID AndroidGeckoEvent::jGamepadButtonPressedField = 0;
-jfieldID AndroidGeckoEvent::jGamepadButtonValueField = 0;
-jfieldID AndroidGeckoEvent::jGamepadValuesField = 0;
 
 jclass AndroidPoint::jPointClass = 0;
 jfieldID AndroidPoint::jXField = 0;
 jfieldID AndroidPoint::jYField = 0;
 
 jclass AndroidRect::jRectClass = 0;
 jfieldID AndroidRect::jBottomField = 0;
 jfieldID AndroidRect::jLeftField = 0;
@@ -89,35 +76,23 @@ AndroidGeckoEvent::InitGeckoEventClass(J
     jTimeField = geckoEvent.getField("mTime", "J");
     jPoints = geckoEvent.getField("mPoints", "[Landroid/graphics/Point;");
     jPointIndicies = geckoEvent.getField("mPointIndicies", "[I");
     jOrientations = geckoEvent.getField("mOrientations", "[F");
     jPressures = geckoEvent.getField("mPressures", "[F");
     jToolTypes = geckoEvent.getField("mToolTypes", "[I");
     jPointRadii = geckoEvent.getField("mPointRadii", "[Landroid/graphics/Point;");
     jXField = geckoEvent.getField("mX", "D");
-    jYField = geckoEvent.getField("mY", "D");
-    jZField = geckoEvent.getField("mZ", "D");
-    jWField = geckoEvent.getField("mW", "D");
-    jRectField = geckoEvent.getField("mRect", "Landroid/graphics/Rect;");
 
     jCharactersField = geckoEvent.getField("mCharacters", "Ljava/lang/String;");
     jCharactersExtraField = geckoEvent.getField("mCharactersExtra", "Ljava/lang/String;");
     jDataField = geckoEvent.getField("mData", "Ljava/lang/String;");
     jMetaStateField = geckoEvent.getField("mMetaState", "I");
-    jFlagsField = geckoEvent.getField("mFlags", "I");
     jCountField = geckoEvent.getField("mCount", "I");
     jPointerIndexField = geckoEvent.getField("mPointerIndex", "I");
-    jWidthField = geckoEvent.getField("mWidth", "I");
-    jHeightField = geckoEvent.getField("mHeight", "I");
-    jIDField = geckoEvent.getField("mID", "I");
-    jGamepadButtonField = geckoEvent.getField("mGamepadButton", "I");
-    jGamepadButtonPressedField = geckoEvent.getField("mGamepadButtonPressed", "Z");
-    jGamepadButtonValueField = geckoEvent.getField("mGamepadButtonValue", "F");
-    jGamepadValuesField = geckoEvent.getField("mGamepadValues", "[F");
 }
 
 void
 AndroidPoint::InitPointClass(JNIEnv *jEnv)
 {
     AutoJNIClass point(jEnv, "android/graphics/Point");
     jPointClass = point.getGlobalRef();
 
@@ -204,30 +179,16 @@ AndroidGeckoEvent::ReadStringArray(nsTAr
     nsString *strings = array.AppendElements(length);
     for (jsize i = 0; i < length; ++i) {
         jstring javastring = (jstring) jenv->GetObjectArrayElement(jStringArray, i);
         ReadStringFromJString(strings[i], jenv, javastring);
     }
 }
 
 void
-AndroidGeckoEvent::ReadRectField(JNIEnv *jenv)
-{
-    AndroidRect r(jenv, jenv->GetObjectField(wrappedObject(), jRectField));
-    if (!r.isNull()) {
-        mRect.SetRect(r.Left(),
-                      r.Top(),
-                      r.Width(),
-                      r.Height());
-    } else {
-        mRect.SetEmpty();
-    }
-}
-
-void
 AndroidGeckoEvent::ReadStringFromJString(nsString &aString, JNIEnv *jenv,
                                          jstring s)
 {
     if (!s) {
         aString.SetIsVoid(true);
         return;
     }
 
@@ -253,22 +214,16 @@ AndroidGeckoEvent::ReadCharactersExtraFi
 void
 AndroidGeckoEvent::ReadDataField(JNIEnv *jenv)
 {
     jstring s = (jstring) jenv->GetObjectField(wrapped_obj, jDataField);
     ReadStringFromJString(mData, jenv, s);
 }
 
 void
-AndroidGeckoEvent::UnionRect(nsIntRect const& aRect)
-{
-    mRect = aRect.Union(mRect);
-}
-
-void
 AndroidGeckoEvent::Init(JNIEnv *jenv, jobject jobj)
 {
     NS_ASSERTION(!wrapped_obj, "Init called on non-null wrapped_obj!");
 
     wrapped_obj = jobj;
 
     if (!jobj)
         return;
@@ -315,36 +270,16 @@ AndroidGeckoEvent::Init(JNIEnv *jenv, jo
             break;
         }
 
         case REMOVE_OBSERVER: {
             ReadCharactersField(jenv);
             break;
         }
 
-        case GAMEPAD_ADDREMOVE: {
-            mID = jenv->GetIntField(jobj, jIDField);
-            break;
-        }
-
-        case GAMEPAD_DATA: {
-            mID = jenv->GetIntField(jobj, jIDField);
-            if (mAction == ACTION_GAMEPAD_BUTTON) {
-                mGamepadButton = jenv->GetIntField(jobj, jGamepadButtonField);
-                mGamepadButtonPressed = jenv->GetBooleanField(jobj, jGamepadButtonPressedField);
-                mGamepadButtonValue = jenv->GetFloatField(jobj, jGamepadButtonValueField);
-            } else if (mAction == ACTION_GAMEPAD_AXES) {
-                // Flags is a bitfield of valid entries in gamepadvalues
-                mFlags = jenv->GetIntField(jobj, jFlagsField);
-                mCount = jenv->GetIntField(jobj, jCountField);
-                ReadFloatArray(mGamepadValues, jenv, jGamepadValuesField, mCount);
-            }
-            break;
-        }
-
         default:
             break;
     }
 
 #ifdef DEBUG_ANDROID_EVENTS
     ALOG("AndroidGeckoEvent: %p : %d", (void*)jobj, mType);
 #endif
 }
--- a/widget/android/AndroidJavaWrappers.h
+++ b/widget/android/AndroidJavaWrappers.h
@@ -452,72 +452,52 @@ public:
     int64_t Time() { return mTime; }
     const nsTArray<nsIntPoint>& Points() { return mPoints; }
     const nsTArray<int>& PointIndicies() { return mPointIndicies; }
     const nsTArray<float>& Pressures() { return mPressures; }
     const nsTArray<int>& ToolTypes() { return mToolTypes; }
     const nsTArray<float>& Orientations() { return mOrientations; }
     const nsTArray<nsIntPoint>& PointRadii() { return mPointRadii; }
     double X() { return mX; }
-    double Y() { return mY; }
-    double Z() { return mZ; }
-    double W() { return mW; }
-    const nsIntRect& Rect() { return mRect; }
     nsString& Characters() { return mCharacters; }
     nsString& CharactersExtra() { return mCharactersExtra; }
     nsString& Data() { return mData; }
     int MetaState() { return mMetaState; }
     Modifiers DOMModifiers() const;
     bool IsAltPressed() const { return (mMetaState & AMETA_ALT_MASK) != 0; }
     bool IsShiftPressed() const { return (mMetaState & AMETA_SHIFT_MASK) != 0; }
     bool IsCtrlPressed() const { return (mMetaState & AMETA_CTRL_MASK) != 0; }
     bool IsMetaPressed() const { return (mMetaState & AMETA_META_MASK) != 0; }
-    int Flags() { return mFlags; }
     int Count() { return mCount; }
     int PointerIndex() { return mPointerIndex; }
-    int Width() { return mWidth; }
-    int Height() { return mHeight; }
-    int ID() { return mID; }
-    int GamepadButton() { return mGamepadButton; }
-    bool GamepadButtonPressed() { return mGamepadButtonPressed; }
-    float GamepadButtonValue() { return mGamepadButtonValue; }
-    const nsTArray<float>& GamepadValues() { return mGamepadValues; }
     int RequestId() { return mCount; } // for convenience
     bool CanCoalesceWith(AndroidGeckoEvent* ae);
     WidgetTouchEvent MakeTouchEvent(nsIWidget* widget);
     MultiTouchInput MakeMultiTouchInput(nsIWidget* widget);
     WidgetMouseEvent MakeMouseEvent(nsIWidget* widget);
-    void UnionRect(nsIntRect const& aRect);
     nsIObserver *Observer() { return mObserver; }
     mozilla::layers::ScrollableLayerGuid ApzGuid();
     uint64_t ApzInputBlockId();
     nsEventStatus ApzEventStatus();
 
 protected:
     int mAction;
     int mType;
     int64_t mTime;
     nsTArray<nsIntPoint> mPoints;
     nsTArray<nsIntPoint> mPointRadii;
     nsTArray<int> mPointIndicies;
     nsTArray<float> mOrientations;
     nsTArray<float> mPressures;
     nsTArray<int> mToolTypes;
-    nsIntRect mRect;
-    int mFlags, mMetaState;
+    int mMetaState;
     int mCount;
-    double mX, mY, mZ, mW;
+    double mX;
     int mPointerIndex;
     nsString mCharacters, mCharactersExtra, mData;
-    int mWidth, mHeight;
-    int mID;
-    int mGamepadButton;
-    bool mGamepadButtonPressed;
-    float mGamepadButtonValue;
-    nsTArray<float> mGamepadValues;
     nsCOMPtr<nsIObserver> mObserver;
     MultiTouchInput mApzInput;
     mozilla::layers::ScrollableLayerGuid mApzGuid;
     uint64_t mApzInputBlockId;
     nsEventStatus mApzEventStatus;
 
     void ReadIntArray(nsTArray<int> &aVals,
                       JNIEnv *jenv,
@@ -529,81 +509,53 @@ protected:
                         int32_t count);
     void ReadPointArray(nsTArray<nsIntPoint> &mPoints,
                         JNIEnv *jenv,
                         jfieldID field,
                         int32_t count);
     void ReadStringArray(nsTArray<nsString> &aStrings,
                          JNIEnv *jenv,
                          jfieldID field);
-    void ReadRectField(JNIEnv *jenv);
     void ReadCharactersField(JNIEnv *jenv);
     void ReadCharactersExtraField(JNIEnv *jenv);
     void ReadDataField(JNIEnv *jenv);
     void ReadStringFromJString(nsString &aString, JNIEnv *jenv, jstring s);
 
     static jclass jGeckoEventClass;
     static jfieldID jActionField;
     static jfieldID jTypeField;
     static jfieldID jTimeField;
     static jfieldID jPoints;
     static jfieldID jPointIndicies;
     static jfieldID jOrientations;
     static jfieldID jPressures;
     static jfieldID jToolTypes;
     static jfieldID jPointRadii;
     static jfieldID jXField;
-    static jfieldID jYField;
-    static jfieldID jZField;
-    static jfieldID jWField;
-    static jfieldID jDistanceField;
-    static jfieldID jRectField;
 
     static jfieldID jCharactersField;
     static jfieldID jCharactersExtraField;
     static jfieldID jDataField;
     static jfieldID jMetaStateField;
-    static jfieldID jFlagsField;
     static jfieldID jCountField;
     static jfieldID jPointerIndexField;
 
-    static jfieldID jWidthField;
-    static jfieldID jHeightField;
-
-    static jfieldID jIDField;
-    static jfieldID jGamepadButtonField;
-    static jfieldID jGamepadButtonPressedField;
-    static jfieldID jGamepadButtonValueField;
-    static jfieldID jGamepadValuesField;
-
 public:
     enum {
         MOTION_EVENT = 2,
         NOOP = 15,
         APZ_INPUT_EVENT = 17, // used internally in AndroidJNI/nsAppShell/nsWindow
         VIEWPORT = 20,
         NATIVE_GESTURE_EVENT = 31,
         CALL_OBSERVER = 33,
         REMOVE_OBSERVER = 34,
         ADD_OBSERVER = 38,
-        GAMEPAD_ADDREMOVE = 45,
-        GAMEPAD_DATA = 46,
         LONG_PRESS = 47,
         dummy_java_enum_list_end
     };
-
-    enum {
-        ACTION_GAMEPAD_ADDED = 1,
-        ACTION_GAMEPAD_REMOVED = 2
-    };
-
-    enum {
-        ACTION_GAMEPAD_BUTTON = 1,
-        ACTION_GAMEPAD_AXES = 2
-    };
 };
 
 class nsJNIString : public nsString
 {
 public:
     nsJNIString(jstring jstr, JNIEnv *jenv);
 };
 
--- a/widget/android/nsAppShell.cpp
+++ b/widget/android/nsAppShell.cpp
@@ -37,21 +37,16 @@
 
 #include "AndroidBridge.h"
 #include "AndroidBridgeUtilities.h"
 #include "GeneratedJNINatives.h"
 #include <android/log.h>
 #include <pthread.h>
 #include <wchar.h>
 
-#ifdef MOZ_GAMEPAD
-#include "mozilla/dom/GamepadPlatformService.h"
-#include "mozilla/dom/Gamepad.h"
-#endif
-
 #include "GeckoProfiler.h"
 #ifdef MOZ_ANDROID_HISTORY
 #include "nsNetUtil.h"
 #include "nsIURI.h"
 #include "IHistory.h"
 #endif
 
 #ifdef MOZ_LOGGING
@@ -67,17 +62,16 @@
 
 #ifdef DEBUG_ANDROID_EVENTS
 #define EVLOG(args...)  ALOG(args)
 #else
 #define EVLOG(args...) do { } while (0)
 #endif
 
 using namespace mozilla;
-typedef mozilla::dom::GamepadPlatformService GamepadPlatformService;
 
 nsIGeolocationUpdate *gLocationCallback = nullptr;
 
 nsAppShell* nsAppShell::sAppShell;
 StaticAutoPtr<Mutex> nsAppShell::sAppShellLock;
 
 NS_IMPL_ISUPPORTS_INHERITED(nsAppShell, nsBaseAppShell, nsIObserver)
 
@@ -689,60 +683,16 @@ nsAppShell::LegacyGeckoEvent::Run()
     case AndroidGeckoEvent::REMOVE_OBSERVER:
         nsAppShell::Get()->mObserversHash.Remove(curEvent->Characters());
         break;
 
     case AndroidGeckoEvent::ADD_OBSERVER:
         nsAppShell::Get()->AddObserver(curEvent->Characters(), curEvent->Observer());
         break;
 
-    case AndroidGeckoEvent::GAMEPAD_ADDREMOVE: {
-#ifdef MOZ_GAMEPAD
-            RefPtr<GamepadPlatformService> service;
-            service = GamepadPlatformService::GetParentService();
-            if (!service) {
-              break;
-            }
-            if (curEvent->Action() == AndroidGeckoEvent::ACTION_GAMEPAD_ADDED) {
-              int svc_id = service->AddGamepad("android",
-                                               dom::GamepadMappingType::Standard,
-                                               dom::kStandardGamepadButtons,
-                                               dom::kStandardGamepadAxes);
-              java::AndroidGamepadManager::OnGamepadAdded(curEvent->ID(), svc_id);
-            } else if (curEvent->Action() == AndroidGeckoEvent::ACTION_GAMEPAD_REMOVED) {
-              service->RemoveGamepad(curEvent->ID());
-            }
-#endif
-        break;
-    }
-
-    case AndroidGeckoEvent::GAMEPAD_DATA: {
-#ifdef MOZ_GAMEPAD
-            int id = curEvent->ID();
-            RefPtr<GamepadPlatformService> service;
-            service = GamepadPlatformService::GetParentService();
-            if (!service) {
-              break;
-            }
-            if (curEvent->Action() == AndroidGeckoEvent::ACTION_GAMEPAD_BUTTON) {
-              service->NewButtonEvent(id, curEvent->GamepadButton(),
-                                      curEvent->GamepadButtonPressed(),
-                                      curEvent->GamepadButtonValue());
-            } else if (curEvent->Action() == AndroidGeckoEvent::ACTION_GAMEPAD_AXES) {
-                int valid = curEvent->Flags();
-                const nsTArray<float>& values = curEvent->GamepadValues();
-                for (unsigned i = 0; i < values.Length(); i++) {
-                    if (valid & (1<<i)) {
-                      service->NewAxisMoveEvent(id, i, values[i]);
-                    }
-                }
-            }
-#endif
-        break;
-    }
     case AndroidGeckoEvent::NOOP:
         break;
 
     default:
         nsWindow::OnGlobalAndroidEvent(curEvent.get());
         break;
     }