TGViewer
AdClose Official AdClose Official @adclose · 12.3K subscribers
Post #403 12.6K
AdClose_4.0.1-1.apk3.5 MB
🟠 优化功能弹窗样式
🟠 优化响应体传递
🟠 优化组件使用
🟠 优化配置加载
🟠 修复配置保存问题(写入时损坏)
记得需要将损坏的com.close.hook.ads_preferences.json文件删除,这是模块的主配置文件,之前使用的写入操作,导致了文件内容错误进而无法读取Hook配置

com.close.hook.ads_preferences.json作为共享存储区,被多个Fragment同时访问,每个请求都是一个完整的“读-改-写”循环过程,访问模式不单一,短时间内进行的多次独立写入容易引起并发写入冲突。

实际这不完全是我的问题🙈,因为openRemoteFile只关心读和写,忽略了 "t"、"a" 等其他标志,导致后续的写入操作就变成了追加(Append),而不是覆写(Overwrite)。于是我只能手动完成MODE_TRUNCATE 标志操作解决。最开始我用openRemoteFile(fileName, "wt")只有w是活的...访问模式单一还能撑撑,当然这也给了我错觉。

所以我就感觉新API用起来有点怪怪的🙈,虽然问题不大,但排查起来真的麻烦

    @Override
public ParcelFileDescriptor openRemoteFile(String path) throws RemoteException {
var userId = ensureModule();
ConfigFileManager.ensureModuleFilePath(path);
try {
var dir = ConfigFileManager.resolveModuleDir(loadedModule.packageName, FILES_DIR, userId, Binder.getCallingUid());
return ParcelFileDescriptor.open(dir.resolve(path).toFile(), ParcelFileDescriptor.MODE_CREATE | ParcelFileDescriptor.MODE_READ_WRITE);
} catch (IOException e) {
throw new RemoteException(e.getMessage());
}
}
  • ❤ 41
  • 🐳 5
More from @adclose
  1. Jul 29, 2026🟠 增加Block规则订阅(Domain/Keyword)
  2. Jul 29, 2026photo post
  3. Jul 28, 2026Post #475
  4. Jul 28, 2026🟠 优化Hook操作
  5. Jul 26, 2026AdClose Official pinned Deleted message
  6. Jul 26, 2026🟠 修复潜在问题 🟠 优化页面功能 🟠 优化数据通信 🟠 完善Log分层
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook →Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 →