Only force send callbacks if they are registered

Some clients of ASurfaceControl may not set callbacks.  We do not want
to call finalizePendingCallbacks in this case.

Bug: 159231312
Test: build, boot, SurfaceFlinger_test, libsurfaceflinger_unittest
Change-Id: I62dc270302a60274d8d1192d0e35ce3f48721e6c
diff --git a/services/surfaceflinger/TransactionCompletedThread.cpp b/services/surfaceflinger/TransactionCompletedThread.cpp
index 0cdff8f..ca24493 100644
--- a/services/surfaceflinger/TransactionCompletedThread.cpp
+++ b/services/surfaceflinger/TransactionCompletedThread.cpp
@@ -154,6 +154,9 @@
 
 status_t TransactionCompletedThread::finalizePendingCallbackHandles(
         const std::deque<sp<CallbackHandle>>& handles) {
+    if (handles.empty()) {
+        return NO_ERROR;
+    }
     std::lock_guard lock(mMutex);
     if (!mRunning) {
         ALOGE("cannot add presented callback handle because the callback thread isn't running");