NEW_API: Add getTimestamp() to SurfaceTexture.

Like getTransformMatrix, getTimestamp provides a timestamp for the
OpenGL texture produced by the latest call to updateTexImage().

Timestamps are measured in nanoseconds, and are monotonically
increasing.  Other properties of the timestamps (zero point,
comparability) depend on the source providing frames to the
SurfaceTexture, and need to be documented by the source.

bug:3300707

Change-Id: I380d94926d0e9f1c77bb5c1576b72d5ef4e2eba1
diff --git a/api/current.xml b/api/current.xml
index 70ea729..00cb81c 100644
--- a/api/current.xml
+++ b/api/current.xml
@@ -86678,6 +86678,17 @@
 <parameter name="texName" type="int">
 </parameter>
 </constructor>
+<method name="getTimestamp"
+ return="long"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
 <method name="getTransformMatrix"
  return="void"
  abstract="false"
diff --git a/core/java/android/hardware/Camera.java b/core/java/android/hardware/Camera.java
index ed2b205..e525c95 100644
--- a/core/java/android/hardware/Camera.java
+++ b/core/java/android/hardware/Camera.java
@@ -374,6 +374,12 @@
      * The preview surface texture may not otherwise change while preview is
      * running.
      *
+     * The timestamps provided by {@link SurfaceTexture#getTimestamp()} for a
+     * SurfaceTexture set as the preview texture have an unspecified zero point,
+     * and cannot be directly compared between different cameras or different
+     * instances of the same camera, or across multiple runs of the same
+     * program.
+     *
      * @param surfaceTexture the {@link SurfaceTexture} to which the preview
      *     images are to be sent or null to remove the current preview surface
      *     texture
diff --git a/graphics/java/android/graphics/SurfaceTexture.java b/graphics/java/android/graphics/SurfaceTexture.java
index b8327a8..cfae0c1 100644
--- a/graphics/java/android/graphics/SurfaceTexture.java
+++ b/graphics/java/android/graphics/SurfaceTexture.java
@@ -153,7 +153,6 @@
      * the SurfaceTexture. Unless otherwise specified by the image source, timestamps cannot
      * generally be compared across SurfaceTexture instances, or across multiple program
      * invocations. It is mostly useful for determining time offsets between subsequent frames.
-     * @hide
      */
     public long getTimestamp() {
         return nativeGetTimestamp();