Avoid sync calls for unsupported/non-existant times

* Make sure not to do sync calls for present or retire
  if they aren't supported.

* Don't do sync calls for retire or release if they
  can not possibly exist.

Test: adb shell /data/nativetest/libgui_test/libgui_test
--gtest_filter=*GetFrameTimestamps*

Change-Id: I580409f01cbf07e9a6e00fbb05d914654f12a4a2
diff --git a/include/gui/Surface.h b/include/gui/Surface.h
index a10dad1..451bd68 100644
--- a/include/gui/Surface.h
+++ b/include/gui/Surface.h
@@ -389,7 +389,8 @@
 
     Condition mQueueBufferCondition;
 
-    uint64_t mNextFrameNumber;
+    uint64_t mNextFrameNumber = 1;
+    uint64_t mLastFrameNumber = 0;
 
     // Mutable because ANativeWindow::query needs this class const.
     mutable bool mQueriedSupportedTimestamps;