title: Image.getPlanes() on Android is too heavy
body: <p>Folks,</p>
  
  <p>I'm developing screen capture application on Android that using MediaProjection API.</p>
  
  <p>I'm using ImageReader to realize it but Image.getPlanes() is too heavy to capture realtime screen.</p>
  
  <p>It lost too much frames to see smooth rendered screen since Image.getPlanes() blocks main thread.
  When I commented it out, ImageReader acquires many images than before.</p>
  
  <p>I cannot do Image.getPlanes() in background since onImageAvailable is called after Image.close() is called.</p>
  
  <p>So, my questions are:</p>
  
  <ul>
  <li>Why is Image.getPlanes() so heavy?</li>
  <li>Is there any way to realize smooth screen capture?</li>
  </ul>
  
  <p>The code is as follows.</p>
  
  <pre><code>public void onImageAvailable(ImageReader reader) {
  
      try {
  
          Image img = reader.acquireLatestImage();
  
          //Too heavy!!
          Image.Plane[] planes = img.getPlanes();
  
          /* Do something */
  
          img.close();
  
      }catch (Exception e){
          setImageReader();
      }
  }
  </code></pre>
  
  <p>Thank for your helps!</p>
  
  <p>Question updated</p>
  
  <pre><code>//Background process example
  @Override
  public void onImageAvailable(ImageReader reader) {
  
      try {
  
          final Image img = reader.acquireLatestImage();
  
          new Thread(new Runnable() {
              @Override
              public void run() {
  
                  Image.Plane[] planes = img.getPlanes();
  
                  /* Do something */
  
                  img.close();
                  //onImageAvailable is no called Until here.
                  //Because ImageReader is locked from ImageReader.acquireLatestImage() to Image.close()
  
              }
          }).start();
  
      }catch(Exception e){}
  }
  </code></pre>