Skip to content

feat: 升级PaddleOCR至v4版本,添加DevPlugin接口,修复无障碍权限和后台启动脚本问题#182

Draft
xcl199f wants to merge 8 commits intoaiselp:setup-v7from
xcl199f:setup-v7
Draft

feat: 升级PaddleOCR至v4版本,添加DevPlugin接口,修复无障碍权限和后台启动脚本问题#182
xcl199f wants to merge 8 commits intoaiselp:setup-v7from
xcl199f:setup-v7

Conversation

@xcl199f
Copy link
Copy Markdown

@xcl199f xcl199f commented Apr 5, 2026

🔥 核心变更

  1. PaddleOCR v4 升级

识别准确率大幅提升
完全兼容 v2 API,现有脚本无需修改
新增 initOcrWithConfig()、getOcrConfig()、release()、releaseDelayed() 方法

  1. 修复严重 Bug
    协程 scope 取消问题:serviceConnection.runScript 报错后导致 scope 被取消,脚本再也无法运行

✨ 其他改进
悬浮窗支持 setCoverStatusBar() 覆盖状态栏
新增 DevPlugin 接口(连接电脑/USB调试)
新增传统截图权限 requestScreenCaptureLegacy()
修复 debug 模式截屏内存泄漏
修复无障碍权限跨进程问题
后台运行增加 5 秒前台服务保活

⚠️ 注意
v2 模型已移除,slim 参数无效
完全兼容 v2 API

xcl199f added 6 commits April 5, 2026 17:13
1. DevPlugin.connectToComputer(String url);
2. DevPlugin.connectToSavedAddress();
3. DevPlugin.disconnectFromComputer();
4. DevPlugin.isComputerConnected();
5. DevPlugin.getSavedServerAddress();
6. DevPlugin.setServerAddress(String url);
7. DevPlugin.clearServerAddress();
8. DevPlugin.startUSBDebug();
9. DevPlugin.stopUSBDebug();
10. DevPlugin.isUSBDebugActive();
- 新增 在后台运行脚本时,维持5秒前台服务通知,降低运行失败的概率
移除了v2版本,只内置了一种模型,slim参数将无效
兼容v2版本函数,新增以下函数
1. paddle.initOcr(modelPath[,labelPath, cpuThreadNum, cpuPowerMode]) 不传参数或者传null将使用默认值
2. paddle.initOcrWithConfig(config) config为字典,参考OcrConfig.kt
3. paddle.getOcrConfig() 获取当前paddleOcr配置
4. paddle.release() 释放模型资源
5. paddle.releaseDelayed(delayMillis) 延迟释放资源(默认3分钟)
@codacy-production
Copy link
Copy Markdown

codacy-production Bot commented Apr 5, 2026

Not up to standards ⛔

🔴 Issues 12 high

Alerts:
⚠ 12 issues (≤ 0 issues of at least minor severity)

Results:
12 new issues

Category Results
ErrorProne 12 high

View in Codacy

🟢 Metrics 380 complexity · 23 duplication

Metric Results
Complexity 380
Duplication 23

View in Codacy

TIP This summary will be updated as you push new changes. Give us feedback

@xcl199f xcl199f changed the title feat: 升级PaddleOCR至v4版本,增强悬浮窗功能,修复多项稳定性问题 feat: 升级PaddleOCR至v4版本,添加DevPlugin接口,修复无障碍权限和后台启动脚本问题 Apr 6, 2026
@aiselp
Copy link
Copy Markdown
Owner

aiselp commented Apr 13, 2026

感谢你的代码贡献,但目前提交似乎还有些问题,例如paddle ocr示例识别结果为空,v6 api无法完成编译

@aiselp aiselp marked this pull request as draft April 13, 2026 11:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants