This commit is contained in:
Horis 2024-12-27 14:37:33 +08:00
parent 7825050f91
commit 8ccd05070c
3 changed files with 23 additions and 4 deletions

View File

@ -404,6 +404,8 @@ class AudioPlayService : BaseService(),
}
if (timeMinute == 0) {
AudioPlay.stop()
postEvent(EventBus.AUDIO_DS, timeMinute)
break
}
}
postEvent(EventBus.AUDIO_DS, timeMinute)

View File

@ -396,6 +396,8 @@ abstract class BaseReadAloudService : BaseService(),
}
if (timeMinute == 0) {
ReadAloud.stop(this@BaseReadAloudService)
postEvent(EventBus.READ_ALOUD_DS, timeMinute)
break
}
}
postEvent(EventBus.READ_ALOUD_DS, timeMinute)

View File

@ -164,11 +164,15 @@ class AboutFragment : PreferenceFragmentCompat() {
}
private fun copyLogs(doc: FileDoc) {
val logFiles = File(appCtx.externalCacheDir, "logs")
val crashFiles = File(appCtx.externalCacheDir, "crash")
val cacheDir = appCtx.externalCacheDir
val logFiles = File(cacheDir, "logs")
val crashFiles = File(cacheDir, "crash")
val logcatFile = File(cacheDir, "logcat.txt")
val zipFile = File(appCtx.externalCacheDir, "logs.zip")
ZipUtils.zipFiles(arrayListOf(logFiles, crashFiles), zipFile)
dumpLogcat(logcatFile)
val zipFile = File(cacheDir, "logs.zip")
ZipUtils.zipFiles(arrayListOf(logFiles, crashFiles, logcatFile), zipFile)
doc.find("logs.zip")?.delete()
@ -195,4 +199,15 @@ class AboutFragment : PreferenceFragmentCompat() {
return true
}
private fun dumpLogcat(file: File) {
try {
val process = Runtime.getRuntime().exec("logcat -d")
file.outputStream().use {
process.inputStream.copyTo(it)
}
} catch (e: Exception) {
AppLog.put("保存Logcat失败\n$e", e)
}
}
}