Improve picture capture debug path

* Fixes hardware bitmap capture
* Fixes mutable bitmap capture (no flickering)
* Adds basic single-frame LRU cache to avoid
  repeated readbacks of GPU resources
* Does up-front readback of GPU resources
* Moves serialization off RenderThread again thanks
  to up-front readback avoiding needing GPU access
  off-thread
* Reduces RAM usage & improves performance by serializing
  directly to output stream instead of first copying to
  a byte[]

Bug: 174223722
Test: PictureCaptureDemo mirrors the content
Change-Id: If7ec208b61d5b917e82087cc312880fc5a38c943
diff --git a/libs/hwui/pipeline/skia/SkiaPipeline.h b/libs/hwui/pipeline/skia/SkiaPipeline.h
index 4658035..bc8a565 100644
--- a/libs/hwui/pipeline/skia/SkiaPipeline.h
+++ b/libs/hwui/pipeline/skia/SkiaPipeline.h
@@ -80,6 +80,8 @@
     SkColorType mSurfaceColorType;
     sk_sp<SkColorSpace> mSurfaceColorSpace;
 
+    bool isCapturingSkp() const { return mCaptureMode != CaptureMode::None; }
+
 private:
     void renderFrameImpl(const SkRect& clip,
                          const std::vector<sp<RenderNode>>& nodes, bool opaque,