phone: autonomous Shizuku revive over wireless-adb; glasses screen on/off buttons

AdbClient wraps the bundled libadb.so (useLegacyPackaging -> exec from nativeLibraryDir, HOME/TMPDIR overridden, adb key injected into BuildConfig from ~/.android at build time and never committed). ShizukuProvisioner: on each BLE+WiFi connect it enables ADB-over-WiFi via Mercury, connects with mDNS fallback, pushes the Shizuku starter and runs it; runs once per BLE session, does not relaunch GlassesApp when the WS channel is already up, and exposes runShell() for arbitrary commands. DebugReceiver (DUMP) + am start --ez provision for diagnostics.

Protocol: ShizukuStatus(running/granted) + RequestShizukuStatus; glasses push it on connect and on Shizuku state change, using a passive probe() that never shows a permission dialog. Glasses kill-guard now recreates its UserService when the Shizuku binder dies instead of spamming DeadObjectException. Mercury: brightness disables auto-brightness first (was silently ignored), BLE auto-connect loop retries every 6s (fixes 'searches then stops'). New phone section 'Экран очков' with wake/sleep via adb (input keyevent 224/223).
This commit is contained in:
2026-09-27 03:52:05 +03:00
parent 59069a741e
commit 8a0b7832c0
18 changed files with 1112 additions and 44 deletions
+21
View File
@@ -4,6 +4,17 @@ plugins {
alias(libs.plugins.kotlin.serialization)
}
// adb-ключ рабочей машины (уже авторизован на очках) зашивается в APK, чтобы
// телефон мог подключиться к очкам по wireless-debugging без сопряжения.
// Ключ НЕ коммитится — берётся из ~/.android при сборке.
fun String.toBuildConfigString(): String =
"\"" + replace("\\", "\\\\").replace("\"", "\\\"").replace("\r", "").replace("\n", "\\n") + "\""
val adbKeyFile = File(System.getProperty("user.home"), ".android/adbkey")
val adbPubKeyFile = File(System.getProperty("user.home"), ".android/adbkey.pub")
val adbPrivateKeyConst = if (adbKeyFile.exists()) adbKeyFile.readText().trim().toBuildConfigString() else "\"\""
val adbPublicKeyConst = if (adbPubKeyFile.exists()) adbPubKeyFile.readText().trim().toBuildConfigString() else "\"\""
android {
namespace = "pw.binom.rayneovm.phone"
compileSdk = 37
@@ -14,6 +25,9 @@ android {
targetSdk = 37
versionCode = 1
versionName = "0.1.0"
buildConfigField("String", "ADB_PRIVATE_KEY", adbPrivateKeyConst)
buildConfigField("String", "ADB_PUBLIC_KEY", adbPublicKeyConst)
}
buildTypes {
@@ -29,12 +43,19 @@ android {
buildFeatures {
compose = true
buildConfig = true
}
packaging {
resources {
excludes += "/META-INF/{AL2.0,LGPL2.1}"
}
// libadb.so — исполняемый бинарник adb, а не shared-библиотека. Чтобы его можно
// было запускать из nativeLibraryDir (единственное разрешённое место на W^X),
// включаем legacy-packaging: jniLibs распаковываются на диск при установке.
jniLibs {
useLegacyPackaging = true
}
}
}