egl: Remove retire event.

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

Change-Id: Ibf63d22e42ae52307662107eec50f80de0e703f5
diff --git a/libs/gui/FrameTimestamps.cpp b/libs/gui/FrameTimestamps.cpp
index 019a11e..fccca97 100644
--- a/libs/gui/FrameTimestamps.cpp
+++ b/libs/gui/FrameTimestamps.cpp
@@ -52,9 +52,8 @@
 
 bool FrameEvents::hasLastRefreshStartInfo() const {
     // The last refresh start time may continue to update until a new frame
-    // is latched. We know we have the final value once the release or retire
-    // info is set. See ConsumerFrameEventHistory::addRetire/Release.
-    return addRetireCalled || addReleaseCalled;
+    // is latched. We know we have the final value once the release info is set.
+    return addReleaseCalled;
 }
 
 bool FrameEvents::hasDequeueReadyInfo() const {
@@ -76,11 +75,6 @@
     return addPostCompositeCalled;
 }
 
-bool FrameEvents::hasDisplayRetireInfo() const {
-    // We may not get a displayRetire in addRetire for HWC2.
-    return addRetireCalled;
-}
-
 bool FrameEvents::hasReleaseInfo() const {
     return addReleaseCalled;
 }
@@ -89,7 +83,6 @@
     acquireFence->getSignalTime();
     gpuCompositionDoneFence->getSignalTime();
     displayPresentFence->getSignalTime();
-    displayRetireFence->getSignalTime();
     releaseFence->getSignalTime();
 }
 
@@ -145,8 +138,6 @@
             !addPostCompositeCalled, *gpuCompositionDoneFence);
     dumpFenceTime(outString, "Display Present   \t",
             !addPostCompositeCalled, *displayPresentFence);
-    dumpFenceTime(outString, "Display Retire    \t",
-            !addRetireCalled, *displayRetireFence);
 
     outString.appendFormat("--- DequeueReady  \t");
     if (FrameEvents::isValidTimestamp(dequeueReadyTime)) {
@@ -286,7 +277,6 @@
         FrameEvents& frame = mFrames[d.mIndex];
 
         frame.addPostCompositeCalled = d.mAddPostCompositeCalled != 0;
-        frame.addRetireCalled = d.mAddRetireCalled != 0;
         frame.addReleaseCalled = d.mAddReleaseCalled != 0;
 
         frame.postedTime = d.mPostedTime;
@@ -302,7 +292,6 @@
             frame.acquireFence = FenceTime::NO_FENCE;
             frame.gpuCompositionDoneFence = FenceTime::NO_FENCE;
             frame.displayPresentFence = FenceTime::NO_FENCE;
-            frame.displayRetireFence = FenceTime::NO_FENCE;
             frame.releaseFence = FenceTime::NO_FENCE;
             // The consumer only sends valid frames.
             frame.valid = true;
@@ -312,8 +301,6 @@
                 &frame.gpuCompositionDoneFence, d.mGpuCompositionDoneFence);
         applyFenceDelta(&mPresentTimeline,
                 &frame.displayPresentFence, d.mDisplayPresentFence);
-        applyFenceDelta(&mRetireTimeline,
-                &frame.displayRetireFence, d.mDisplayRetireFence);
         applyFenceDelta(&mReleaseTimeline,
                 &frame.releaseFence, d.mReleaseFence);
     }
@@ -323,7 +310,6 @@
     mAcquireTimeline.updateSignalTimes();
     mGpuCompositionDoneTimeline.updateSignalTimes();
     mPresentTimeline.updateSignalTimes();
-    mRetireTimeline.updateSignalTimes();
     mReleaseTimeline.updateSignalTimes();
 }
 
@@ -444,18 +430,6 @@
     }
 }
 
-void ConsumerFrameEventHistory::addRetire(
-        uint64_t frameNumber, const std::shared_ptr<FenceTime>& displayRetire) {
-    FrameEvents* frame = getFrame(frameNumber, &mRetireOffset);
-    if (frame == nullptr) {
-        ALOGE_IF(mProducerWantsEvents, "addRetire: Did not find frame.");
-        return;
-    }
-    frame->addRetireCalled = true;
-    frame->displayRetireFence = displayRetire;
-    mFramesDirty[mRetireOffset].setDirty<FrameEvent::DISPLAY_RETIRE>();
-}
-
 void ConsumerFrameEventHistory::addRelease(uint64_t frameNumber,
         nsecs_t dequeueReadyTime, std::shared_ptr<FenceTime>&& release) {
     FrameEvents* frame = getFrame(frameNumber, &mReleaseOffset);
@@ -515,7 +489,6 @@
     : mIndex(index),
       mFrameNumber(frameTimestamps.frameNumber),
       mAddPostCompositeCalled(frameTimestamps.addPostCompositeCalled),
-      mAddRetireCalled(frameTimestamps.addRetireCalled),
       mAddReleaseCalled(frameTimestamps.addReleaseCalled),
       mPostedTime(frameTimestamps.postedTime),
       mRequestedPresentTime(frameTimestamps.requestedPresentTime),
@@ -531,9 +504,6 @@
         mDisplayPresentFence =
                 frameTimestamps.displayPresentFence->getSnapshot();
     }
