Android Security
Apply Android-specific dependency scoping, runtime guards, pairing hygiene, permissions, and tool allow-lists for Ansight.
Use Android Setup Packages for dependency selection, then scope concrete tool suites and developer pairing to local builds.
Dependency Scoping
Use the all-in-one package for local development:
dependencies {
debugImplementation("ai.ansight:ansight-android:1.0.2-preview.1")
}
For a narrower setup, depend on ansight-core-android plus only the feature packages needed by the workflow. Avoid shipping ai.ansight:ansight-android or concrete ansight-tools-* artifacts in Play Store, CI release, or other distributable builds unless the build is explicitly internal and guarded.
Runtime Guard
Developer options enable broad tool access. Narrow or disable the guard before protected builds can expose tools.
import ai.ansight.Ansight
import ai.ansight.runtime.AnsightOptions
val options = AnsightOptions.createBuilder(
Ansight.developerOptions(clientName = "Android App")
)
.apply {
if (BuildConfig.DEBUG) {
withReadOnlyToolAccess()
} else {
withToolsDisabled()
}
}
.build()
Ansight.initializeAndActivate(application, options)
Use withReadWriteToolAccess() or withAllToolAccess() only for workflows that require mutation or delete-scoped tools.
Pairing Files
Keep generated or copied pairing material local:
ansight.json
*.ans.json
ansight.developer-pairing.json
If your app injects developer pairing through BuildConfig, Gradle resources, or assets, ensure that wiring is Debug-only. Do not bake signed developer pairing payloads into Play Store builds.
If a developer must reuse a pairing config on-device, prefer syncing or importing the signed config at runtime into app-owned secure storage, then loading it from there. Avoid placing long-lived pairing JSON in BuildConfig, resources, assets, or other build artifacts.
Permissions
Baseline local host connection requires:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
Guidance:
- Do not add
android:usesCleartextTraffic="true"by default. - Add
CAMERAonly when QR pairing is exposed. - Request camera permission at runtime before scanning.
- Avoid broader network permissions unless the app integration specifically needs them.
Sensitive Tool Suites
- VisualTree and screenshots expose rendered UI.
- FileSystem tools are constrained to approved roots but can export app files.
- Database tools can expose SQLite schema and rows.
- Preferences and SecureStorage can expose user-specific values.
- Reflection can inspect or mutate registered native roots.
Use package options and tool options to restrict roots, preference stores, keys, secure-storage prefixes, and reflection roots.