|
|
@ -9,8 +9,7 @@ import android.os.Looper |
|
|
|
import android.util.Log |
|
|
|
import android.util.Log |
|
|
|
import android.widget.Toast |
|
|
|
import android.widget.Toast |
|
|
|
import io.legado.app.service.TTSReadAloudService |
|
|
|
import io.legado.app.service.TTSReadAloudService |
|
|
|
import java.io.File |
|
|
|
import io.legado.app.utils.FileUtils |
|
|
|
import java.io.FileOutputStream |
|
|
|
|
|
|
|
import java.io.PrintWriter |
|
|
|
import java.io.PrintWriter |
|
|
|
import java.io.StringWriter |
|
|
|
import java.io.StringWriter |
|
|
|
import java.text.SimpleDateFormat |
|
|
|
import java.text.SimpleDateFormat |
|
|
@ -141,14 +140,10 @@ class CrashHandler : Thread.UncaughtExceptionHandler { |
|
|
|
val timestamp = System.currentTimeMillis() |
|
|
|
val timestamp = System.currentTimeMillis() |
|
|
|
val time = format.format(Date()) |
|
|
|
val time = format.format(Date()) |
|
|
|
val fileName = "crash-$time-$timestamp.log" |
|
|
|
val fileName = "crash-$time-$timestamp.log" |
|
|
|
val path = mContext?.externalCacheDir?.toString() + "/crash/" |
|
|
|
mContext?.externalCacheDir?.let { |
|
|
|
val dir = File(path) |
|
|
|
FileUtils.createFileIfNotExist(it, fileName, "crash") |
|
|
|
if (!dir.exists()) { |
|
|
|
.writeText(sb.toString()) |
|
|
|
dir.mkdirs() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
val fos = FileOutputStream(path + fileName) |
|
|
|
|
|
|
|
fos.write(sb.toString().toByteArray()) |
|
|
|
|
|
|
|
fos.close() |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|