Inspect storage & WorkManager
Outcome: prove that a UI action persisted the expected rows, preferences, or background work—instead of trusting what the screen remembered in memory.
Prerequisites
Section titled “Prerequisites”You need a debuggable build of your app on a connected device or emulator. Read-only snapshots run from the host over run-as; live SQLite queries/writes (--live) and live WorkManager cancellations attach the in-process Olef runtime automatically when needed.
Ask your agent
Section titled “Ask your agent”Toggle "Offline sync" in Settings, restart the app, and verify with Olef that:1) the preference or DataStore value actually persisted on disk,2) a sync WorkManager job was enqueued with the expected input data and constraints, and3) after triggering the job, the Room database contains the synced rows.Report the exact evidence and any unmet WorkManager constraints.1. Inspect SQLite & Room databases
Section titled “1. Inspect SQLite & Room databases”List every database, SharedPreferences file, and DataStore file owned by the app:
olef storage ls --app com.example.appInspect a database’s schema and run parameterized, read-only SQL queries against a WAL-consistent snapshot (with column redaction when tables hold PII):
olef storage db schema --app com.example.app --db app.dbolef storage db query --app com.example.app --db app.db \ --sql "SELECT id, title, synced FROM items WHERE synced = ?" \ --param 0 --limit 20When a database uses Android-specific collations such as LOCALIZED, or you need to mutate state inside a transaction to set up a test scenario, add --live:
olef storage db query --app com.example.app --db app.db --live \ --sql "SELECT id, name FROM contacts ORDER BY name COLLATE LOCALIZED LIMIT 10"olef storage db exec --app com.example.app --db app.db --live \ --sql "UPDATE items SET synced = 0 WHERE id = ?" --param 422. Inspect SharedPreferences & DataStore
Section titled “2. Inspect SharedPreferences & DataStore”SharedPreferences reads and edits respect Android’s .xml.bak recovery behavior and refuse EncryptedSharedPreferences without side effects:
olef storage prefs get --app com.example.app --file user_prefsolef storage prefs set --app com.example.app --file user_prefs \ --key offline_sync --type bool --value true --restartFor Jetpack DataStore, decode .preferences_pb files directly or inspect raw protobuf fields:
olef storage datastore read --app com.example.app --file settings.preferences_pb3. Diagnose AndroidX WorkManager jobs
Section titled “3. Diagnose AndroidX WorkManager jobs”Background sync bugs are notorious for succeeding at enqueue() and then silently waiting forever. Inspect WorkManager’s database (no_backup/androidx.work.workdb), decoded binary Data inputs/outputs, and OS JobScheduler constraint correlations:
olef work list --app com.example.appolef work show <work-uuid> --app com.example.appTrigger an enqueued job immediately (reporting whether Android executed or deferred it) or cancel a job and observe downstream dependent transitions:
olef work run <work-uuid> --app com.example.appolef work cancel <work-uuid> --app com.example.appLimits
Section titled “Limits”olef storageandolef workrequire a debuggable build (run-asaccess).- Custom Proto DataStore files decode as raw protobuf wire fields; schema interpretation depends on your
.protodefinitions. - Requesting
work runstill respects OS scheduling constraints—always verify completion state and resulting storage rows afterward.
See the full CLI flags in olef storage and olef work.