Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 06dba79f authored by Android (Google) Code Review's avatar Android (Google) Code Review
Browse files

Merge change 21030

* changes:
  Fix issue #2045895: Finger IDs are not tracked properly.
parents ed8cb393 2a2b3443
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -42,6 +42,10 @@ public class InputDevice {
    long mKeyDownTime = 0;
    int mMetaKeysState = 0;
    
    // For use by KeyInputQueue for keeping track of the current touch
    // data in the old non-multi-touch protocol.
    final int[] curTouchVals = new int[MotionEvent.NUM_SAMPLE_DATA * 2];
    
    final MotionState mAbs = new MotionState(0, 0);
    final MotionState mRel = new MotionState(TRACKBALL_MOVEMENT_THRESHOLD,
            TRACKBALL_MOVEMENT_THRESHOLD);
@@ -410,7 +414,7 @@ public class InputDevice {
                
                switch (orientation) {
                    case Surface.ROTATION_90: {
                        final float temp = reportData[MotionEvent.SAMPLE_X];
                        final float temp = reportData[j + MotionEvent.SAMPLE_X];
                        reportData[j + MotionEvent.SAMPLE_X] = reportData[j + MotionEvent.SAMPLE_Y];
                        reportData[j + MotionEvent.SAMPLE_Y] = w-temp;
                        break;
@@ -421,7 +425,7 @@ public class InputDevice {
                        break;
                    }
                    case Surface.ROTATION_270: {
                        final float temp = reportData[i + MotionEvent.SAMPLE_X];
                        final float temp = reportData[j + MotionEvent.SAMPLE_X];
                        reportData[j + MotionEvent.SAMPLE_X] = h-reportData[j + MotionEvent.SAMPLE_Y];
                        reportData[j + MotionEvent.SAMPLE_Y] = temp;
                        break;
+23 −12
Original line number Diff line number Diff line
@@ -521,31 +521,29 @@ public abstract class KeyInputQueue {
                            // Finger 1
                            if (ev.scancode == RawInputEvent.ABS_X) {
                                di.mAbs.changed = true;
                                di.mAbs.mNextData[MotionEvent.SAMPLE_X] = ev.value;
                                di.curTouchVals[MotionEvent.SAMPLE_X] = ev.value;
                            } else if (ev.scancode == RawInputEvent.ABS_Y) {
                                di.mAbs.changed = true;
                                di.mAbs.mNextData[MotionEvent.SAMPLE_Y] = ev.value;
                                di.curTouchVals[MotionEvent.SAMPLE_Y] = ev.value;
                            } else if (ev.scancode == RawInputEvent.ABS_PRESSURE) {
                                di.mAbs.changed = true;
                                di.mAbs.mNextData[MotionEvent.SAMPLE_PRESSURE] = ev.value;
                                di.mAbs.mNextData[MotionEvent.NUM_SAMPLE_DATA
                                di.curTouchVals[MotionEvent.SAMPLE_PRESSURE] = ev.value;
                                di.curTouchVals[MotionEvent.NUM_SAMPLE_DATA
                                                 + MotionEvent.SAMPLE_PRESSURE] = ev.value;
                            } else if (ev.scancode == RawInputEvent.ABS_TOOL_WIDTH) {
                                di.mAbs.changed = true;
                                di.mAbs.mNextData[MotionEvent.SAMPLE_SIZE] = ev.value;
                                di.mAbs.mNextData[MotionEvent.NUM_SAMPLE_DATA
                                di.curTouchVals[MotionEvent.SAMPLE_SIZE] = ev.value;
                                di.curTouchVals[MotionEvent.NUM_SAMPLE_DATA
                                                 + MotionEvent.SAMPLE_SIZE] = ev.value;

                            // Finger 2
                            } else if (ev.scancode == RawInputEvent.ABS_HAT0X) {
                                di.mAbs.changed = true;
                                di.mAbs.mNextData[(di.mAbs.mDown[0] ?
                                        MotionEvent.NUM_SAMPLE_DATA : 0)
                                di.curTouchVals[MotionEvent.NUM_SAMPLE_DATA 
                                         + MotionEvent.SAMPLE_X] = ev.value;
                            } else if (ev.scancode == RawInputEvent.ABS_HAT0Y) {
                                di.mAbs.changed = true;
                                di.mAbs.mNextData[(di.mAbs.mDown[0] ?
                                        MotionEvent.NUM_SAMPLE_DATA : 0)
                                di.curTouchVals[MotionEvent.NUM_SAMPLE_DATA
                                        + MotionEvent.SAMPLE_Y] = ev.value;
                            }
    
@@ -603,8 +601,21 @@ public abstract class KeyInputQueue {
                                            |RawInputEvent.CLASS_TOUCHSCREEN_MT))
                                            == RawInputEvent.CLASS_TOUCHSCREEN) {
                                        ms.mNextNumPointers = 0;
                                        if (ms.mDown[0]) ms.mNextNumPointers++;
                                        if (ms.mDown[1]) ms.mNextNumPointers++;
                                        if (ms.mDown[0]) {
                                            System.arraycopy(di.curTouchVals, 0,
                                                    ms.mNextData, 0,
                                                    MotionEvent.NUM_SAMPLE_DATA);
                                            ms.mNextNumPointers++;
                                        }
                                        if (ms.mDown[1]) {
                                            System.arraycopy(di.curTouchVals,
                                                    MotionEvent.NUM_SAMPLE_DATA,
                                                    ms.mNextData,
                                                    ms.mNextNumPointers
                                                    * MotionEvent.NUM_SAMPLE_DATA,
                                                    MotionEvent.NUM_SAMPLE_DATA);
                                            ms.mNextNumPointers++;
                                        }
                                    }
                                    
                                    boolean doMotion = !monitorVirtualKey(di,