SF: fix SurfaceFlinger freeze

When BufferQueueLayer errors in onFrameAvailable and
onFrameReplaced, it infinitely loops. This patch adds
a break when we get into the bad state.

Bug: 147476322
Test: verified by vendor that this fixes their bug
      and SurfaceFlinger_test

Change-Id: Ida063470edc7e688d106ec9fbac3c81bc5e00189
diff --git a/services/surfaceflinger/BufferQueueLayer.cpp b/services/surfaceflinger/BufferQueueLayer.cpp
index e85281d..dff529c 100644
--- a/services/surfaceflinger/BufferQueueLayer.cpp
+++ b/services/surfaceflinger/BufferQueueLayer.cpp
@@ -433,6 +433,7 @@
             status_t result = mQueueItemCondition.waitRelative(mQueueItemLock, ms2ns(500));
             if (result != NO_ERROR) {
                 ALOGE("[%s] Timed out waiting on callback", getDebugName());
+                break;
             }
         }
 
@@ -461,6 +462,7 @@
             status_t result = mQueueItemCondition.waitRelative(mQueueItemLock, ms2ns(500));
             if (result != NO_ERROR) {
                 ALOGE("[%s] Timed out waiting on callback", getDebugName());
+                break;
             }
         }