android: fix startup crash (MediaStore rejects text/plain in DCIM); log sink fallback DCIM->Download->app-private, logging never throws

This commit is contained in:
ZXCLI
2026-09-10 00:48:56 +08:00
parent ee317c7b25
commit dbb4f24608
6 changed files with 142 additions and 73 deletions
+16
View File
@@ -233,6 +233,22 @@
- 注:调试日志文件由 MediaStore Files(非 Images)写入,部分相册 app 不显示
text/plain,可用系统"文件"应用或 PC 复制 DCIM/MAG160C/debug_*.log。
## 用户反馈修复 第十二轮(2026-09-10,打开即闪退:日志落点修复)
- [x] **用户反馈**:第 11 轮 APK 装好后直接打开就闪退。
- [x] **根因**`DebugLog.startFile``MediaStore.Files` 往 DCIM/MAG160C 插
text/plain 文件;scoped storage 规定 DCIM 只收图片/视频,非媒体文件被拒,
`insert()` 抛 IllegalArgumentException,而该调用在 `LaunchedEffect →
connect()` 协程里无 try/catch → 启动即崩。
- [x] **修复**DebugLog 全链路 try/catch 永不抛异常;落点三级回退
DCIM/MAG160C → Download/MAG160C(非媒体允许目录)→ 应用私有外部目录;
文件头写实际落点 `sink=`;日志 4MB 封顶。`startFile` 提前到
MainActivity.onCreate(启动崩溃也有记录);`connect()`/权限回调整体
try/catch,失败置 `connect_fail`statusText 显示"连接流程异常")。
- [x] 构建+单测全过,dex 抽查通过;APK 已更新(11.87MB)。
- 注:取日志时 DCIM/MAG160C 和 Download/MAG160C 都看一眼(文件头 sink= 注明
实际位置);若在前者失败会自动落后者。
## 待办
- 真机USB实测(温度绝对值标定、FFC/录像/MDT保存端到端)——当前进行中: