Study date: 2026-06-06
Docs refresh: TASK-504 (WAVE36F), 2026-07-12 — post-TASK-184 / pre-TASK-043 honesty, macOS host paths, Corretto 17, android-35 dual-path jar policy. Docs-only; no Gradle/tests/compile.
Honesty bound (post-TASK-184, pre-TASK-043): this page is a read-only architecture inventory of the external Android-Lua tree and how this repository uses it as fixture/source material. TASK-184 library-stub / overlay surfaces are accepted in task metadata. This document does not claim final green acceptance, does not unlock TASK-043 (serialized verification, still blocked), and does not unlock TASK-037 (final acceptance, still blocked). Inventory counts and host path status here are operator notes for analysis setup — inventory is not final until TASK-043.
External source studied read-only on this macOS host:
/Users/dingyi/projects/java_projects/Android-Lua/app/src/main
Verified repository (2026-07-12 re-check):
/Users/dingyi/projects/java_projects/Android-Luais present on this host.originishttps://github.com/TheMostBlack/Android-Lua.gitfor fetch and push.- Observed commit:
686a792dbdd2fe9727a34768ceadffcaa2abc20d.
No files were copied from the external checkout into this repository for the original architecture study (TASK-002) or for this docs refresh (TASK-504).
Analysis and verification notes on this macOS host must use only these candidates. Never hard-code Windows G:/ (or any other non-host) paths.
| Priority | Path | Role | Host status (2026-07-12 TASK-504 re-check) |
|---|---|---|---|
| 1 (preferred for reproducible analysis) | Explicit metadata jvm.androidJar |
Caller-supplied single platform jar | Set to the SDK path below when configuring analysis/tests |
| 2 | /Users/dingyi/Library/Android/sdk/platforms/android-35/android.jar |
Android SDK Platform 35 jar (ANDROID_HOME / ANDROID_SDK_ROOT typically /Users/dingyi/Library/Android/sdk) |
Present (~27,092,450 bytes) |
| 3 (optional copy) | /Users/dingyi/Downloads/android.jar |
Operator drop-in copy of a platform jar | Absent on this host; allowed when present as an explicit metadata override only |
Preferred SDK path block:
/Users/dingyi/Library/Android/sdk/platforms/android-35/android.jar
Optional Downloads path block (use only when the file exists; do not invent classpath entries for a missing file):
/Users/dingyi/Downloads/android.jar
JDK for product/test reflection on this host:
Amazon Corretto 17
/Users/dingyi/Library/Java/JavaVirtualMachines/corretto-17.0.19/Contents/Home
Note: the shell default java on this host may resolve to a newer OpenJDK (for example OpenJDK 26). Prefer Corretto 17 for Gradle/JVM-test alignment with the project toolchain. Historical Windows notes that used Temurin 17 jar.exe are not host defaults here.
Companion docs for classpath discovery and skip behavior: docs/android-platform-setup.md, docs/jvm-reflection-classloader-design.md, docs/android-lua-verification.md.
app/src/main is a hybrid Android/Lua runtime tree:
AndroidManifest.xml: declares packagecom.androlua,versionCode="4402", andversionName="4.4.2".java/: Java runtime, Lua bridge, editor widgets, dex/proxy support, Trime-derived app code, and helper utilities. The snapshot contains 493.javafiles.assets/: app-facing Lua scripts,.alylayout files, images, fonts, signing keys, precompiled oat/odex/vdex artifacts, plugin files, and helper subapps. The snapshot contains 42.luaand 10.alyfiles underassets.resources/lua/: 28 Lua support modules that are packaged as Java resources atlua/...;Welcome.javaextractsluaentries intoLuaApplication.getLuaMdDir().jni/: native Lua interpreter and C modules, built throughexternalNativeBuild.ndkBuildfromsrc/main/jni/android.mk.res/: normal Android resources: icon and welcome drawables, values, accessibility-service XML, and FileProvider paths.
The overall file-type inventory for app/src/main (host re-check 2026-07-12, still architecture-study scale; not final acceptance inventory): 493 .java, 408 .c, 176 .h, 128 .png, 71 .lua, 18 .mk, 15 .XY, 13 .odex, 13 .vdex, 10 .aly, and 5 .xml files. Do not treat these counts as TASK-043 / suite inventory; suite inventory remains frozen/review-owned (see TASK-125 / docs/test-strategy.md).
The largest Java areas are:
com.androlua: core AndroLua runtime classes. Important files includeLuaApplication,LuaActivity,LuaActivityX,LuaService,LuaAccessibilityService,LuaAssetLoader,LuaDexLoader,LuaResources, UI adapters, bitmap helpers, networking helpers, timers, threads, andMain.com.luajava: Java side of LuaJava.LuaStateexposes native Lua APIs,LuaStateFactorycreates and tracks states, andLuaJavaAPIimplements Java reflection, object indexing, method calls, class binding, proxy creation, array creation, and Java library loading.com.osfans.trime: Trime-derived IME/configuration code. This includesWelcome,Pref,Trime, keyboard/config managers, dialogs, cloud candidates, backup/download/log screens, and related utilities.com.myopicmobile.textwarrior: editor/text-buffer components used by the Lua editor.com.android.cglib.dxandcom.android.cglib.proxy: bundled dex generation and proxy/enhancement support.com.nirenrandcom.nirenr.screencapture: color/search utilities and screen-capture helpers.- Copied support/runtime namespaces such as
android.support.multidex,android.support.v4.app,android.widget,android.app, andandroid.content.
The manifest launcher names com.androlua.Welcome, but the only Welcome.java found in this snapshot is app/src/main/java/com/osfans.trime/Welcome.java with package com.osfans.trime. Treat that as a source-snapshot mismatch to resolve before relying on launcher behavior in runtime tests.
There are two different Lua-bearing areas:
resources/lua: runtime support modules. Notable files areimport.lua,loadlayout.lua,loadbitmap.lua,loadmenu.lua,autotheme.lua,permission.lua,console.lua,http.lua,socket.lua,socket/*.lua,json.lua,xml.lua,base64.lua,bin.lua,bmob.lua, and LuaSocket-style support modules.assets: application scripts and layouts. The root includes large app scripts such asmain.lua,main2.lua,main13.lua,android.lua,AndLua.lua,ThomeLua.lua,yidian.lua,file.lua,Dialog.lua,bin.lua,bmob.lua,color*.lua,loadlayout2.lua, andloadlayout3.lua. It also contains.alytable-layout files such aslayout.aly,My.aly,project.aly,projectitem.aly, andCommunity.aly.
Important subdirectories under assets:
javaapi/: large Java API reference/import helper scripts and small.alylayouts.layouthelper/: helper app scripts for converting or authoring layouts.plugin/: plugin UI scripts and layouts.font/,image/,img/,imgs/,picture/,res*, andVerify/: UI media, fonts, and small data files.keys/,libs/, andoat/: bundled signing material and precompiled artifacts.
The app scripts make heavy use of AndroLua-specific import "...", require(...), globals such as activity/service, table-based Android layouts, event-handler assignment (view.onClick = function(...) ... end), callbacks nested in tables, and Java class/member access.
app/build.gradle uses:
compileSdkVersion 28minSdkVersion 18targetSdkVersion 23ndk.abiFilters 'armeabi-v7a'externalNativeBuild.ndkBuild.path 'src/main/jni/android.mk'
src/main/jni/android.mk sets APP_ABI = armeabi-v7a and includes all subdirectory makefiles. Native directories present include bson, canvas, cjson, crypt, lfs, lluv, lsqlite3, lua, luagl, luajava, luayaml, luv, md5, regex, sensor, socket, tcc, xml, zip, and zlib.
Representative built modules declared by subdirectory Android.mk files include:
lua: Lua interpreter/runtime C sources.luajava: JNI bridge implementingluaopen_luajavaand native methods forcom.luajava.LuaState.socketandmime: LuaSocket-style native modules.cjson,bson,xml,yaml,md5,regex,zlib,libzip,crypt,canvas,gl,luv, andsensor.
LuaState loads the native LuaJava library with System.loadLibrary(...). LuaState.openLibs() opens standard Lua libraries and then _openLuajava, which registers the luajava module and exposes functions such as bindClass, newInstance, loadLib, and createProxy.
The Android res tree is small:
res/drawable/icon.pngandres/drawable/welcome.png.res/values/strings.xmlwith the accessibility-service description.res/values/styles.xmldefiningapp_themeas a Holo light no-action-bar theme with@drawable/welcomebackground.res/xml/accessibility_service_config.xml.res/xml/androlua_filepaths.xmlfor the manifestFileProvider.
The broad runtime payload is instead in assets and resources/lua.
Manifest-declared Android entry points:
application:com.androlua.LuaApplication.- Activity
com.androlua.Main: handles.alpfile/content intents and extendsLuaActivity. - Activity
com.androlua.LuaActivity: handlesandrolua://com.androluaand.luafile/content intents. - Activity
com.androlua.LuaActivityX: document-style Lua activity variant. - Activity
com.androlua.Welcome: declared asMAIN/LAUNCHER, but see the package mismatch noted above. - Activity
com.nirenr.screencapture.ScreenCaptureActivity. - Service
com.androlua.LuaService. - Accessibility service
com.androlua.LuaAccessibilityService. - Provider
android.content.FileProviderwith authoritycom.androlua.
Runtime Lua state setup:
LuaApplication.onCreate()initializes global directories,luaCpath, andluaLpath. The Lua path includes local project paths and the extracted managed Lua resource directory.MainextendsLuaActivity; itsgetLuaPath()callsinitMain()and returns<localDir>/main.lua.LuaActivity.onCreate()resolves the Lua file/project, callsdoFile(luaPath, arg), and dispatches Lua lifecycle hooks such asonCreate,onNewIntent, and menu/key callbacks throughrunFunc.LuaActivity.initLua()creates aLuaState, opens libraries and LuaJava, sets globals includingactivity,service, andthis, installsprint,set, andcall, and setspackage.path/package.cpath.LuaActivity.doFile()loads file-backed Lua withL.LloadFile(...);doAsset()loads asset-backed Lua withL.LloadBuffer(...).LuaServicemirrors the Lua-state setup for service scripts, settingserviceandthis, installing an asset loader, and executing file or asset scripts.LuaAssetLoaderis registered into package searchers sorequirecan load Lua chunks from Android assets.
The observed com.osfans.trime.Welcome implementation, if used, requests permissions, extracts lua resources to LuaApplication.getLuaMdDir(), extracts assets/rime to a shared data directory, then starts Pref.
Future parser and semantic tasks should use small, attributed snippets or generated fixtures derived from these files; TASK-002 does not vendor any of them. Post-TASK-184 product work models many of these surfaces via handwritten stubs/overlays rather than vendored upstream sources — still awaiting TASK-043 suite confirmation; do not claim final green from fixture lists alone.
Must-cover parse fixtures:
resources/lua/import.lua: AndroLua import syntax, environment mutation, nested local functions, metatables,pcall,xpcall,luajava.bindClass, and lazy package/class lookup.resources/lua/loadlayout.lua: table-driven layout parsing,requireby string, Java class binding, listener generation, nested table traversal, and callback functions embedded in tables.assets/layout.aly,assets/My.aly,assets/project.aly,assets/projectitem.aly, andassets/Community.aly:.alyfiles are Lua table layout literals with Android class names, attribute strings, nested children, and callback fields.assets/main.lua: large app shell with manyimport "..."statements, project-list logic, APK build helpers,dofile, event handlers, nested functions, table constructors, and Android object calls.assets/main2.lua: editor/file-manager script with long callbacks, timers, lifecycle hooks, shortcut handling, file operations, and heavily nested functions.assets/AndLua.luaandassets/yidian.lua: helper libraries with non-ASCII identifiers, UI helpers, Android imports, and global function definitions.assets/loadlayout2.lua,assets/loadlayout3.lua, andassets/layouthelper/main.lua: alternate layout-helper implementations and app-like helper flow.
Must-cover semantic fixtures:
resources/lua/import.lua: globalimport, localimport = require("import"), wildcard package behavior, default helper modules, and lazyluajavametatable resolution.resources/lua/autotheme.lua: compactluajava.bindClass("android.os.Build").VERSION.SDK_INTaccess.resources/lua/bin.luaandassets/bin.lua: many Java imports, zip/sign/build flows, Android intent/file APIs, nested local functions, and task callbacks.resources/lua/http.lua,resources/lua/socket.lua,resources/lua/json.lua, andresources/lua/xml.lua: reusable Lua modules forrequire/module resolution and pure Lua library semantics.assets/javaapi/android.luaandassets/javaapi/fiximport.lua: large Java API tables and import-normalization behavior.assets/plugin/main.luaandassets/plugin/*.aly: plugin-style entry script plus layout table fixtures.
This architecture page remains the external-tree map. Product modeling lives elsewhere:
| Concern | Companion doc / status note |
|---|---|
| Library stub / helper type inventory | docs/android-lua-library-models.md, docs/android-lua-library-stub-matrix.md — TASK-184 accepted focused stub surfaces; not final green |
| Compatibility claim policy | docs/android-lua-compatibility-matrix.md — post-184 modeled / awaiting TASK-043 |
| Require / path matrix | docs/android-lua-require-path-matrix.md |
| Corpus verification procedure | docs/android-lua-verification.md — uses external root + dual-path jar policy |
| Host SDK / metadata keys | docs/android-platform-setup.md |
| JVM reflection classloader | docs/jvm-reflection-classloader-design.md |
Claim policy for readers of this page:
- External layout, package list, and fixture candidates: architecture facts from the checkout at the observed commit.
- Static analysis support for
import,loadlayout,activity/service, LuaJava helpers, and Android framework classes: modeled in-product to varying degrees after TASK-184 and related work — do not claim final green. - Serialized Gradle/test verification remains review-owned under TASK-043. Workers must not run Gradle, tests, or compile for docs-only tasks.
Run these from /Users/dingyi/projects/java_projects/lua-parser in bash/zsh. The Android-Lua checkout is present on this host at the path below; re-clone before corpus acceptance if missing.
ROOT=/Users/dingyi/projects/java_projects/Android-Lua
test -d "$ROOT" && echo present || echo missing
git -C "$ROOT" remote -v
git -C "$ROOT" rev-parse HEAD
git -C "$ROOT" status --short
ls -la "$ROOT/app/src/main"
cat "$ROOT/app/src/main/AndroidManifest.xml"
cat "$ROOT/app/build.gradle"
find "$ROOT/app/src/main" -type f | head
find "$ROOT/app/src/main/assets" -type f | head
find "$ROOT/app/src/main/resources/lua" -type f | head
find "$ROOT/app/src/main/java" -type f | head
ls -d "$ROOT/app/src/main/jni"/*/ 2>/dev/null
find "$ROOT/app/src/main/jni" -type f -name 'Android.mk'
rg -n 'class Main|extends LuaActivity|onCreate|main.lua|newLuaState|openLibs|setGlobal|LloadFile|LloadBuffer' \
"$ROOT/app/src/main/java/com/androlua"
rg -n 'luaopen_luajava|bindClass|newInstance|createProxy|javaLoadLib|Java_com_luajava' \
"$ROOT/app/src/main/jni/luajava" "$ROOT/app/src/main/java/com/luajava"
rg -n -g '*.lua' -g '*.aly' 'import|require|luajava|loadlayout|activity|service|onClick|onCreate' \
"$ROOT/app/src/main/assets" "$ROOT/app/src/main/resources/lua"
# Host android.jar dual-path check (macOS only; never G:/)
SDK_JAR=/Users/dingyi/Library/Android/sdk/platforms/android-35/android.jar
DL_JAR=/Users/dingyi/Downloads/android.jar
test -f "$SDK_JAR" && ls -la "$SDK_JAR" || echo "SDK android-35 jar missing"
test -f "$DL_JAR" && ls -la "$DL_JAR" || echo "Downloads android.jar absent (ok; explicit-only)"
# Prefer Corretto 17 for jar inspection aligned with project JDK
CORRETTO17=/Users/dingyi/Library/Java/JavaVirtualMachines/corretto-17.0.19/Contents/Home
"$CORRETTO17/bin/jar" tf "$SDK_JAR" 2>/dev/null | rg 'android/widget/TextView|android/content/Context|android/view/View' | head- Docs-only worker: TASK-504-WORKER-WAVE36F-20260712
- Post-TASK-184 library stub acceptance: REVIEW38-WAVE-WAVE36C (TASK-184
donein metadata) - TASK-043 / TASK-037 remain blocked; no final-green claim
- Host re-check: Android-Lua present @
686a792dbdd2fe9727a34768ceadffcaa2abc20d; SDK android-35 jar present; Downloads jar absent; Corretto 17 available - No product code; no Gradle/tests/compile