summaryrefslogtreecommitdiff
path: root/core/java
diff options
context:
space:
mode:
authorMichael Wright <michaelwr@google.com>2013-11-07 18:55:09 -0800
committerMichael Wright <michaelwr@google.com>2013-11-07 18:55:09 -0800
commitc9c487e6d6e9cf91e8ad30958ddf361158815cab (patch)
treea7f514a1b1172cf207c045e88f971c3e23717392 /core/java
parent1fc1834d66a4dba4c9620f1f5e8d3474783af591 (diff)
Remove unnecessary input event indirection
Rather than have a class whose sole job is to pass messages to PointerLocationView, just have it consume them itself. Change-Id: I889ce35d99852f746499c0585dc7c43378b4c3a0
Diffstat (limited to 'core/java')
-rw-r--r--core/java/com/android/internal/widget/PointerLocationView.java11
1 files changed, 7 insertions, 4 deletions
diff --git a/core/java/com/android/internal/widget/PointerLocationView.java b/core/java/com/android/internal/widget/PointerLocationView.java
index d82831f8ceac..e339c44db16e 100644
--- a/core/java/com/android/internal/widget/PointerLocationView.java
+++ b/core/java/com/android/internal/widget/PointerLocationView.java
@@ -31,11 +31,13 @@ import android.view.MotionEvent;
import android.view.VelocityTracker;
import android.view.View;
import android.view.ViewConfiguration;
+import android.view.WindowManagerPolicy.PointerEventListener;
import android.view.MotionEvent.PointerCoords;
import java.util.ArrayList;
-public class PointerLocationView extends View implements InputDeviceListener {
+public class PointerLocationView extends View implements InputDeviceListener,
+ PointerEventListener {
private static final String TAG = "Pointer";
// The system property key used to specify an alternate velocity tracker strategy
@@ -520,7 +522,8 @@ public class PointerLocationView extends View implements InputDeviceListener {
.toString());
}
- public void addPointerEvent(MotionEvent event) {
+ @Override
+ public void onPointerEvent(MotionEvent event) {
final int action = event.getAction();
int NP = mPointers.size();
@@ -648,7 +651,7 @@ public class PointerLocationView extends View implements InputDeviceListener {
@Override
public boolean onTouchEvent(MotionEvent event) {
- addPointerEvent(event);
+ onPointerEvent(event);
if (event.getAction() == MotionEvent.ACTION_DOWN && !isFocused()) {
requestFocus();
@@ -660,7 +663,7 @@ public class PointerLocationView extends View implements InputDeviceListener {
public boolean onGenericMotionEvent(MotionEvent event) {
final int source = event.getSource();
if ((source & InputDevice.SOURCE_CLASS_POINTER) != 0) {
- addPointerEvent(event);
+ onPointerEvent(event);
} else if ((source & InputDevice.SOURCE_CLASS_JOYSTICK) != 0) {
logMotionEvent("Joystick", event);
} else if ((source & InputDevice.SOURCE_CLASS_POSITION) != 0) {