BQ: Add support for single buffer mode

- Adds a single buffer mode to BufferQueue. In this mode designate the
  first dequeued buffer as the shared buffer. All calls to dequeue()
  and acquire() will then return the shared buffer, allowing the
  producer and consumer to share it.
- Modify the buffer slot state tracking. Add a new SHARED state for
  the shared buffer in single buffer mode. Also track how many times
  a buffer has been dequeued/queued/acquired as it's possible for a
  shared buffer to be both dequeued and acquired at the same time, or
  dequeued/acquired multiple times. This tracking is needed to know
  when to drop the buffer out of the SHARED state after single buffer
  mode has been disabled.
- Add plumbing for enabling/disabling single buffer mode from Surface.

Bug 24940410

Change-Id: I3fc550c74bacb5523c049a227111356257386853
diff --git a/include/gui/IGraphicBufferProducer.h b/include/gui/IGraphicBufferProducer.h
index 4586839..d6daca7 100644
--- a/include/gui/IGraphicBufferProducer.h
+++ b/include/gui/IGraphicBufferProducer.h
@@ -511,6 +511,13 @@
 
     // Returns the number of the next frame which will be dequeued.
     virtual uint64_t getNextFrameNumber() const = 0;
+
+    // Used to enable/disable single buffer mode.
+    //
+    // In single buffer mode the last buffer that was dequeued will be cached
+    // and returned to all calls to dequeueBuffer and acquireBuffer. This allows
+    // the producer and consumer to simultaneously access the same buffer.
+    virtual status_t setSingleBufferMode(bool singleBufferMode) = 0;
 };
 
 // ----------------------------------------------------------------------------