Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ class CameraCaptureManager(private val context: Context) {
provider.unbindAll()
provider.bindToLifecycle(owner, selector, capture)

val (bytes, orientation) = capture.takeJpegWithExif(context.mainExecutor())
val (bytes, orientation) = capture.takeJpegWithExif(context.mainExecutor(), context.cacheDir)
val decoded = BitmapFactory.decodeByteArray(bytes, 0, bytes.size)
?: throw IllegalStateException("UNAVAILABLE: failed to decode captured image")
val rotated = rotateBitmapByExif(decoded, orientation)
Expand Down Expand Up @@ -213,7 +213,7 @@ class CameraCaptureManager(private val context: Context) {
android.util.Log.w("CameraCaptureManager", "clip: warming up camera 1.5s...")
kotlinx.coroutines.delay(1_500)

val file = File.createTempFile("openclaw-clip-", ".mp4")
val file = File.createTempFile("openclaw-clip-", ".mp4", context.cacheDir)
val outputOptions = FileOutputOptions.Builder(file).build()

val finalized = kotlinx.coroutines.CompletableDeferred<VideoRecordEvent.Finalize>()
Expand Down Expand Up @@ -356,9 +356,9 @@ private suspend fun Context.cameraProvider(): ProcessCameraProvider =
}

/** Returns (jpegBytes, exifOrientation) so caller can rotate the decoded bitmap. */
private suspend fun ImageCapture.takeJpegWithExif(executor: Executor): Pair<ByteArray, Int> =
private suspend fun ImageCapture.takeJpegWithExif(executor: Executor, tempDir: File): Pair<ByteArray, Int> =
suspendCancellableCoroutine { cont ->
val file = File.createTempFile("openclaw-snap-", ".jpg")
val file = File.createTempFile("openclaw-snap-", ".jpg", tempDir)
val options = ImageCapture.OutputFileOptions.Builder(file).build()
takePicture(
options,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class ScreenRecordManager(private val context: Context) {
val height = metrics.heightPixels
val densityDpi = metrics.densityDpi

val file = File.createTempFile("openclaw-screen-", ".mp4")
val file = File.createTempFile("openclaw-screen-", ".mp4", context.cacheDir)
if (includeAudio) ensureMicPermission()

val recorder = createMediaRecorder()
Expand Down
Loading