diff options
| author | Jeff Brown <jeffbrown@google.com> | 2011-02-14 17:03:18 -0800 |
|---|---|---|
| committer | Jeff Brown <jeffbrown@google.com> | 2011-02-15 19:14:37 -0800 |
| commit | 91c69ab01539f7ba28708f41ec1835cc2920d0a0 (patch) | |
| tree | 04f5dc37a0fa3f18a18ba08916efe0c33a1de300 /core/java/android/view/KeyEvent.java | |
| parent | c3451d4a4479b6244bd6d1dadf289a8d44bdcca2 (diff) | |
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
Diffstat (limited to 'core/java/android/view/KeyEvent.java')
| -rwxr-xr-x | core/java/android/view/KeyEvent.java | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/core/java/android/view/KeyEvent.java b/core/java/android/view/KeyEvent.java index 766969ad7c5b..3f6a04b09baf 100755 --- a/core/java/android/view/KeyEvent.java +++ b/core/java/android/view/KeyEvent.java @@ -1180,6 +1180,8 @@ public class KeyEvent extends InputEvent implements Parcelable { 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 @@ public class KeyEvent extends InputEvent implements Parcelable { 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 @@ public class KeyEvent extends InputEvent implements Parcelable { } 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 class KeyEvent extends InputEvent implements Parcelable { 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); |
