File Descriptor Diagnostics
Inspect process-level Android file descriptor counts, limits, utilization, and open descriptor metadata through read-scoped remote tools.
The Android file-descriptor suite helps diagnose leaked files, sockets, pipes, and other process resources. It is included in the all-in-one ai.ansight:ansight-android package and can also be installed independently.
Published artifact: ai.ansight:ansight-tools-filedescriptordiagnostics-android.
Register the Suite
import ai.ansight.runtime.AnsightOptions
import ai.ansight.tools.filedescriptordiagnostics.withFileDescriptorDiagnosticsTools
val options = AnsightOptions.createBuilder()
.withFileDescriptorDiagnosticsTools {
includeTargets(false)
maximumReturnedDescriptors(256)
}
.withReadOnlyToolAccess()
.build()
includeTargets(false) suppresses resolved file paths and socket metadata. maximumReturnedDescriptors(...) limits how many matching records list_open returns; it does not change the open-descriptor count.
Tool Reference
| Tool | Tool id | Scope | Result | Security |
|---|---|---|---|---|
| List Open Descriptors | file_descriptors.list_open | Read | Filterable descriptor records with kind, flags, position, inode, and optional target. | High |
| Count Open Descriptors | file_descriptors.count_open | Read | Only { "count": number }; it does not resolve targets or collect descriptor details. | Medium |
| Inspect Descriptor | file_descriptors.inspect | Read | One descriptor record by non-negative descriptor number. | High |
| Get Descriptor Usage | file_descriptors.get_usage | Read | Open count, process limits, remaining capacity, and utilization. | Medium |
file_descriptors.list_open accepts:
kind: optional resource-kind filtertargetContains: optional case-insensitive target substringmaxEntries: maximum records to return after filtering
Snapshot results indicate whether collection was complete, the scanned descriptor limit, and the capture time.
Security
All four tools are read-scoped, but listing and inspection can disclose file paths and socket metadata. Prefer count and usage for routine leak detection, disable targets when paths are unnecessary, and keep the suite limited to controlled development or QA builds.