summaryrefslogtreecommitdiffstats
path: root/core/java
diff options
context:
space:
mode:
authorJeff Brown <jeffbrown@google.com>2014-02-12 00:35:07 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-02-12 00:35:08 +0000
commit47b32a0be1068c40cedc7ffbb93636f39556feef (patch)
treefcd28e7c5960a9afef070cf7926b694ff64efba9 /core/java
parent340312eface0f7062b98b5f8b67c53eba4e73085 (diff)
parentca9bc702df5c14a89c9b8b0109a05894bf74962e (diff)
downloadframeworks_base-47b32a0be1068c40cedc7ffbb93636f39556feef.zip
frameworks_base-47b32a0be1068c40cedc7ffbb93636f39556feef.tar.gz
frameworks_base-47b32a0be1068c40cedc7ffbb93636f39556feef.tar.bz2
Merge "Add support for injecting events into ActivityContainers."
Diffstat (limited to 'core/java')
-rw-r--r--core/java/android/app/ActivityView.java26
-rw-r--r--core/java/android/app/IActivityContainer.aidl2
-rw-r--r--core/java/android/hardware/input/InputManagerInternal.java3
3 files changed, 31 insertions, 0 deletions
diff --git a/core/java/android/app/ActivityView.java b/core/java/android/app/ActivityView.java
index 8acd19b..48ec420 100644
--- a/core/java/android/app/ActivityView.java
+++ b/core/java/android/app/ActivityView.java
@@ -27,6 +27,9 @@ import android.os.RemoteException;
import android.util.AttributeSet;
import android.util.DisplayMetrics;
import android.util.Log;
+import android.view.InputDevice;
+import android.view.InputEvent;
+import android.view.MotionEvent;
import android.view.Surface;
import android.view.TextureView;
import android.view.TextureView.SurfaceTextureListener;
@@ -112,6 +115,29 @@ public class ActivityView extends ViewGroup {
}
}
+ private boolean injectInputEvent(InputEvent event) {
+ try {
+ return mActivityContainer != null && mActivityContainer.injectEvent(event);
+ } catch (RemoteException e) {
+ return false;
+ }
+ }
+
+ @Override
+ public boolean onTouchEvent(MotionEvent event) {
+ return injectInputEvent(event) || super.onTouchEvent(event);
+ }
+
+ @Override
+ public boolean onGenericMotionEvent(MotionEvent event) {
+ if (event.isFromSource(InputDevice.SOURCE_CLASS_POINTER)) {
+ if (injectInputEvent(event)) {
+ return true;
+ }
+ }
+ return super.onGenericMotionEvent(event);
+ }
+
public boolean isAttachedToDisplay() {
return mSurface != null;
}
diff --git a/core/java/android/app/IActivityContainer.aidl b/core/java/android/app/IActivityContainer.aidl
index abd296a..5b80e06 100644
--- a/core/java/android/app/IActivityContainer.aidl
+++ b/core/java/android/app/IActivityContainer.aidl
@@ -20,6 +20,7 @@ import android.app.IActivityContainerCallback;
import android.content.Intent;
import android.content.IIntentSender;
import android.os.IBinder;
+import android.view.InputEvent;
import android.view.Surface;
/** @hide */
@@ -30,4 +31,5 @@ interface IActivityContainer {
int startActivity(in Intent intent);
int startActivityIntentSender(in IIntentSender intentSender);
int getDisplayId();
+ boolean injectEvent(in InputEvent event);
}
diff --git a/core/java/android/hardware/input/InputManagerInternal.java b/core/java/android/hardware/input/InputManagerInternal.java
index ecd32ea..8be94d0 100644
--- a/core/java/android/hardware/input/InputManagerInternal.java
+++ b/core/java/android/hardware/input/InputManagerInternal.java
@@ -17,6 +17,7 @@
package android.hardware.input;
import android.hardware.display.DisplayViewport;
+import android.view.InputEvent;
/**
* Input manager local system service interface.
@@ -30,4 +31,6 @@ public abstract class InputManagerInternal {
*/
public abstract void setDisplayViewports(DisplayViewport defaultViewport,
DisplayViewport externalTouchViewport);
+
+ public abstract boolean injectInputEvent(InputEvent event, int displayId, int mode);
}