Skip to content

Inspect storage & WorkManager

olef v3.18.0View Markdown

Outcome: prove that a UI action persisted the expected rows, preferences, or background work—instead of trusting what the screen remembered in memory.

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.

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, and
3) after triggering the job, the Room database contains the synced rows.
Report the exact evidence and any unmet WorkManager constraints.

List every database, SharedPreferences file, and DataStore file owned by the app:

Terminal window
olef storage ls --app com.example.app

Inspect a database’s schema and run parameterized, read-only SQL queries against a WAL-consistent snapshot (with column redaction when tables hold PII):

Terminal window
olef storage db schema --app com.example.app --db app.db
olef storage db query --app com.example.app --db app.db \
--sql "SELECT id, title, synced FROM items WHERE synced = ?" \
--param 0 --limit 20

When 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:

Terminal window
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 42

SharedPreferences reads and edits respect Android’s .xml.bak recovery behavior and refuse EncryptedSharedPreferences without side effects:

Terminal window
olef storage prefs get --app com.example.app --file user_prefs
olef storage prefs set --app com.example.app --file user_prefs \
--key offline_sync --type bool --value true --restart

For Jetpack DataStore, decode .preferences_pb files directly or inspect raw protobuf fields:

Terminal window
olef storage datastore read --app com.example.app --file settings.preferences_pb

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:

Terminal window
olef work list --app com.example.app
olef work show <work-uuid> --app com.example.app

Trigger an enqueued job immediately (reporting whether Android executed or deferred it) or cancel a job and observe downstream dependent transitions:

Terminal window
olef work run <work-uuid> --app com.example.app
olef work cancel <work-uuid> --app com.example.app
  • olef storage and olef work require a debuggable build (run-as access).
  • Custom Proto DataStore files decode as raw protobuf wire fields; schema interpretation depends on your .proto definitions.
  • Requesting work run still respects OS scheduling constraints—always verify completion state and resulting storage rows afterward.

See the full CLI flags in olef storage and olef work.