add a way to query whether an ANativeWindow consumer is running ahead of the producer

Change-Id: Ibccfa1feb56db2ab11f0c0934ce2d570a2b65ae2
diff --git a/include/gui/ISurfaceTexture.h b/include/gui/ISurfaceTexture.h
index 929eda2..1e33764 100644
--- a/include/gui/ISurfaceTexture.h
+++ b/include/gui/ISurfaceTexture.h
@@ -107,21 +107,26 @@
     struct QueueBufferOutput {
         inline QueueBufferOutput() { }
         inline void deflate(uint32_t* outWidth,
-                uint32_t* outHeight, uint32_t* outTransformHint) const {
+                uint32_t* outHeight,
+                uint32_t* outTransformHint,
+                uint32_t* outNumPendingBuffers) const {
             *outWidth = width;
             *outHeight = height;
             *outTransformHint = transformHint;
+            *outNumPendingBuffers = numPendingBuffers;
         }
         inline void inflate(uint32_t inWidth, uint32_t inHeight,
-                uint32_t inTransformHint) {
+                uint32_t inTransformHint, uint32_t inNumPendingBuffers) {
             width = inWidth;
             height = inHeight;
             transformHint = inTransformHint;
+            numPendingBuffers = inNumPendingBuffers;
         }
     private:
         uint32_t width;
         uint32_t height;
         uint32_t transformHint;
+        uint32_t numPendingBuffers;
     };
 
     virtual status_t queueBuffer(int slot,
diff --git a/include/gui/SurfaceTextureClient.h b/include/gui/SurfaceTextureClient.h
index 6644751..7fd9be5 100644
--- a/include/gui/SurfaceTextureClient.h
+++ b/include/gui/SurfaceTextureClient.h
@@ -187,6 +187,10 @@
     // window. this is only a hint, actual transform may differ.
     uint32_t mTransformHint;
 
+    // mConsumerRunningBehind whether the consumer is running more than
+    // one buffer behind the producer.
+    mutable bool mConsumerRunningBehind;
+
     // mMutex is the mutex used to prevent concurrent access to the member
     // variables of SurfaceTexture objects. It must be locked whenever the
     // member variables are accessed.