diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index bbfd7846..aa5f47f8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -64,15 +64,31 @@ jobs: with: java-version: 1.8 - name: Execute emulator tests - timeout-minutes: 20 - uses: reactivecircus/android-emulator-runner@v2.0.0 + timeout-minutes: 16 + uses: reactivecircus/android-emulator-runner@v2.2.0 with: api-level: ${{ matrix.EMULATOR_API }} arch: ${{ matrix.EMULATOR_ARCH }} disable-animations: true profile: Nexus 5X - emulator-options: -no-snapshot -no-window -no-boot-anim -camera-back emulated -camera-front emulated - script: ./.github/workflows/emulator_script.sh + emulator-options: -no-snapshot -no-window -no-boot-anim -camera-back emulated -camera-front emulated -gpu swiftshader_indirect + emulator-build: 6031357 + script: | + # Core + ADB_TAGS="CameraView:I CameraCallbacks:I CameraOrchestrator:I CameraEngine:I" + ADB_TAGS="$ADB_TAGS CameraUtils:I WorkerHandler:I" + # Recorders + ADB_TAGS="$ADB_TAGS VideoRecorder:I FullVideoRecorder:I SnapshotVideoRecorder:I" + ADB_TAGS="$ADB_TAGS FullPictureRecorder:I SnapshotPictureRecorder:I DeviceEncoders:I" + # Video encoders + ADB_TAGS="$ADB_TAGS MediaEncoderEngine:I MediaEncoder:I AudioMediaEncoder:I VideoMediaEncoder:I TextureMediaEncoder:I" + # Debugging + ADB_TAGS="$ADB_TAGS CameraIntegrationTest:I MessageQueue:W MPEG4Writer:I" + echo "Logcat tags: $ADB_TAGS" + adb logcat -c + adb logcat $ADB_TAGS *:E -v color & + emulator -version + ./gradlew cameraview:connectedCheck - name: Upload emulator tests artifact uses: actions/upload-artifact@v1 with: diff --git a/.github/workflows/emulator_script.sh b/.github/workflows/emulator_script.sh deleted file mode 100755 index d0b87a09..00000000 --- a/.github/workflows/emulator_script.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env bash -adb logcat -c -adb logcat CameraOrchestrator:I CameraEngine:I CameraView:I CameraCallbacks:I CameraIntegrationTest:I MediaEncoderEngine:I MediaEncoder:I AudioMediaEncoder:I VideoMediaEncoder:I TextureMediaEncoder:I VideoRecorder:I FullVideoRecorder:I SnapshotVideoRecorder:I CameraUtils:I MessageQueue:W WorkerHandler:I DeviceEncoders:I MPEG4Writer:I FullPictureRecorder:I SnapshotPictureRecorder:I *:E -v color & -./gradlew cameraview:connectedCheck \ No newline at end of file diff --git a/cameraview/src/main/java/com/otaliastudios/cameraview/engine/Camera2Engine.java b/cameraview/src/main/java/com/otaliastudios/cameraview/engine/Camera2Engine.java index 75a734ed..937dbbeb 100644 --- a/cameraview/src/main/java/com/otaliastudios/cameraview/engine/Camera2Engine.java +++ b/cameraview/src/main/java/com/otaliastudios/cameraview/engine/Camera2Engine.java @@ -638,24 +638,26 @@ public class Camera2Engine extends CameraEngine implements ImageReader.OnImageAv if (hasFrameProcessors()) { getFrameManager().release(); } - try { - // Preferring this over stopRepeating() so we're sure that all in-flights operations - // are discarded as fast as possible, which is exactly what we want. - // NOTE: this call is asynchronous. Should find a good way to wait for the outcome. - LOG.i("onStopPreview:", "calling stopRepeating()."); - // TODO HANGS (rare, emulator only) - mSession.stopRepeating(); - LOG.i("onStopPreview:", "calling abortCaptures()."); - mSession.abortCaptures(); - LOG.i("onStopPreview:", "called abortCaptures()."); - } catch (CameraAccessException e) { - // This tells us that we should stop everything. It's better to throw an unrecoverable - // exception rather than just swallow this, so everything gets stopped. - LOG.w("onStopPreview:", "abortCaptures failed!", e); - throw createCameraException(e); - } catch (IllegalStateException e) { - // This tells us that the session was already closed. - // Not sure if this can happen, but we can swallow it. + if (false) { + try { + // Preferring this over stopRepeating() so we're sure that all in-flights operations + // are discarded as fast as possible, which is exactly what we want. + // NOTE: this call is asynchronous. Should find a good way to wait for the outcome. + LOG.i("onStopPreview:", "calling stopRepeating()."); + // TODO HANGS (rare, emulator only) + mSession.stopRepeating(); + LOG.i("onStopPreview:", "calling abortCaptures()."); + mSession.abortCaptures(); + LOG.i("onStopPreview:", "called abortCaptures()."); + } catch (CameraAccessException e) { + // This tells us that we should stop everything. It's better to throw an unrecoverable + // exception rather than just swallow this, so everything gets stopped. + LOG.w("onStopPreview:", "abortCaptures failed!", e); + throw createCameraException(e); + } catch (IllegalStateException e) { + // This tells us that the session was already closed. + // Not sure if this can happen, but we can swallow it. + } } removeRepeatingRequestBuilderSurfaces(); mLastRepeatingResult = null;