Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e5989848 authored by Dave Sparks's avatar Dave Sparks Committed by Android Git Automerger
Browse files

am 281acf42: Merge change I52479480 into eclair

Merge commit '281acf421f4b977add75d736d1083413e1d5f24a' into eclair-mr2

* commit '281acf421f4b977add75d736d1083413e1d5f24a':
  Retry overlay create if it fails. Bug 2153980.
parents c2a3aa07 5ce17499
Loading
Loading
Loading
Loading
+13 −1
Original line number Diff line number Diff line
@@ -563,7 +563,19 @@ status_t CameraService::Client::setOverlay()
    status_t ret = NO_ERROR;
    if (mSurface != 0) {
        if (mOverlayRef.get() == NULL) {

            // FIXME:
            // Surfaceflinger may hold onto the previous overlay reference for some
            // time after we try to destroy it. retry a few times. In the future, we
            // should make the destroy call block, or possibly specify that we can
            // wait in the createOverlay call if the previous overlay is in the 
            // process of being destroyed.
            for (int retry = 0; retry < 50; ++retry) {
                mOverlayRef = mSurface->createOverlay(w, h, OVERLAY_FORMAT_DEFAULT);
                if (mOverlayRef != NULL) break;
                LOGD("Overlay create failed - retrying");
                usleep(20000);
            }
            if ( mOverlayRef.get() == NULL )
            {
                LOGE("Overlay Creation Failed!");