Loading api/current.xml +21 −22 Original line number Diff line number Diff line Loading @@ -174229,6 +174229,17 @@ > <implements name="android.os.Parcelable"> </implements> <method name="describeContents" return="int" abstract="false" native="false" synchronized="false" static="false" final="true" deprecated="not deprecated" visibility="public" > </method> <method name="getDevice" return="android.view.InputDevice" abstract="false" Loading Loading @@ -174262,6 +174273,16 @@ visibility="public" > </method> <field name="CREATOR" type="android.os.Parcelable.Creator" transient="false" volatile="false" static="true" final="true" deprecated="not deprecated" visibility="public" > </field> <field name="mDeviceId" type="int" transient="false" Loading Loading @@ -174905,17 +174926,6 @@ <parameter name="newFlags" type="int"> </parameter> </method> <method name="describeContents" return="int" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > </method> <method name="dispatch" return="boolean" abstract="false" Loading Loading @@ -178115,17 +178125,6 @@ <parameter name="metaState" type="int"> </parameter> </method> <method name="describeContents" return="int" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > </method> <method name="findPointerIndex" return="int" abstract="false" core/java/android/view/IWindowManager.aidl +5 −1 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ import android.view.IOnKeyguardExitResult; import android.view.IRotationWatcher; import android.view.IWindowSession; import android.view.KeyEvent; import android.view.InputEvent; import android.view.MotionEvent; /** Loading @@ -50,10 +51,13 @@ interface IWindowManager boolean inputMethodClientHasFocus(IInputMethodClient client); // These can only be called when injecting events to your own window, // or by holding the INJECT_EVENTS permission. // or by holding the INJECT_EVENTS permission. These methods may block // until pending input events are finished being dispatched even when 'sync' is false. // Avoid calling these methods on your UI thread or use the 'NoWait' version instead. boolean injectKeyEvent(in KeyEvent ev, boolean sync); boolean injectPointerEvent(in MotionEvent ev, boolean sync); boolean injectTrackballEvent(in MotionEvent ev, boolean sync); boolean injectInputEventNoWait(in InputEvent ev); // These can only be called when holding the MANAGE_APP_TOKENS permission. void pauseKeyDispatching(IBinder token); Loading core/java/android/view/InputEvent.aidl 0 → 100644 +20 −0 Original line number Diff line number Diff line /* //device/java/android/android.view.InputEvent.aidl ** ** Copyright 2007, The Android Open Source Project ** ** Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 ** ** Unless required by applicable law or agreed to in writing, software ** distributed under the License is distributed on an "AS IS" BASIS, ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ** See the License for the specific language governing permissions and ** limitations under the License. */ package android.view; parcelable InputEvent; core/java/android/view/InputEvent.java +40 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package android.view; import android.os.Parcel; import android.os.Parcelable; /** Loading @@ -25,6 +26,11 @@ public abstract class InputEvent implements Parcelable { protected int mDeviceId; protected int mSource; /** @hide */ protected static final int PARCEL_TOKEN_MOTION_EVENT = 1; /** @hide */ protected static final int PARCEL_TOKEN_KEY_EVENT = 2; /*package*/ InputEvent() { } Loading Loading @@ -69,4 +75,38 @@ public abstract class InputEvent implements Parcelable { public final void setSource(int source) { mSource = source; } public final int describeContents() { return 0; } /** @hide */ protected final void readBaseFromParcel(Parcel in) { mDeviceId = in.readInt(); mSource = in.readInt(); } /** @hide */ protected final void writeBaseToParcel(Parcel out) { out.writeInt(mDeviceId); out.writeInt(mSource); } public static final Parcelable.Creator<InputEvent> CREATOR = new Parcelable.Creator<InputEvent>() { public InputEvent createFromParcel(Parcel in) { int token = in.readInt(); if (token == PARCEL_TOKEN_KEY_EVENT) { return KeyEvent.createFromParcelBody(in); } else if (token == PARCEL_TOKEN_MOTION_EVENT) { return MotionEvent.createFromParcelBody(in); } else { throw new IllegalStateException("Unexpected input event type token in parcel."); } } public InputEvent[] newArray(int size) { return new InputEvent[size]; } }; } core/java/android/view/KeyEvent.java +23 −19 Original line number Diff line number Diff line Loading @@ -1211,7 +1211,8 @@ public class KeyEvent extends InputEvent implements Parcelable { public static final Parcelable.Creator<KeyEvent> CREATOR = new Parcelable.Creator<KeyEvent>() { public KeyEvent createFromParcel(Parcel in) { return new KeyEvent(in); in.readInt(); // skip token, we already know this is a KeyEvent return KeyEvent.createFromParcelBody(in); } public KeyEvent[] newArray(int size) { Loading @@ -1219,36 +1220,39 @@ public class KeyEvent extends InputEvent implements Parcelable { } }; public int describeContents() { return 0; } public void writeToParcel(Parcel out, int flags) { out.writeInt(mAction); out.writeInt(mKeyCode); out.writeInt(mRepeatCount); out.writeInt(mMetaState); out.writeInt(mDeviceId); out.writeInt(mSource); out.writeInt(mScanCode); out.writeInt(mFlags); out.writeLong(mDownTime); out.writeLong(mEventTime); /** @hide */ public static KeyEvent createFromParcelBody(Parcel in) { return new KeyEvent(in); } private KeyEvent(Parcel in) { readBaseFromParcel(in); mAction = in.readInt(); mKeyCode = in.readInt(); mRepeatCount = in.readInt(); mMetaState = in.readInt(); mDeviceId = in.readInt(); mSource = in.readInt(); mScanCode = in.readInt(); mFlags = in.readInt(); mDownTime = in.readLong(); mEventTime = in.readLong(); } public void writeToParcel(Parcel out, int flags) { out.writeInt(PARCEL_TOKEN_KEY_EVENT); writeBaseToParcel(out); out.writeInt(mAction); out.writeInt(mKeyCode); out.writeInt(mRepeatCount); out.writeInt(mMetaState); out.writeInt(mScanCode); out.writeInt(mFlags); out.writeLong(mDownTime); out.writeLong(mEventTime); } private native boolean native_isSystemKey(int keyCode); private native boolean native_hasDefaultAction(int keyCode); } Loading
api/current.xml +21 −22 Original line number Diff line number Diff line Loading @@ -174229,6 +174229,17 @@ > <implements name="android.os.Parcelable"> </implements> <method name="describeContents" return="int" abstract="false" native="false" synchronized="false" static="false" final="true" deprecated="not deprecated" visibility="public" > </method> <method name="getDevice" return="android.view.InputDevice" abstract="false" Loading Loading @@ -174262,6 +174273,16 @@ visibility="public" > </method> <field name="CREATOR" type="android.os.Parcelable.Creator" transient="false" volatile="false" static="true" final="true" deprecated="not deprecated" visibility="public" > </field> <field name="mDeviceId" type="int" transient="false" Loading Loading @@ -174905,17 +174926,6 @@ <parameter name="newFlags" type="int"> </parameter> </method> <method name="describeContents" return="int" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > </method> <method name="dispatch" return="boolean" abstract="false" Loading Loading @@ -178115,17 +178125,6 @@ <parameter name="metaState" type="int"> </parameter> </method> <method name="describeContents" return="int" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > </method> <method name="findPointerIndex" return="int" abstract="false"
core/java/android/view/IWindowManager.aidl +5 −1 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ import android.view.IOnKeyguardExitResult; import android.view.IRotationWatcher; import android.view.IWindowSession; import android.view.KeyEvent; import android.view.InputEvent; import android.view.MotionEvent; /** Loading @@ -50,10 +51,13 @@ interface IWindowManager boolean inputMethodClientHasFocus(IInputMethodClient client); // These can only be called when injecting events to your own window, // or by holding the INJECT_EVENTS permission. // or by holding the INJECT_EVENTS permission. These methods may block // until pending input events are finished being dispatched even when 'sync' is false. // Avoid calling these methods on your UI thread or use the 'NoWait' version instead. boolean injectKeyEvent(in KeyEvent ev, boolean sync); boolean injectPointerEvent(in MotionEvent ev, boolean sync); boolean injectTrackballEvent(in MotionEvent ev, boolean sync); boolean injectInputEventNoWait(in InputEvent ev); // These can only be called when holding the MANAGE_APP_TOKENS permission. void pauseKeyDispatching(IBinder token); Loading
core/java/android/view/InputEvent.aidl 0 → 100644 +20 −0 Original line number Diff line number Diff line /* //device/java/android/android.view.InputEvent.aidl ** ** Copyright 2007, The Android Open Source Project ** ** Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 ** ** Unless required by applicable law or agreed to in writing, software ** distributed under the License is distributed on an "AS IS" BASIS, ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ** See the License for the specific language governing permissions and ** limitations under the License. */ package android.view; parcelable InputEvent;
core/java/android/view/InputEvent.java +40 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package android.view; import android.os.Parcel; import android.os.Parcelable; /** Loading @@ -25,6 +26,11 @@ public abstract class InputEvent implements Parcelable { protected int mDeviceId; protected int mSource; /** @hide */ protected static final int PARCEL_TOKEN_MOTION_EVENT = 1; /** @hide */ protected static final int PARCEL_TOKEN_KEY_EVENT = 2; /*package*/ InputEvent() { } Loading Loading @@ -69,4 +75,38 @@ public abstract class InputEvent implements Parcelable { public final void setSource(int source) { mSource = source; } public final int describeContents() { return 0; } /** @hide */ protected final void readBaseFromParcel(Parcel in) { mDeviceId = in.readInt(); mSource = in.readInt(); } /** @hide */ protected final void writeBaseToParcel(Parcel out) { out.writeInt(mDeviceId); out.writeInt(mSource); } public static final Parcelable.Creator<InputEvent> CREATOR = new Parcelable.Creator<InputEvent>() { public InputEvent createFromParcel(Parcel in) { int token = in.readInt(); if (token == PARCEL_TOKEN_KEY_EVENT) { return KeyEvent.createFromParcelBody(in); } else if (token == PARCEL_TOKEN_MOTION_EVENT) { return MotionEvent.createFromParcelBody(in); } else { throw new IllegalStateException("Unexpected input event type token in parcel."); } } public InputEvent[] newArray(int size) { return new InputEvent[size]; } }; }
core/java/android/view/KeyEvent.java +23 −19 Original line number Diff line number Diff line Loading @@ -1211,7 +1211,8 @@ public class KeyEvent extends InputEvent implements Parcelable { public static final Parcelable.Creator<KeyEvent> CREATOR = new Parcelable.Creator<KeyEvent>() { public KeyEvent createFromParcel(Parcel in) { return new KeyEvent(in); in.readInt(); // skip token, we already know this is a KeyEvent return KeyEvent.createFromParcelBody(in); } public KeyEvent[] newArray(int size) { Loading @@ -1219,36 +1220,39 @@ public class KeyEvent extends InputEvent implements Parcelable { } }; public int describeContents() { return 0; } public void writeToParcel(Parcel out, int flags) { out.writeInt(mAction); out.writeInt(mKeyCode); out.writeInt(mRepeatCount); out.writeInt(mMetaState); out.writeInt(mDeviceId); out.writeInt(mSource); out.writeInt(mScanCode); out.writeInt(mFlags); out.writeLong(mDownTime); out.writeLong(mEventTime); /** @hide */ public static KeyEvent createFromParcelBody(Parcel in) { return new KeyEvent(in); } private KeyEvent(Parcel in) { readBaseFromParcel(in); mAction = in.readInt(); mKeyCode = in.readInt(); mRepeatCount = in.readInt(); mMetaState = in.readInt(); mDeviceId = in.readInt(); mSource = in.readInt(); mScanCode = in.readInt(); mFlags = in.readInt(); mDownTime = in.readLong(); mEventTime = in.readLong(); } public void writeToParcel(Parcel out, int flags) { out.writeInt(PARCEL_TOKEN_KEY_EVENT); writeBaseToParcel(out); out.writeInt(mAction); out.writeInt(mKeyCode); out.writeInt(mRepeatCount); out.writeInt(mMetaState); out.writeInt(mScanCode); out.writeInt(mFlags); out.writeLong(mDownTime); out.writeLong(mEventTime); } private native boolean native_isSystemKey(int keyCode); private native boolean native_hasDefaultAction(int keyCode); }