-    if (dirtyFields.isDirty<FrameEvent::DISPLAY_RETIRE>()) {
-        mDisplayRetireFence = frameTimestamps.displayRetireFence->getSnapshot();
-    }
     if (dirtyFields.isDirty<FrameEvent::RELEASE>()) {
         mReleaseFence = frameTimestamps.releaseFence->getSnapshot();
     }
@@ -541,9 +511,8 @@
 
 constexpr size_t FrameEventsDelta::minFlattenedSize() {
     return sizeof(FrameEventsDelta::mFrameNumber) +
-            sizeof(uint8_t) + // mIndex
+            sizeof(uint16_t) + // mIndex
             sizeof(uint8_t) + // mAddPostCompositeCalled
-            sizeof(uint8_t) + // mAddRetireCalled
             sizeof(uint8_t) + // mAddReleaseCalled
             sizeof(FrameEventsDelta::mPostedTime) +
             sizeof(FrameEventsDelta::mRequestedPresentTime) +
@@ -578,19 +547,17 @@
     }
 
     if (mIndex >= FrameEventHistory::MAX_FRAME_HISTORY ||
-            mIndex > std::numeric_limits<uint8_t>::max()) {
+            mIndex > std::numeric_limits<uint16_t>::max()) {
         return BAD_VALUE;
     }
 
     FlattenableUtils::write(buffer, size, mFrameNumber);
 
-    // These are static_cast to uint8_t for alignment.
-    FlattenableUtils::write(buffer, size, static_cast<uint8_t>(mIndex));
+    // These are static_cast to uint16_t/uint8_t for alignment.
+    FlattenableUtils::write(buffer, size, static_cast<uint16_t>(mIndex));
     FlattenableUtils::write(
             buffer, size, static_cast<uint8_t>(mAddPostCompositeCalled));
     FlattenableUtils::write(
-            buffer, size, static_cast<uint8_t>(mAddRetireCalled));
-    FlattenableUtils::write(
             buffer, size, static_cast<uint8_t>(mAddReleaseCalled));
 
     FlattenableUtils::write(buffer, size, mPostedTime);
@@ -618,19 +585,18 @@
 
     FlattenableUtils::read(buffer, size, mFrameNumber);
 
-    // These were written as uint8_t for alignment.
-    uint8_t temp = 0;
-    FlattenableUtils::read(buffer, size, temp);
-    mIndex = temp;
+    // These were written as uint16_t/uint8_t for alignment.
+    uint16_t temp16 = 0;
+    FlattenableUtils::read(buffer, size, temp16);
+    mIndex = temp16;
     if (mIndex >= FrameEventHistory::MAX_FRAME_HISTORY) {
         return BAD_VALUE;
     }
-    FlattenableUtils::read(buffer, size, temp);
-    mAddPostCompositeCalled = static_cast<bool>(temp);
-    FlattenableUtils::read(buffer, size, temp);
-    mAddRetireCalled = static_cast<bool>(temp);
-    FlattenableUtils::read(buffer, size, temp);
-    mAddReleaseCalled = static_cast<bool>(temp);
+    uint8_t temp8 = 0;
+    FlattenableUtils::read(buffer, size, temp8);
+    mAddPostCompositeCalled = static_cast<bool>(temp8);
+    FlattenableUtils::read(buffer, size, temp8);
+    mAddReleaseCalled = static_cast<bool>(temp8);
 
     FlattenableUtils::read(buffer, size, mPostedTime);
     FlattenableUtils::read(buffer, size, mRequestedPresentTime);
diff --git a/libs/gui/ISurfaceComposer.cpp b/libs/gui/ISurfaceComposer.cpp
index 4d2692f..5a32d05 100644
--- a/libs/gui/ISurfaceComposer.cpp
+++ b/libs/gui/ISurfaceComposer.cpp
@@ -166,50 +166,6 @@
         return result != 0;
     }
 
-    virtual status_t getSupportedFrameTimestamps(
-            std::vector<FrameEvent>* outSupported) const {
-        if (!outSupported) {
-            return UNEXPECTED_NULL;
-        }
-        outSupported->clear();
-
-        Parcel data, reply;
-
-        status_t err = data.writeInterfaceToken(
-                ISurfaceComposer::getInterfaceDescriptor());
-        if (err != NO_ERROR) {
-            return err;
-        }
-
-        err = remote()->transact(
-                BnSurfaceComposer::GET_SUPPORTED_FRAME_TIMESTAMPS,
-                data, &reply);
-        if (err != NO_ERROR) {
-            return err;
-        }
-
-        int32_t result = 0;
-        err = reply.readInt32(&result);
-        if (err != NO_ERROR) {
-            return err;
-        }
-        if (result != NO_ERROR) {
-            return result;
-        }
-
-        std::vector<int32_t> supported;
-        err = reply.readInt32Vector(&supported);
-        if (err != NO_ERROR) {
-            return err;
-        }
-
-        outSupported->reserve(supported.size());
-        for (int32_t s : supported) {
-            outSupported->push_back(static_cast<FrameEvent>(s));
-        }
-        return NO_ERROR;
-    }
-
     virtual sp<IDisplayEventConnection> createDisplayEventConnection()
     {
         Parcel data, reply;
@@ -580,25 +536,6 @@
             reply->writeInt32(result);
             return NO_ERROR;
         }
