public boolean onTouchEvent(MotionEvent event){
  try {
    int pointerCount=multiTouchSupported ? (Integer)m_getPointerCount.invoke(event) : 1;
    if (DEBUG)     Log.i("MultiTouch","Got here 1 - " + multiTouchSupported + " "+ mMode+ " "+ handleSingleTouchEvents+ " "+ pointerCount);
    if (mMode == MODE_NOTHING && !handleSingleTouchEvents && pointerCount == 1)     return false;
    if (DEBUG)     Log.i("MultiTouch","Got here 2");
    int action=event.getAction();
    int histLen=event.getHistorySize() / pointerCount;
    for (int histIdx=0; histIdx <= histLen; histIdx++) {
      boolean processingHist=histIdx < histLen;
      if (!multiTouchSupported || pointerCount == 1) {
        if (DEBUG)         Log.i("MultiTouch","Got here 3");
        xVals[0]=processingHist ? event.getHistoricalX(histIdx) : event.getX();
        yVals[0]=processingHist ? event.getHistoricalY(histIdx) : event.getY();
        pressureVals[0]=processingHist ? event.getHistoricalPressure(histIdx) : event.getPressure();
      }
 else {
        if (DEBUG)         Log.i("MultiTouch","Got here 4");
        int numPointers=Math.min(pointerCount,MAX_TOUCH_POINTS);
        if (DEBUG && pointerCount > MAX_TOUCH_POINTS)         Log.i("MultiTouch","Got more pointers than MAX_TOUCH_POINTS");
        for (int ptrIdx=0; ptrIdx < numPointers; ptrIdx++) {
          int ptrId=(Integer)m_getPointerId.invoke(event,ptrIdx);
          pointerIds[ptrIdx]=ptrId;
          xVals[ptrIdx]=(Float)(processingHist ? m_getHistoricalX.invoke(event,ptrIdx,histIdx) : m_getX.invoke(event,ptrIdx));
          yVals[ptrIdx]=(Float)(processingHist ? m_getHistoricalY.invoke(event,ptrIdx,histIdx) : m_getY.invoke(event,ptrIdx));
          pressureVals[ptrIdx]=(Float)(processingHist ? m_getHistoricalPressure.invoke(event,ptrIdx,histIdx) : m_getPressure.invoke(event,ptrIdx));
        }
      }
      decodeTouchEvent(pointerCount,xVals,yVals,pressureVals,pointerIds,processingHist ? MotionEvent.ACTION_MOVE : action,processingHist ? true : action != MotionEvent.ACTION_UP && (action & ((1 << ACTION_POINTER_INDEX_SHIFT) - 1)) != ACTION_POINTER_UP && action != MotionEvent.ACTION_CANCEL,processingHist ? event.getHistoricalEventTime(histIdx) : event.getEventTime());
    }
    return true;
  }
 catch (  Exception e) {
    Log.e("MultiTouchController","onTouchEvent() failed",e);
    return false;
  }
}

public boolean onTouchEvent ( MotionEvent event ) { try { int pointerCount = multiTouchSupported ? ( Integer ) m_getPointerCount . invoke ( event ) : 1 ; if ( DEBUG ) Log . i ( "MultiTouch" , "Got here 1 - " + multiTouchSupported + " " + mMode + " " + handleSingleTouchEvents + " " + pointerCount ) ; if ( mMode == MODE_NOTHING && ! handleSingleTouchEvents && pointerCount == 1 ) return false ; if ( DEBUG ) Log . i ( "MultiTouch" , "Got here 2" ) ; int action = event . getAction ( ) ; int histLen = event . getHistorySize ( ) / pointerCount ; for ( int histIdx = 0 ; histIdx <= histLen ; histIdx ++ ) { boolean processingHist = histIdx < histLen ; if ( ! multiTouchSupported || pointerCount == 1 ) { if ( DEBUG ) Log . i ( "MultiTouch" , "Got here 3" ) ; xVals [ 0 ] = processingHist ? event . getHistoricalX ( histIdx ) : event . getX ( ) ; yVals [ 0 ] = processingHist ? event . getHistoricalY ( histIdx ) : event . getY ( ) ; pressureVals [ 0 ] = processingHist ? event . getHistoricalPressure ( histIdx ) : event . getPressure ( ) ; } else { if ( DEBUG ) Log . i ( "MultiTouch" , "Got here 4" ) ; int numPointers = Math . min ( pointerCount , MAX_TOUCH_POINTS ) ; if ( DEBUG && pointerCount > MAX_TOUCH_POINTS ) Log . i ( "MultiTouch" , "Got more pointers than MAX_TOUCH_POINTS" ) ; for ( int ptrIdx = 0 ; ptrIdx < numPointers ; ptrIdx ++ ) { int ptrId = ( Integer ) m_getPointerId . invoke ( event , ptrIdx ) ; pointerIds [ ptrIdx ] = ptrId ; xVals [ ptrIdx ] = ( Float ) ( processingHist ? m_getHistoricalX . invoke ( event , ptrIdx , histIdx ) : m_getX . invoke ( event , ptrIdx ) ) ; yVals [ ptrIdx ] = ( Float ) ( processingHist ? m_getHistoricalY . invoke ( event , ptrIdx , histIdx ) : m_getY . invoke ( event , ptrIdx ) ) ; pressureVals [ ptrIdx ] = ( Float ) ( processingHist ? m_getHistoricalPressure . invoke ( event , ptrIdx , histIdx ) : m_getPressure . invoke ( event , ptrIdx ) ) ; } } decodeTouchEvent ( pointerCount , xVals , yVals , pressureVals , pointerIds , processingHist ? MotionEvent . ACTION_MOVE : action , processingHist ? true : action != MotionEvent . ACTION_UP && ( action & ( ( 1 << ACTION_POINTER_INDEX_SHIFT ) - 1 ) ) != ACTION_POINTER_UP && action != MotionEvent . ACTION_CANCEL , processingHist ? event . getHistoricalEventTime ( histIdx ) : event . getEventTime ( ) ) ; } return true ; } catch ( Exception e ) { Log . e ( "MultiTouchController" , "onTouchEvent() failed" , e ) ; return false ; } }
process incoming touch events
