fix: clear logcat buffer when starting recording

This commit is contained in:
tunbmoon
2026-04-10 13:59:02 +08:00
parent 3a18d4b4a6
commit d473d28e69
2 changed files with 1 additions and 2 deletions
@@ -399,7 +399,6 @@ private fun PlayerPageContent(
player = media3Player,
aspectRatio = uiState.aspectRatio,
mirrorFlip = uiState.mirrorFlip,
isBackgroundRetained = true,
onSurfaceReady = {
if (pendingAutoPlay && !media3Player.isPlaying) {
pendingAutoPlay = false
@@ -82,6 +82,7 @@ class LogcatViewModel : ViewModel() {
fun startRecording(context: Context) {
recordStartTime = System.currentTimeMillis()
isRecording = true
Runtime.getRuntime().exec("logcat -c")
getPrefs(context).edit {
putBoolean("is_recording", true)
putLong("start_time", recordStartTime)
@@ -256,7 +257,6 @@ fun LogcatPage(onNavigateBack: () -> Unit) {
val content = file.readText()
withContext(Dispatchers.Main) {
exportContent = content
exportFileName = record.fileName
exportLauncher.launch(record.fileName)
}
}