-        case GET_SUPPORTED_FRAME_TIMESTAMPS: {
-            CHECK_INTERFACE(ISurfaceComposer, data, reply);
-            std::vector<FrameEvent> supportedTimestamps;
-            status_t result = getSupportedFrameTimestamps(&supportedTimestamps);
-            status_t err = reply->writeInt32(result);
-            if (err != NO_ERROR) {
-                return err;
-            }
-            if (result != NO_ERROR) {
-                return result;
-            }
-
-            std::vector<int32_t> supported;
-            supported.reserve(supportedTimestamps.size());
-            for (FrameEvent s : supportedTimestamps) {
-                supported.push_back(static_cast<int32_t>(s));
-            }
-            return reply->writeInt32Vector(supported);
-        }
         case CREATE_DISPLAY_EVENT_CONNECTION: {
             CHECK_INTERFACE(ISurfaceComposer, data, reply);
             sp<IDisplayEventConnection> connection(createDisplayEventConnection());
diff --git a/libs/gui/Surface.cpp b/libs/gui/Surface.cpp
index a2e12f7..429e837 100644
--- a/libs/gui/Surface.cpp
+++ b/libs/gui/Surface.cpp
@@ -49,9 +49,6 @@
       mAutoRefresh(false),
       mSharedBufferSlot(BufferItem::INVALID_BUFFER_SLOT),
       mSharedBufferHasBeenQueued(false),
-      mQueriedSupportedTimestamps(false),
-      mFrameTimestampsSupportsPresent(false),
-      mFrameTimestampsSupportsRetire(false),
       mEnableFrameTimestamps(false),
       mFrameEventHistory(std::make_unique<ProducerFrameEventHistory>())
 {
@@ -199,7 +196,6 @@
         const nsecs_t* outLastRefreshStartTime,
         const nsecs_t* outGpuCompositionDoneTime,
         const nsecs_t* outDisplayPresentTime,
-        const nsecs_t* outDisplayRetireTime,
         const nsecs_t* outDequeueReadyTime,
         const nsecs_t* outReleaseTime) {
     bool checkForLatch = (outLatchTime != nullptr) && !e->hasLatchInfo();
@@ -210,13 +206,11 @@
     bool checkForDisplayPresent = (outDisplayPresentTime != nullptr) &&
             !e->hasDisplayPresentInfo();
 
-    // LastRefreshStart, DisplayRetire, DequeueReady, and Release are never
+    // LastRefreshStart, DequeueReady, and Release are never
     // available for the last frame.
     bool checkForLastRefreshStart = (outLastRefreshStartTime != nullptr) &&
             !e->hasLastRefreshStartInfo() &&
             (e->frameNumber != lastFrameNumber);
-    bool checkForDisplayRetire = (outDisplayRetireTime != nullptr) &&
-            !e->hasDisplayRetireInfo() && (e->frameNumber != lastFrameNumber);
     bool checkForDequeueReady = (outDequeueReadyTime != nullptr) &&
             !e->hasDequeueReadyInfo() && (e->frameNumber != lastFrameNumber);
     bool checkForRelease = (outReleaseTime != nullptr) &&
@@ -225,8 +219,7 @@
     // RequestedPresent and Acquire info are always available producer-side.
     return checkForLatch || checkForFirstRefreshStart ||
             checkForLastRefreshStart || checkForGpuCompositionDone ||
-            checkForDisplayPresent || checkForDisplayRetire ||
-            checkForDequeueReady || checkForRelease;
+            checkForDisplayPresent || checkForDequeueReady || checkForRelease;
 }
 
 static void getFrameTimestamp(nsecs_t *dst, const nsecs_t& src) {
@@ -246,8 +239,8 @@
         nsecs_t* outRequestedPresentTime, nsecs_t* outAcquireTime,
         nsecs_t* outLatchTime, nsecs_t* outFirstRefreshStartTime,
         nsecs_t* outLastRefreshStartTime, nsecs_t* outGpuCompositionDoneTime,
-        nsecs_t* outDisplayPresentTime, nsecs_t* outDisplayRetireTime,
-        nsecs_t* outDequeueReadyTime, nsecs_t* outReleaseTime) {
+        nsecs_t* outDisplayPresentTime, nsecs_t* outDequeueReadyTime,
+        nsecs_t* outReleaseTime) {
     ATRACE_CALL();
 
     Mutex::Autolock lock(mMutex);
@@ -256,15 +249,6 @@
         return INVALID_OPERATION;
     }
 
-    // Verify the requested timestamps are supported.
-    querySupportedTimestampsLocked();
-    if (outDisplayPresentTime != nullptr && !mFrameTimestampsSupportsPresent) {
-        return BAD_VALUE;
-    }
-    if (outDisplayRetireTime != nullptr && !mFrameTimestampsSupportsRetire) {
-        return BAD_VALUE;
-    }
-
     FrameEvents* events = mFrameEventHistory->getFrame(frameNumber);
     if (events == nullptr) {
         // If the entry isn't available in the producer, it's definitely not
@@ -276,7 +260,7 @@
     if (checkConsumerForUpdates(events, mLastFrameNumber,
             outLatchTime, outFirstRefreshStartTime, outLastRefreshStartTime,
             outGpuCompositionDoneTime, outDisplayPresentTime,
-            outDisplayRetireTime, outDequeueReadyTime, outReleaseTime)) {
+            outDequeueReadyTime, outReleaseTime)) {
         FrameEventHistoryDelta delta;
         mGraphicBufferProducer->getFrameTimestamps(&delta);
         mFrameEventHistory->applyDelta(delta);
@@ -300,7 +284,6 @@
             outGpuCompositionDoneTime, events->gpuCompositionDoneFence);
     getFrameTimestampFence(
             outDisplayPresentTime, events->displayPresentFence);
-    getFrameTimestampFence(outDisplayRetireTime, events->displayRetireFence);
     getFrameTimestampFence(outReleaseTime, events->releaseFence);
 
     return NO_ERROR;
@@ -740,31 +723,6 @@
     return err;
 }
 
