Install
$ agentstack add skill-josephsanjaya-skills-android-strictmode-expert ✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.
Security review
✓ PassedNo issues found. Passed automated security review. · v0.1.0 How review works →
- ✓ Prompt-injection patterns
- ✓ Secret / credential exfiltration
- ✓ Dangerous shell & filesystem operations
- ✓ Untrusted network calls
- ✓ Known-malicious package signatures
What it can access
- ✓ Network access No
- ✓ Filesystem access No
- ✓ Shell / process execution No
- ✓ Environment & secrets No
- ✓ Dynamic code execution No
From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.
Verified badge
Passed review? Show it. Paste this badge into your README, it links to the public security report.
Reliability & compatibility
Declared compatibility
Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.
We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.
How agent discovery & health will work →About
Android StrictMode Expert
1. Quick Decision Tree
What is target issue?
├── Block UI thread (dropped frames, ANR) ── ThreadPolicy (read references/thread_policy.md)
│ ├── SharedPreferences waitToFinish / commit ── Migrate to Jetpack DataStore
│ ├── WebView database initialization ───────── Wrap allowThreadDiskWrites / allowThreadDiskReads
│ └── DNS query or network TLS handshake ────── Dispatch background threads (Retrofit/Coroutines)
├── Memory/Security/Intent violations ────────── VmPolicy (read references/vm_policy.md)
│ ├── Unclosed SQLite Cursor or Closeable ────── Wrap in kotlin-stdlib .use block
│ ├── Application context used for layout ────── Use Activity / createWindowContext API
│ ├── Sharing raw file:// URI ───────────────── Use FileProvider + FLAG_GRANT_READ_URI_PERMISSION
│ └── Android 15 background activity blocked ── Use ActivityOptions background start modes
└── Whitelist / Custom penalties needed ───────── StrictPro library (read references/strictpro.md)
Use strict coding paradigms. Restrict main-thread blocking operations. Route all background operations through Kotlin Coroutines (Dispatchers.IO for I/O, Dispatchers.Default for CPU-bound tasks). Wrap unavoidable main thread I/O in allowThreadDiskReads / allowThreadDiskWrites.
2. Core Policies Reference Index
Read these detailed guides for code-level diagnostics and resolutions:
- [threadpolicy.md](file:///Users/jsanjaya/.gemini/config/skills/android-strictmode-expert/references/threadpolicy.md): Direct analysis of thread-level diagnostics (disk reads, disk writes, unbuffered I/O, network sockets, custom slow calls, resource mismatches).
- [vmpolicy.md](file:///Users/jsanjaya/.gemini/config/skills/android-strictmode-expert/references/vmpolicy.md): Direct analysis of VM-level diagnostics (closable resource leaks, activity context leaks, BroadcastReceiver/ServiceConnection leaks, incorrect display context, File URI exposure, unsafe intent launches, Direct Boot storage bounds, blocked background activity launches).
- [strictpro.md](file:///Users/jsanjaya/.gemini/config/skills/android-strictmode-expert/references/strictpro.md): Structure of the StrictPro library, whitelisting stack signatures, and customizing penalty executors.
- [bestpractices.md](file:///Users/jsanjaya/.gemini/config/skills/android-strictmode-expert/references/bestpractices.md): Setup templates, phased rollout protocol, remote observability telemetry, LeakCanary conflicts, and CI/CD automated test verification.
3. Essential Config Templates
Scoped Thread I/O Bypass
val oldPolicy = StrictMode.allowThreadDiskReads()
try {
// Unavoidable sub-millisecond configuration reads on startup
} finally {
StrictMode.setThreadPolicy(oldPolicy)
}
StrictPro Setup DSL
class MainApplication : Application() {
override fun onCreate() {
super.onCreate()
if (BuildConfig.DEBUG) {
StrictPro.listenActivities(this)
StrictPro.setThreadPolicy(
StrictPro.ThreadPolicy.Builder()
.detectAll()
.penaltyLog()
.penaltyDeath() // Crash on UI thread I/O
.setWhiteList {
contains("android.webkit.WebViewDatabase", null) // ignore WebView database load
}
.build()
)
StrictPro.setVmPolicy(
StrictPro.VmPolicy.Builder()
.detectAll()
.penaltyLog() // Log only (prevent GC non-deterministic crashes)
.build()
)
}
}
}
4. Operational Scanner Script
Automated Python script [scanstrictmodeviolations.py](file:///Users/jsanjaya/.gemini/config/skills/android-strictmode-expert/scripts/scanstrictmodeviolations.py) scans directories recursively to flag common violations (e.g. .commit(), unbuffered I/O, file:// intents, raw socket requests).
Run audit check:
python3 /Users/jsanjaya/.gemini/config/skills/android-strictmode-expert/scripts/scan_strictmode_violations.py
5. Key Safeguards
> [!IMPORTANT] > Phased Rollout Rule: > - Phase 1: Enable log-only .penaltyLog() process-wide to record all issues in strictmode.md. > - Phase 2: Upgrade ThreadPolicy to .penaltyDeath() for deterministic developer loop. Keep VmPolicy at .penaltyLog() to avoid non-deterministic process termination during GC sweeps.
> [!WARNING] > LeakCanary False Positives: > - Android StrictMode static fields retain the last seen Activity. Exclude android.os.StrictMode in LeakCanary referenceMatchers configuration to prevent false memory leak reports.
MUST maintain compatibility with targetSdk 35 (Android 15) guidelines. MUST avoid cleartext network payloads. MUST expose files strictly via FileProvider content:// URIs. Format all Android code output as clean Kotlin or Java with explicit lifecycle and dispatcher mappings.
Source & license
This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.
- Author: JosephSanjaya
- Source: JosephSanjaya/skills
- License: MIT
Install and usage instructions live in the source repository linked above.
Reviews
No reviews yet, be the first.
Write a review
Versions
- v0.1.0 Imported from the upstream source.