The android-inference-engine project is engineered with an uncompromising on-device security and privacy architecture. As the unified neural inference runtime powering local LLMs and the flagship Local AI for Android application, data confidentiality, memory safety, and hardware protection are central to our design.
For full architectural details, documentation, and ecosystem tools, visit localai.shanaka.dev and explore our open-source organization at github.com/local-ai-mobile.
We release security patches, stability updates, and vulnerability remediation for the following active releases:
| Version | Supported | Security Maintenance Status |
|---|---|---|
1.0.x |
✅ | Currently active production release stream (bug fixes & security updates) |
< 1.0.0 |
❌ | Deprecated preview and milestone builds |
We strongly advise developers integrating android-inference-engine into production Android applications to track the latest release published on Maven Central or GitHub Releases.
android-inference-engine executes 100% locally on Android devices without external network relays, cloud dependencies, or background data collection. To safeguard host applications, mobile silicon, and user privacy, the runtime enforces five layers of defense:
All token generation, model weight loading, prompt formatting, context window eviction, and speculative decoding execute strictly on-device. No prompt tokens, generated text, user embeddings, model paths, or performance telemetry are ever transmitted off the handset or stored in remote analytics services.
High-performance mobile inference relies on native C/C++ bindings (JNI, llama.cpp, Google LiteRT, and Android AICore). The runtime implements strict boundary validations:
- 32-Bit Memory Ceiling Guard: Enforces a strict 1.1GB memory ceiling on 32-bit processes to prevent native heap exhaustion and fatal address space crashes.
- Direct ByteBuffer Bounds: Clamps memory buffers allocated for token buffers and tensor delegates, preventing buffer overruns and segmentation faults.
- Deterministic Resource Reclamation: Enforces safe unmapping of memory-mapped model weights (
mmap) upon engine unloading to eliminate native memory leaks.
Before ingesting model weights into native runtimes:
- Magic Byte Verification: Inspects model headers (
GGUF,TFL3) to verify file integrity and prevent loading corrupted or malicious binaries. - Canonical Path Resolution: Confines file access to authorized application directories, preventing directory traversal attacks (
../) targeting private application sandboxes or external storage.
Sustained on-device neural inference places severe loads on mobile silicon:
- Dynamic Thermal Throttling (
DeviceThermalMonitor): Actively monitors Android thermal status. Under moderate or severe thermal events, the runtime automatically downscales CPU compute threads and sheds GPU layers to prevent device overheating or thermal shutdowns. - Battery Power Gating (
DevicePowerMonitor): Gates intensive model execution when battery levels fall below 15% (unplugged) or when Android OS Battery Saver mode is enabled, preventing battery degradation and unexpected device power loss.
To prevent the Android OS Low-Memory Killer from abruptly terminating the host application:
- Memory Limiter Kill Guard (
MemoryLimiterKillGuard): Listens to system memory trim signals (ComponentCallbacks2.onTrimMemory). Under critical memory pressure, it triggers tiered cache reclamation and context pruning. - Model Hibernation (
ModelHibernationManager): Automatically hibernates inactive model contexts after 5 minutes of idle time, freeing up native RAM while preserving rapid wake-up capabilities.
If you discover a security vulnerability or potential threat in android-inference-engine, please help us protect our users by responsibly disclosing it.
Caution
Do not report security vulnerabilities via public GitHub issues, discussions, or pull requests.
Please report vulnerabilities directly via email:
- Security Inquiries & Disclosures: security@shanaka.dev
- General Inquiries & Feedback: contact@shanaka.dev
Please include the following details in your report to accelerate triage:
- Description: A clear summary of the issue, affected engine backend (
LlamaCppEngine,LiteRTEngine,AiCoreEngine), and attack scenario. - Steps to Reproduce: Detailed reproduction steps, sample model weights/configuration, or a minimal Android proof-of-concept (PoC) project.
- Impact Assessment: The potential severity (e.g., native heap corruption, denial-of-service crash, path traversal).
- Crash Logs: Any relevant
logcattraces, tombstone dumps, or ASan (AddressSanitizer) reports. - Proposed Fix (Optional): Any suggested patches, defensive checks, or configuration recommendations.
When a report is received at security@shanaka.dev, the maintainers will:
- Acknowledge: Confirm receipt of your disclosure within 48 hours.
- Investigate: Triage the vulnerability, reproduce the issue, and determine affected versions within 5 business days.
- Remediate: Develop, test, and package a fix in a private branch.
- Release & Notify: Publish a patched release on Maven Central and GitHub Releases, alongside a coordinated security advisory crediting the reporter (unless anonymity is requested).
- Official Web Portal: localai.shanaka.dev
- Local AI on Google Play: dev.shanaka.localai
- GitHub Organization: github.com/local-ai-mobile
- General Inquiries: contact@shanaka.dev
- License: Apache 2.0