-void Surface::querySupportedTimestampsLocked() const {
-    // mMutex must be locked when calling this method.
-
-    if (mQueriedSupportedTimestamps) {
-        return;
-    }
-    mQueriedSupportedTimestamps = true;
-
-    std::vector<FrameEvent> supportedFrameTimestamps;
-    status_t err = composerService()->getSupportedFrameTimestamps(
-            &supportedFrameTimestamps);
-
-    if (err != NO_ERROR) {
-        return;
-    }
-
-    for (auto sft : supportedFrameTimestamps) {
-        if (sft == FrameEvent::DISPLAY_PRESENT) {
-            mFrameTimestampsSupportsPresent = true;
-        } else if (sft == FrameEvent::DISPLAY_RETIRE) {
-            mFrameTimestampsSupportsRetire = true;
-        }
-    }
-}
-
 int Surface::query(int what, int* value) const {
     ATRACE_CALL();
     ALOGV("Surface::query");
@@ -826,16 +784,6 @@
                         static_cast<int>(durationUs);
                 return NO_ERROR;
             }
-            case NATIVE_WINDOW_FRAME_TIMESTAMPS_SUPPORTS_PRESENT: {
-                querySupportedTimestampsLocked();
-                *value = mFrameTimestampsSupportsPresent ? 1 : 0;
-                return NO_ERROR;
-            }
-            case NATIVE_WINDOW_FRAME_TIMESTAMPS_SUPPORTS_RETIRE: {
-                querySupportedTimestampsLocked();
-                *value = mFrameTimestampsSupportsRetire ? 1 : 0;
-                return NO_ERROR;
-            }
             case NATIVE_WINDOW_IS_VALID: {
                 *value = mGraphicBufferProducer != nullptr ? 1 : 0;
                 return NO_ERROR;
@@ -1090,14 +1038,13 @@
     nsecs_t* outLastRefreshStartTime = va_arg(args, int64_t*);
     nsecs_t* outGpuCompositionDoneTime = va_arg(args, int64_t*);
     nsecs_t* outDisplayPresentTime = va_arg(args, int64_t*);
-    nsecs_t* outDisplayRetireTime = va_arg(args, int64_t*);
     nsecs_t* outDequeueReadyTime = va_arg(args, int64_t*);
     nsecs_t* outReleaseTime = va_arg(args, int64_t*);
     return getFrameTimestamps(frameId,
             outRequestedPresentTime, outAcquireTime, outLatchTime,
             outFirstRefreshStartTime, outLastRefreshStartTime,
             outGpuCompositionDoneTime, outDisplayPresentTime,
-            outDisplayRetireTime, outDequeueReadyTime, outReleaseTime);
+            outDequeueReadyTime, outReleaseTime);
 }
 
 int Surface::dispatchGetWideColorSupport(va_list args) {
diff --git a/libs/gui/tests/Surface_test.cpp b/libs/gui/tests/Surface_test.cpp
index 58227e6..3932b92 100644
--- a/libs/gui/tests/Surface_test.cpp
+++ b/libs/gui/tests/Surface_test.cpp
@@ -358,11 +358,6 @@
 public:
     ~FakeSurfaceComposer() override {}
 
-    void setSupportedTimestamps(bool supportsPresent, bool supportsRetire) {
-        mSupportsPresent = supportsPresent;
-        mSupportsRetire = supportsRetire;
-    }
-
     sp<ISurfaceComposerClient> createConnection() override { return nullptr; }
     sp<ISurfaceComposerClient> createScopedConnection(
             const sp<IGraphicBufferProducer>& /* parent */) override {
@@ -386,30 +381,6 @@
             const sp<IGraphicBufferProducer>& /*surface*/) const override {
         return false;
     }
-
-    status_t getSupportedFrameTimestamps(std::vector<FrameEvent>* outSupported)
-            const override {
-        *outSupported = {
-                FrameEvent::REQUESTED_PRESENT,
-                FrameEvent::ACQUIRE,
-                FrameEvent::LATCH,
-                FrameEvent::FIRST_REFRESH_START,
-                FrameEvent::LAST_REFRESH_START,
-                FrameEvent::GPU_COMPOSITION_DONE,
-                FrameEvent::DEQUEUE_READY,
-                FrameEvent::RELEASE
-        };
-        if (mSupportsPresent) {
-            outSupported->push_back(
-                        FrameEvent::DISPLAY_PRESENT);
-        }
-        if (mSupportsRetire) {
-            outSupported->push_back(
-                        FrameEvent::DISPLAY_RETIRE);
-        }
-        return NO_ERROR;
-    }
-
     void setPowerMode(const sp<IBinder>& /*display*/, int /*mode*/) override {}
     status_t getDisplayConfigs(const sp<IBinder>& /*display*/,
             Vector<DisplayInfo>* /*configs*/) override { return NO_ERROR; }
@@ -574,8 +545,7 @@
               kConsumerAcquireTime(frameStartTime + 301),
               kLatchTime(frameStartTime + 500),
               kDequeueReadyTime(frameStartTime + 600),
-              kRetireTime(frameStartTime + 700),
-              kReleaseTime(frameStartTime + 800),
+              kReleaseTime(frameStartTime + 700),
               mRefreshes {
                     { mFenceMap, frameStartTime + 410 },
                     { mFenceMap, frameStartTime + 420 },
@@ -595,7 +565,6 @@
         }
 
         void signalReleaseFences() {
-            mFenceMap.signalAllForTest(mRetire.mFence, kRetireTime);
             mFenceMap.signalAllForTest(mRelease.mFence, kReleaseTime);
         }
 
@@ -603,7 +572,6 @@
 
         FenceAndFenceTime mAcquireConsumer { mFenceMap };
         FenceAndFenceTime mAcquireProducer { mFenceMap };
-        FenceAndFenceTime mRetire { mFenceMap };
         FenceAndFenceTime mRelease { mFenceMap };
 
         const nsecs_t kPostedTime;
@@ -612,7 +580,6 @@
         const nsecs_t kConsumerAcquireTime;
         const nsecs_t kLatchTime;
         const nsecs_t kDequeueReadyTime;
-        const nsecs_t kRetireTime;
         const nsecs_t kReleaseTime;
 
         RefreshEvents mRefreshes[3];
@@ -651,7 +618,7 @@
                 &outRequestedPresentTime, &outAcquireTime, &outLatchTime,
                 &outFirstRefreshStartTime, &outLastRefreshStartTime,
                 &outGpuCompositionDoneTime, &outDisplayPresentTime,
-                &outDisplayRetireTime, &outDequeueReadyTime, &outReleaseTime);
+                &outDequeueReadyTime, &outReleaseTime);
     }
 
     void resetTimestamps() {
@@ -662,7 +629,6 @@
         outLastRefreshStartTime = -1;
         outGpuCompositionDoneTime = -1;
         outDisplayPresentTime = -1;
-        outDisplayRetireTime = -1;
         outDequeueReadyTime = -1;
         outReleaseTime = -1;
     }
@@ -715,8 +681,8 @@
         uint64_t nOldFrame = iOldFrame + 1;
         uint64_t nNewFrame = iNewFrame + 1;
 
-        // Latch, Composite, Retire, and Release the frames in a plausible
-        // order. Note: The timestamps won't necessarily match the order, but
+        // Latch, Composite, and Release the frames in a plausible order.
+        // Note: The timestamps won't necessarily match the order, but
         // that's okay for the purposes of this test.
         std::shared_ptr<FenceTime> gpuDoneFenceTime = FenceTime::NO_FENCE;
 
@@ -750,11 +716,6 @@
                 newFrame->mRefreshes[0].mPresent.mFenceTime,
                 newFrame->mRefreshes[0].kCompositorTiming);
 
-        // Retire the previous buffer just after compositing the new buffer.
-        if (oldFrame != nullptr) {
-            mCfeh->addRetire(nOldFrame, oldFrame->mRetire.mFenceTime);
-        }
-
         mCfeh->addPreComposition(nNewFrame, newFrame->mRefreshes[1].kStartTime);
         gpuDoneFenceTime = gpuComposited ?
                 newFrame->mRefreshes[1].mGpuCompositionDone.mFenceTime :
@@ -764,11 +725,6 @@
                 newFrame->mRefreshes[1].kCompositorTiming);
     }
 
