title: Android ANR on onSensorChanged event
body: <p>I'm getting lot of ANR-s from my players.
  Here's how the ANR looks like..</p>
  
  <pre><code> "main" prio=5 tid=1 Runnable
    | group="main" sCount=0 dsCount=0 obj=0x75646598 self=0xf4d76500
    | sysTid=20631 nice=0 cgrp=default sched=0/0 handle=0xf7465d54
    | state=R schedstat=( 0 0 0 ) utm=259988 stm=3107 core=4 HZ=100
    | stack=0xff21a000-0xff21c000 stackSize=8MB
    | held mutexes= "mutator lock"(shared held)
    at cr.logics.runfishrun2.S3DSurfaceView.onSensorChanged (S3DSurfaceView.java:292)
    at android.hardware.SystemSensorManager$SensorEventQueue.dispatchSensorEvent (SystemSensorManager.java:579)
    at android.os.MessageQueue.nativePollOnce (Native method)
    at android.os.MessageQueue.next (MessageQueue.java:323)
    at android.os.Looper.loop (Looper.java:143)
    at android.app.ActivityThread.main (ActivityThread.java:7230)
    at java.lang.reflect.Method.invoke! (Native method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:1230)
    at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1120)
  
  "Signal Catcher" daemon prio=5 tid=2 Runnable
    | group="system" sCount=0 dsCount=0 obj=0x32c180a0 self=0xf3f84000
    | sysTid=20636 nice=0 cgrp=default sched=0/0 handle=0xf43dc930
    | state=R schedstat=( 0 0 0 ) utm=2 stm=5 core=1 HZ=100
    | stack=0xf42e0000-0xf42e2000 stackSize=1014KB
    | held mutexes= "mutator lock"(shared held)
  </code></pre>
  
  <p>And this is my code..</p>
  
  <pre><code>public void onSensorChanged ( SensorEvent event )
      {
          if ( event.sensor.getType ( ) == Sensor.TYPE_ACCELEROMETER )
          {
              final float x = event.values[0] ;
              final float y = event.values[1] ;
              final float z = event.values[2] ;
  
              // Get a free pool item, else allocate a new one
              //
              AccelerometerEventRunnable oAccelerometerEventRunnablePoolItem = null ;
  
              for ( AccelerometerEventRunnable aer : aAccelerometerEventRunnablePool )
              {
                  if ( aer.done ( ) )
                  {
                      oAccelerometerEventRunnablePoolItem = aer ;
                      oAccelerometerEventRunnablePoolItem . set ( x, y, z, iDisplayOrient ) ;
                      break ;
                  }
              }
              if ( oAccelerometerEventRunnablePoolItem == null )
              {
                  oAccelerometerEventRunnablePoolItem = new AccelerometerEventRunnable ( x, y, z, iDisplayOrient ) ;
                  aAccelerometerEventRunnablePool.add ( oAccelerometerEventRunnablePoolItem ) ;
                  //Log.d ( "S3DSurfaceView", "onAccelerometerEvent: " + aAccelerometerEventRunnablePool.size() ) ;                
              }
              if ( oAccelerometerEventRunnablePoolItem != null )
              {
                  queueEvent ( oAccelerometerEventRunnablePoolItem ) ;
              }            
          }
          else if ( event.sensor.getType ( ) == Sensor.TYPE_ORIENTATION )
          {
              final float azimuth =  event.values[0] ;
              final float pitch   =  event.values[1] ;
              final float roll    = -event.values[2] ;
  
              queueEvent ( new Runnable ( ) { public void run ( ) { if ( oRenderer != null ) oRenderer.onHeadingEvent ( azimuth ) ; } } ) ;
          }
      }
  </code></pre>
  
  <p>Looks like it happens on this line.. 
  for ( AccelerometerEventRunnable aer : aAccelerometerEventRunnablePool )</p>
  
  <p>The thing is that it's not my code, and I have no idea how to fix this. Any workarounds?
  Thanks in advance!</p>