title: error :Unable to acquire a lockedBuffer, very likely client tries to lock more than maxImages buffers
body: <p>I am using camera2 api for capturing image and displaying in thumnail .Everything is working fine in all devices but when using <code>Micromax Q382</code> device then in thumnail preview its displaying black image.I am getting below Issue</p>
  
  <pre><code>Unable to acquire a lockedBuffer, very likely client tries to lock more than maxImages buffers
  </code></pre>
  
  <p>i am using below code for capture listerner callback</p>
  
  <pre><code>final CameraCaptureSession.CaptureCallback captureListener = new CameraCaptureSession.CaptureCallback()
          {
  
              @Override
              public void onCaptureCompleted(CameraCaptureSession session, CaptureRequest request,
                                             TotalCaptureResult result)
              {
  
                  super.onCaptureCompleted(session, request, result);
  
                  startPreview();
              }
  
          };
  
          mCameraDevice.createCaptureSession(outputSurfaces, new CameraCaptureSession.StateCallback()
          {
  
              @Override
              public void onConfigured(CameraCaptureSession session)
              {
  
                  try {
                      session.capture(captureBuilder.build(), captureListener, backgroudHandler);
                  } catch (CameraAccessException e) {
                      AppLogger.exception(myContext, getClass().getSimpleName(), e);
                      // e.printStackTrace();
                  }
              }
  
              @Override
              public void onConfigureFailed(CameraCaptureSession session)
              {
  
              }
          }, backgroudHandler);
  
      } catch (CameraAccessException e) {
          AppLogger.exception(myContext, getClass().getSimpleName(), e);
          // e.printStackTrace();
      }
  </code></pre>
  
  <p>and below code using for OnImageAvailableListener</p>
  
  <pre><code>ImageReader.OnImageAvailableListener readerListener = new ImageReader.OnImageAvailableListener()
          {
  
              @Override
              public void onImageAvailable(ImageReader reader)
              {
  
                  Image image = null;
                  try {
                      image = reader.acquireLatestImage();
                      // ByteBuffer buffer = image.getPlanes()[0].getBuffer();
                      // final byte[] bytes = new byte[buffer.capacity()];
  
                      ByteBuffer buffer = image.getPlanes()[0].getBuffer();
                      final byte[] bytes = new byte[buffer.remaining()];
  
                      buffer.get(bytes);
                      save(bytes);
                      buffer.clear();
                      runOnUiThread(new Runnable()
                      {
  
                          @Override
                          public void run()
                          {
                              mThumbnail.setVisibility(View.VISIBLE);
                              filePathLabel.setVisibility(View.VISIBLE);
                              filePathValue.setText(file.getAbsolutePath());
  
                              Bitmap bmp =
                                      UtilityMethods.getScaledBitmap(CameraImageTestActivityLoliipop.this, bytes);
                              mThumbnail.setImageBitmap(bmp);
                          }
                      });
  
                  } catch (FileNotFoundException e) {
                      AppLogger.exception(myContext, getClass().getSimpleName(), e);
                      // e.printStackTrace();
                  } catch (IOException e) {
                      AppLogger.exception(myContext, getClass().getSimpleName(), e);
                      // e.printStackTrace();
                  } finally {
                      if (image != null) {
                          image.close();
                      }
                  }
              }
  </code></pre>