How to Inspect On-Device Search Indexing and Document Schemas on Android Using ADB dumpsys app_search

Modern mobile applications require fast, offline-first search capabilities across rich structured data—including local contacts, chat messages, offline notes, multimedia playlists, and downloaded documents. In Android 12 and higher, Google introduced the AppSearch framework (implemented via the Jetpack AppSearch library and managed system-wide by the AppSearchManagerService). AppSearch acts as a high-performance, on-device indexing and full-text search engine powered by an optimized native search library (Icing). Unlike traditional SQLite queries, AppSearch provides tokenization, multilingual stemming, fuzzy matching, and cross-application global search while operating under strict privacy boundaries.

When an application’s search indexing encounters corruption, query latency spikes, or cross-package document queries fail to return expected results, inspecting internal search state is essential. The Android Debug Bridge (ADB) provides direct, low-level insight into the indexing engine via dumpsys app_search, revealing registered document schemas, storage footprints, index health, and execution telemetry directly from the terminal.

Understanding Android AppSearch Architecture and Namespaces

The Android AppSearch subsystem manages structured data through distinct organizational hierarchies:

  • Namespaces: Logical partitions within an application package used to group related documents (for example, separating user_notes from draft_messages). Documents residing in different namespaces can share identical schema types without collisions.
  • Document Schemas: Strongly typed structural definitions declared by applications. Schemas define indexed fields, scoring strategies, tokenizer types (such as plain, verbatim, or RFC822 for emails), and indexing modes (prefix vs exact match).
  • Global Search vs Local Search: Local search restricts queries strictly to the calling application’s private index. Global search allows authorized system applications (such as the system launcher or Google Assistant) to query cross-app documents if the document schema explicitly grants visibility permissions.
  • Icing Native Engine: The underlying C++ search core maintaining the B-tree inverted index, term dictionary, and document storage files on the local filesystem.

Connecting via ADB and Verifying AppSearch Availability

Establish a debugging connection between your development workstation and the Android device via USB or Wireless debugging:

# Verify connected device status
adb devices -l

# Ensure device shell access is operational
adb get-state

Confirm that the device is running Android 12 (API level 31) or later, where the system-level AppSearch service is standard:

# Query Android OS API level
adb shell getprop ro.build.version.sdk

Executing dumpsys app_search

To inspect the active search indexing engine, query the service dump directly via the ADB shell:

# Query the AppSearchManagerService diagnostic dump
adb shell dumpsys app_search

The command outputs a comprehensive report detailing the active user profiles, registered package databases, initialized schema types, document counts, and search performance benchmarks.

Analysing Schema Definitions and Document Metrics

Examine a typical package record from the dumpsys app_search output:

-------------------------------------------------------------------------------
APPSEARCH MANAGER SERVICE (dumpsys app_search)
User 0:
  Package: com.example.notesapp
    Database: notes_database
      Schema Types:
        Schema: NoteDocument
          Version: 2
          Property: title (type: String, indexingType: PREFIX, tokenizerType: PLAIN)
          Property: content (type: String, indexingType: PREFIX, tokenizerType: PLAIN)
          Property: creationTimestamp (type: Long, indexingType: NONE)
      Namespaces:
        Namespace: personal_notes (Documents: 142)
        Namespace: archived_notes (Documents: 520)
      Storage:
        Document Store Size: 1.4 MB
        Index Size: 420 KB
-------------------------------------------------------------------------------

Key properties to evaluate during troubleshooting:

  • Schema Types & Version: Confirms which document models are registered and tracks database migrations. If an app updates a schema incompatibly without incrementing the version or handling migration callbacks, AppSearch drops older document indices.
  • indexingType: Displays whether string properties use PREFIX (enabling type-ahead autocomplete) or EXACT_ONLY matching.
  • Document Counts: Displays the total active documents committed per namespace, confirming whether background data synchronization has populated the index.
  • Index Size: Reveals disk space consumed by the inverted index files, helping developers detect runaway indexing bloat.

Inspecting Cross-Package Visibility Permissions

If an application intends to expose its indexed content to the Android System Launcher or Assistant via Global Search, inspect the visibility permissions section:

# Check visibility grants for global search
adb shell dumpsys app_search | grep -A 10 "Visibility"

Verify whether the document schema declares displayedBySystem or restricts access to specific package signatures (setSchemaTypeVisibilityForPackage). Misconfigured package signatures will silently block the launcher from surfacing app content in global search results.

Auditing Query Latency and Index Health

The diagnostic dump records recent search performance metrics collected by the Icing engine:

# Query recent search latency statistics
adb shell dumpsys app_search | grep -A 8 "Latency Metrics"

The report tracks average query time, document retrieval latency, and index optimization frequency. Queries consistently exceeding 50 milliseconds indicate that document sizes are overly large or that unindexed full-text property scans are occurring.

Monitoring Live Search Operations via Logcat

To watch AppSearch operations in real time as an application inserts, deletes, or queries documents:

# Monitor AppSearch events in real time
adb shell logcat -s AppSearchManagerService AppSearch

The logger reports schema registration events, batch document mutations, and query execution times, allowing developers to ensure that database operations execute efficiently without locking the main application thread.

By leveraging dumpsys app_search, Android developers and system engineers gain complete visibility into on-device indexing, ensuring responsive search performance and reliable document retrieval across mobile applications.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.