Add support for arbitrary axes in MotionEvents.

This change makes it possible to extend the set of axes that
are reported in MotionEvents by defining new axis constants.

The MotionEvent object is now backed by its C++ counterpart
to avoid having to maintain multiple representations of the
same data.

Change-Id: Ibe93c90d4b390d43c176cce48d558d20869ee608
diff --git a/core/java/android/view/KeyEvent.java b/core/java/android/view/KeyEvent.java
index 766969a..3f6a04b 100755
--- a/core/java/android/view/KeyEvent.java
+++ b/core/java/android/view/KeyEvent.java
@@ -1180,6 +1180,8 @@
     private KeyEvent mNext;
     private boolean mRecycled;
 
+    private int mDeviceId;
+    private int mSource;
     private int mMetaState;
     private int mAction;
     private int mKeyCode;
@@ -1651,6 +1653,23 @@
         return native_hasDefaultAction(mKeyCode);
     }
 
+    /** {@inheritDoc} */
+    @Override
+    public final int getDeviceId() {
+        return mDeviceId;
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public final int getSource() {
+        return mSource;
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public final void setSource(int source) {
+        mSource = source;
+    }
 
     /**
      * <p>Returns the state of the meta keys.</p>
@@ -2651,8 +2670,8 @@
     }
     
     private KeyEvent(Parcel in) {
-        readBaseFromParcel(in);
-        
+        mDeviceId = in.readInt();
+        mSource = in.readInt();
         mAction = in.readInt();
         mKeyCode = in.readInt();
         mRepeatCount = in.readInt();
@@ -2665,9 +2684,9 @@
 
     public void writeToParcel(Parcel out, int flags) {
         out.writeInt(PARCEL_TOKEN_KEY_EVENT);
-        
-        writeBaseToParcel(out);
-        
+
+        out.writeInt(mDeviceId);
+        out.writeInt(mSource);
         out.writeInt(mAction);
         out.writeInt(mKeyCode);
         out.writeInt(mRepeatCount);