title: How do I choose an ImageReader buffer type for my Android camera app?
body: <p>I have an app with a camera function. I'm using the Android Camera2 API. I've found that some Android devices (e.g. Nexus 6p, Nexus 5) work better if the <code>ImageReader</code> is configured to provide JPEGs:</p>
  
  <pre><code>imageReader = ImageReader.NewInstance(width, height, ImageFormatType.Jpeg, 2);
  </code></pre>
  
  <p>And some Android devices (e.g. Nexus 7 2013) work better if the <code>ImageReader</code> is configured to provide, say, <code>RGBA_8888</code>:</p>
  
  <pre><code>imageReader = ImageReader.NewInstance(width, height, (ImageFormatType)1 /* PixelFormat.RGBA_8888 */, 2);
  </code></pre>
  
  <p>The device that works better with JPEGs spits out this error if I use <code>RGBA_8888</code>:</p>
  
  <pre><code>[ImageReader_JNI] Producer output buffer format: 0x22, ImageReader configured format: 0x1
  </code></pre>
  
  <p>The device that works better with RGBA buffers spits out this warning if I use JPEGs: (It still works, but it's slow enough that the captured picture is dark.)</p>
  
  <pre><code>[ImageReader_JNI] ImageReader_lockedImageSetup: Receiving JPEG in HAL_PIXEL_FORMAT_RGBA_8888 buffer.
  </code></pre>
  
  <p>I have to do some processing on what I get back, so ultimately it would be better if I could configure the camera to just spit out some sort of bitmap rather than a JPEG, since I have to convert the JPEG to a <code>Bitmap</code> before continuing.</p>
  
  <p>How should I choose what buffer type to pass to the <code>ImageReader</code>?</p>