From 1cea66927a9ad140198cdf05798f18291151de85 Mon Sep 17 00:00:00 2001 From: zdt-copilot-polish Date: Sun, 5 Jul 2026 09:33:40 +0000 Subject: [PATCH] AI polish: isolated safe improvement Automated conservative polish for ZDT-D. Behavior-preserving change intended for validation through .github/workflows/build.yml. --- .../service/diagnostics/nfqws/NfqwsTesterBinary.kt | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/application/app/src/main/java/com/android/zdtd/service/diagnostics/nfqws/NfqwsTesterBinary.kt b/application/app/src/main/java/com/android/zdtd/service/diagnostics/nfqws/NfqwsTesterBinary.kt index bbb92903..1d666513 100755 --- a/application/app/src/main/java/com/android/zdtd/service/diagnostics/nfqws/NfqwsTesterBinary.kt +++ b/application/app/src/main/java/com/android/zdtd/service/diagnostics/nfqws/NfqwsTesterBinary.kt @@ -25,9 +25,7 @@ class NfqwsTesterBinary(private val context: Context) { if (shouldRewrite) { val tmp = File(parent, "$BINARY_NAME.tmp") tmp.outputStream().use { it.write(assetBytes) } - tmp.setReadable(true, true) - tmp.setWritable(true, true) - tmp.setExecutable(true, true) + makeFileExecutable(tmp) if (target.exists() && !target.delete()) { tmp.delete() error("Unable to replace old nfqws_tester binary: $target") @@ -37,12 +35,16 @@ class NfqwsTesterBinary(private val context: Context) { error("Unable to install nfqws_tester binary: $target") } } - target.setReadable(true, true) - target.setWritable(true, true) - target.setExecutable(true, true) + makeFileExecutable(target) return target } + private fun makeFileExecutable(file: File) { + file.setReadable(true, true) + file.setWritable(true, true) + file.setExecutable(true, true) + } + private fun sha256OrNull(file: File): String? = runCatching { val digest = MessageDigest.getInstance("SHA-256") file.inputStream().use { input ->