fix: 代码审查6项修复

- 689处空catch块补全日志
- eval远程代码增加SHA256校验
- 删除ToolHubLogger重复定义
- getParentFile()增加null保护
- 提取buildButtonEditorPanelView内通用工具函数到文件级
- 修复HandlerThread/ValueAnimator资源泄漏
This commit is contained in:
linshenjianlu
2026-04-21 07:42:23 +08:00
parent 7e23cd95a1
commit 9ad01b436d
16 changed files with 920 additions and 892 deletions

View File

@@ -82,7 +82,7 @@ function FloatBallAppWM(logger) {
this.ui.colors = {};
// # 初始化莫奈动态配色(传入当前主题避免重复检测)
try { this.refreshMonetColors(this.isDarkTheme()); } catch (eM) {}
try { this.refreshMonetColors(this.isDarkTheme()); } catch(eM) { safeLog(null, 'e', "catch " + String(eM)); }
}
// =======================【工具dp/now/clamp】======================
@@ -102,21 +102,21 @@ FloatBallAppWM.prototype.runOnUiThreadSafe = function(fn) {
// 优先使用 Activity 的 runOnUiThread否则使用 View.post
if (this.state && this.state.ballRoot) {
this.state.ballRoot.post(new java.lang.Runnable({
run: function() { try { fn.call(self); } catch(e) {} }
run: function() { try { fn.call(self); } catch(e) { safeLog(null, 'e', "catch " + String(e)); } }
}));
} else {
// 兜底:直接执行(如果已经在 UI 线程)或尝试使用 Handler
try {
var h = new android.os.Handler(android.os.Looper.getMainLooper());
h.post(new java.lang.Runnable({
run: function() { try { fn.call(self); } catch(e) {} }
run: function() { try { fn.call(self); } catch(e) { safeLog(null, 'e', "catch " + String(e)); } }
}));
} catch(e) {
// 最后兜底:直接执行
try { fn.call(self); } catch(e2) {}
try { fn.call(self); } catch(e2) { safeLog(null, 'e', "catch " + String(e2)); }
}
}
} catch(e) {}
} catch(e) { safeLog(null, 'e', "catch " + String(e)); }
};
// # 这段代码的主要内容/用途统一图标缓存LRU减少反复解码/反复走 PackageManager降低卡顿与内存波动不改变 UI 与功能)