-    void QueryPresentRetireSupported(
-            bool displayPresentSupported, bool displayRetireSupported);
-    void PresentOrRetireUnsupportedNoSyncTest(
-            bool displayPresentSupported, bool displayRetireSupported);
-
     sp<IGraphicBufferProducer> mProducer;
     sp<IGraphicBufferConsumer> mConsumer;
     sp<FakeConsumer> mFakeConsumer;
@@ -787,7 +743,6 @@
     int64_t outLastRefreshStartTime = -1;
     int64_t outGpuCompositionDoneTime = -1;
     int64_t outDisplayPresentTime = -1;
-    int64_t outDisplayRetireTime = -1;
     int64_t outDequeueReadyTime = -1;
     int64_t outReleaseTime = -1;
 
@@ -899,31 +854,6 @@
     EXPECT_EQ(4, mFakeConsumer->mGetFrameTimestampsCount);
 }
 
-void GetFrameTimestampsTest::QueryPresentRetireSupported(
-        bool displayPresentSupported, bool displayRetireSupported) {
-    mSurface->mFakeSurfaceComposer->setSupportedTimestamps(
-            displayPresentSupported, displayRetireSupported);
-
-    // Verify supported bits are forwarded.
-    int supportsPresent = -1;
-    mWindow.get()->query(mWindow.get(),
-            NATIVE_WINDOW_FRAME_TIMESTAMPS_SUPPORTS_PRESENT, &supportsPresent);
-    EXPECT_EQ(displayPresentSupported, supportsPresent);
-
-    int supportsRetire = -1;
-    mWindow.get()->query(mWindow.get(),
-            NATIVE_WINDOW_FRAME_TIMESTAMPS_SUPPORTS_RETIRE, &supportsRetire);
-    EXPECT_EQ(displayRetireSupported, supportsRetire);
-}
-
-TEST_F(GetFrameTimestampsTest, QueryPresentSupported) {
-   QueryPresentRetireSupported(true, false);
-}
-
-TEST_F(GetFrameTimestampsTest, QueryRetireSupported) {
-   QueryPresentRetireSupported(false, true);
-}
-
 TEST_F(GetFrameTimestampsTest, SnapToNextTickBasic) {
     nsecs_t phase = 4000;
     nsecs_t interval = 1000;
@@ -1184,7 +1114,6 @@
     EXPECT_EQ(mFrames[0].mRefreshes[0].kGpuCompositionDoneTime,
             outGpuCompositionDoneTime);
     EXPECT_EQ(mFrames[0].mRefreshes[0].kPresentTime, outDisplayPresentTime);
-    EXPECT_EQ(mFrames[0].kRetireTime, outDisplayRetireTime);
     EXPECT_EQ(mFrames[0].kDequeueReadyTime, outDequeueReadyTime);
     EXPECT_EQ(mFrames[0].kReleaseTime, outReleaseTime);
 
@@ -1200,7 +1129,6 @@
     EXPECT_EQ(mFrames[1].mRefreshes[0].kGpuCompositionDoneTime,
             outGpuCompositionDoneTime);
     EXPECT_EQ(mFrames[1].mRefreshes[0].kPresentTime, outDisplayPresentTime);
-    EXPECT_EQ(0, outDisplayRetireTime);
     EXPECT_EQ(0, outDequeueReadyTime);
     EXPECT_EQ(0, outReleaseTime);
 }
@@ -1209,7 +1137,6 @@
 // back to the producer and the producer saves its own fence.
 TEST_F(GetFrameTimestampsTest, QueueTimestampsNoSync) {
     enableFrameTimestamps();
-    mSurface->mFakeSurfaceComposer->setSupportedTimestamps(true, true);
 
     // Dequeue and queue frame 1.
     const uint64_t fId1 = getNextFrameId();
@@ -1222,7 +1149,7 @@
     int oldCount = mFakeConsumer->mGetFrameTimestampsCount;
     int result = native_window_get_frame_timestamps(mWindow.get(), fId1,
             &outRequestedPresentTime, &outAcquireTime, nullptr, nullptr,
-            nullptr, nullptr, nullptr, nullptr, nullptr, nullptr);
+            nullptr, nullptr, nullptr, nullptr, nullptr);
     EXPECT_EQ(oldCount, mFakeConsumer->mGetFrameTimestampsCount);
     EXPECT_EQ(NO_ERROR, result);
     EXPECT_EQ(mFrames[0].kRequestedPresentTime, outRequestedPresentTime);
@@ -1234,7 +1161,7 @@
     oldCount = mFakeConsumer->mGetFrameTimestampsCount;
     result = native_window_get_frame_timestamps(mWindow.get(), fId1,
             &outRequestedPresentTime, &outAcquireTime, nullptr, nullptr,
-            nullptr, nullptr, nullptr, nullptr, nullptr, nullptr);
+            nullptr, nullptr, nullptr, nullptr, nullptr);
     EXPECT_EQ(oldCount, mFakeConsumer->mGetFrameTimestampsCount);
     EXPECT_EQ(NO_ERROR, result);
     EXPECT_EQ(mFrames[0].kRequestedPresentTime, outRequestedPresentTime);
@@ -1251,7 +1178,7 @@
     oldCount = mFakeConsumer->mGetFrameTimestampsCount;
     result = native_window_get_frame_timestamps(mWindow.get(), fId2,
             &outRequestedPresentTime, &outAcquireTime, nullptr, nullptr,
-            nullptr, nullptr, nullptr, nullptr, nullptr, nullptr);
+            nullptr, nullptr, nullptr, nullptr, nullptr);
     EXPECT_EQ(oldCount, mFakeConsumer->mGetFrameTimestampsCount);
     EXPECT_EQ(NO_ERROR, result);
     EXPECT_EQ(mFrames[1].kRequestedPresentTime, outRequestedPresentTime);
@@ -1263,7 +1190,7 @@
     oldCount = mFakeConsumer->mGetFrameTimestampsCount;
     result = native_window_get_frame_timestamps(mWindow.get(), fId2,
             &outRequestedPresentTime, &outAcquireTime, nullptr, nullptr,
-            nullptr, nullptr, nullptr, nullptr, nullptr, nullptr);
+            nullptr, nullptr, nullptr, nullptr, nullptr);
     EXPECT_EQ(oldCount, mFakeConsumer->mGetFrameTimestampsCount);
     EXPECT_EQ(NO_ERROR, result);
     EXPECT_EQ(mFrames[1].kRequestedPresentTime, outRequestedPresentTime);
@@ -1272,7 +1199,6 @@
 
 TEST_F(GetFrameTimestampsTest, ZeroRequestedTimestampsNoSync) {
     enableFrameTimestamps();
-    mSurface->mFakeSurfaceComposer->setSupportedTimestamps(true, true);
 
     // Dequeue and queue frame 1.
     dequeueAndQueue(0);
@@ -1292,7 +1218,7 @@
     // Verify a request for no timestamps doesn't result in a sync call.
     int oldCount = mFakeConsumer->mGetFrameTimestampsCount;
     int result = native_window_get_frame_timestamps(mWindow.get(), fId2,
-            nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
+            nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
             nullptr, nullptr, nullptr);
     EXPECT_EQ(NO_ERROR, result);
     EXPECT_EQ(oldCount, mFakeConsumer->mGetFrameTimestampsCount);
@@ -1302,7 +1228,6 @@
 // side without an additional sync call to the consumer.
 TEST_F(GetFrameTimestampsTest, FencesInProducerNoSync) {
     enableFrameTimestamps();
-    mSurface->mFakeSurfaceComposer->setSupportedTimestamps(true, true);
 
     // Dequeue and queue frame 1.
     const uint64_t fId1 = getNextFrameId();
@@ -1332,7 +1257,6 @@
     EXPECT_EQ(mFrames[0].mRefreshes[2].kStartTime, outLastRefreshStartTime);
     EXPECT_EQ(0, outGpuCompositionDoneTime);
     EXPECT_EQ(0, outDisplayPresentTime);
-    EXPECT_EQ(0, outDisplayRetireTime);
     EXPECT_EQ(mFrames[0].kDequeueReadyTime, outDequeueReadyTime);
     EXPECT_EQ(0, outReleaseTime);
 
@@ -1351,7 +1275,6 @@
     EXPECT_EQ(mFrames[0].mRefreshes[2].kStartTime, outLastRefreshStartTime);
     EXPECT_EQ(0, outGpuCompositionDoneTime);
     EXPECT_EQ(0, outDisplayPresentTime);
-    EXPECT_EQ(0, outDisplayRetireTime);
     EXPECT_EQ(mFrames[0].kDequeueReadyTime, outDequeueReadyTime);
     EXPECT_EQ(0, outReleaseTime);
 
@@ -1373,7 +1296,6 @@
     EXPECT_EQ(mFrames[0].mRefreshes[0].kGpuCompositionDoneTime,
             outGpuCompositionDoneTime);
     EXPECT_EQ(mFrames[0].mRefreshes[0].kPresentTime, outDisplayPresentTime);
-    EXPECT_EQ(mFrames[0].kRetireTime, outDisplayRetireTime);
     EXPECT_EQ(mFrames[0].kDequeueReadyTime, outDequeueReadyTime);
     EXPECT_EQ(mFrames[0].kReleaseTime, outReleaseTime);
 }
@@ -1383,7 +1305,6 @@
 // never exist.
 TEST_F(GetFrameTimestampsTest, NoGpuNoSync) {
     enableFrameTimestamps();
-    mSurface->mFakeSurfaceComposer->setSupportedTimestamps(true, true);
 
     // Dequeue and queue frame 1.
     const uint64_t fId1 = getNextFrameId();
@@ -1413,7 +1334,6 @@
     EXPECT_EQ(mFrames[0].mRefreshes[2].kStartTime, outLastRefreshStartTime);
     EXPECT_EQ(0, outGpuCompositionDoneTime);
     EXPECT_EQ(0, outDisplayPresentTime);
-    EXPECT_EQ(0, outDisplayRetireTime);
     EXPECT_EQ(mFrames[0].kDequeueReadyTime, outDequeueReadyTime);
     EXPECT_EQ(0, outReleaseTime);
 
@@ -1435,7 +1355,6 @@
     EXPECT_EQ(mFrames[0].mRefreshes[2].kStartTime, outLastRefreshStartTime);
     EXPECT_EQ(0, outGpuCompositionDoneTime);
     EXPECT_EQ(mFrames[0].mRefreshes[0].kPresentTime, outDisplayPresentTime);
-    EXPECT_EQ(mFrames[0].kRetireTime, outDisplayRetireTime);
     EXPECT_EQ(mFrames[0].kDequeueReadyTime, outDequeueReadyTime);
     EXPECT_EQ(mFrames[0].kReleaseTime, outReleaseTime);
 }
@@ -1444,7 +1363,6 @@
 // the most recent frame, then a sync call is not done.
 TEST_F(GetFrameTimestampsTest, NoRetireOrReleaseNoSync) {
     enableFrameTimestamps();
-    mSurface->mFakeSurfaceComposer->setSupportedTimestamps(true, true);
 
     // Dequeue and queue frame 1.
     const uint64_t fId1 = getNextFrameId();
@@ -1475,7 +1393,6 @@
     EXPECT_EQ(mFrames[0].mRefreshes[2].kStartTime, outLastRefreshStartTime);
     EXPECT_EQ(0, outGpuCompositionDoneTime);
     EXPECT_EQ(0, outDisplayPresentTime);
-    EXPECT_EQ(0, outDisplayRetireTime);
     EXPECT_EQ(mFrames[0].kDequeueReadyTime, outDequeueReadyTime);
     EXPECT_EQ(0, outReleaseTime);
 
@@ -1484,7 +1401,7 @@
     mFrames[1].signalRefreshFences();
 
     // Verify querying for all timestmaps of f2 does not do a sync call. Even
-    // though the lastRefresh, retire, dequeueReady, and release times aren't
+    // though the lastRefresh, dequeueReady, and release times aren't
     // available, a sync call should not occur because it's not possible for f2
     // to encounter the final value for those events until another frame is
     // queued.
@@ -1500,45 +1417,8 @@
     EXPECT_EQ(mFrames[1].mRefreshes[1].kStartTime, outLastRefreshStartTime);
     EXPECT_EQ(0, outGpuCompositionDoneTime);
     EXPECT_EQ(mFrames[1].mRefreshes[0].kPresentTime, outDisplayPresentTime);
-    EXPECT_EQ(0, outDisplayRetireTime);
     EXPECT_EQ(0, outDequeueReadyTime);
     EXPECT_EQ(0, outReleaseTime);
 }
 
-// This test verifies there are no sync calls for present or retire times
-// when they aren't supported and that an error is returned.
-void GetFrameTimestampsTest::PresentOrRetireUnsupportedNoSyncTest(
-        bool displayPresentSupported, bool displayRetireSupported) {
-
-    enableFrameTimestamps();
-    mSurface->mFakeSurfaceComposer->setSupportedTimestamps(
-        displayPresentSupported, displayRetireSupported);
-
-    // Dequeue and queue frame 1.
-    const uint64_t fId1 = getNextFrameId();
-    dequeueAndQueue(0);
-
-    // Verify a query for the Present and Retire times do not trigger
-    // a sync call if they are not supported.
-    resetTimestamps();
-    int oldCount = mFakeConsumer->mGetFrameTimestampsCount;
-    int result = native_window_get_frame_timestamps(mWindow.get(), fId1,
-            nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
-            displayPresentSupported ? nullptr : &outDisplayPresentTime,
-            displayRetireSupported ? nullptr : &outDisplayRetireTime,
-            nullptr, nullptr);
-    EXPECT_EQ(oldCount, mFakeConsumer->mGetFrameTimestampsCount);
-    EXPECT_EQ(BAD_VALUE, result);
-    EXPECT_EQ(-1, outDisplayRetireTime);
-    EXPECT_EQ(-1, outDisplayPresentTime);
-}
-
-TEST_F(GetFrameTimestampsTest, PresentUnsupportedNoSync) {
-   PresentOrRetireUnsupportedNoSyncTest(false, true);
-}
-
-TEST_F(GetFrameTimestampsTest, RetireUnsupportedNoSync) {
-   PresentOrRetireUnsupportedNoSyncTest(true, false);
-}
-
 }