Android artifacts · Lesson 4 of 7
Usage, activity and notifications
11 min read
Messages and calls show what was communicated. Usage artifacts show how the phone was used around those events: which app was in the foreground, when the screen turned on, when the device was locked and unlocked, which notifications arrived and what the user was looking at when they switched apps. These records are written by Android system services, not by the apps, so they also cover apps that keep no history of their own. This lesson covers UsageStats, Digital Wellbeing, recent tasks and their snapshots, notification history and the battery usage database, with what each can and cannot prove. iOS pattern-of-life sources are covered in lessons 4.4 and 4.5.
What usage records describe
Every usage artifact records a transition seen by the system: an activity came to the foreground, the screen became interactive, the keyguard (the lock screen) was dismissed, a notification was posted. None of them records a person. An app can come to the foreground because a notification was tapped, because another app launched it or because the phone restored it after a restart. Treat usage records as strong evidence of device state and weak evidence of human intention, and corroborate them with content.
Most usage stores are also short-lived. They are pruned after days or weeks, so the time between the events and the acquisition decides what survives. Note that interval in your report.
UsageStats
The UsageStats service records app and device events for every user. Its location and format depend on the version:
| Android version | Location | Format |
|---|---|---|
| 9 and earlier | /data/system/usagestats/n/ | XML |
| 10 | /data/system/usagestats/n/ | Protocol buffers (protobuf) |
| 11 and later | /data/system_ce/n/usagestats/ | Protobuf, with package names replaced by numeric tokens |
On Android 11 and later the store is in CE storage, and a file named mappings translates the tokens back into package and class names; without it, the events cannot be attributed to apps. A version file records the build's release, codename and incremental build number, which is a useful independent record of the Android version. Events reported before the user's first unlock cannot be written to CE storage. The service holds them in files named pendingevents_<Unix milliseconds> under /data/system_de/n/usagestats/ and merges them into the CE store after unlock, so a BFU extraction can contain a few recent usage events.
The store has four subfolders, daily, weekly, monthly and yearly. Each file is named with its start time in Unix milliseconds and holds per-package aggregates (such as last time used and total time in the foreground or visible) and configuration records (such as orientation, locale and night mode); AOSP writes the event log to the daily files only. AOSP keeps daily files for 10 days, weekly files for 4 weeks, monthly files for 6 months and yearly files for 2 years. The detailed event log you will use for timelines is therefore usually limited to the last ten days or so before acquisition. The same record can appear in more than one interval, so do not count repeated rows as separate occurrences.
The service writes to disk about every 20 minutes and at shutdown. The most recent events may still be in memory at acquisition; the output of adb shell dumpsys usagestats, collected as described in lesson 2.5, can capture them.
Event types
Events carry a numeric type defined by UsageEvents.Event. The ones examiners use most are:
| Value | Name | Meaning |
|---|---|---|
| 1 | ACTIVITY_RESUMED | An activity came to the foreground (older name MOVE_TO_FOREGROUND) |
| 2 | ACTIVITY_PAUSED | An activity left the foreground (older name MOVE_TO_BACKGROUND) |
| 23 | ACTIVITY_STOPPED | An activity is no longer visible |
| 7 | USER_INTERACTION | The app was interacted with in some way |
| 10 and 12 | NOTIFICATION_SEEN, NOTIFICATION_INTERRUPTION | A notification was seen, or it alerted the user |
| 15 and 16 | SCREEN_INTERACTIVE, SCREEN_NON_INTERACTIVE | The screen became interactive or non-interactive |
| 17 and 18 | KEYGUARD_SHOWN, KEYGUARD_HIDDEN | The lock screen was shown or dismissed |
| 26 and 27 | DEVICE_SHUTDOWN, DEVICE_STARTUP | The device shut down or started |
Screen state and keyguard state are separate. A SCREEN_INTERACTIVE event without a KEYGUARD_HIDDEN event shows only that the screen turned on while the lock screen stayed in place. A notification, an incoming call, a charger or a motion sensor can cause that with nobody looking at the phone.
Worked example: relative times
Times inside a protobuf usage file are stored as offsets from the file's start time, not as absolute values. An illustrative daily file is named 1779235200000, which is 2026-05-20 00:00:00 UTC. An ACTIVITY_RESUMED event in it stores a time of 70930250. Read on its own as Unix milliseconds, that value would give 1970-01-01 19:42:10.250 UTC, which is wrong. Added to the file name, it gives 1779306130250, which is 2026-05-20 19:42:10.250 UTC, or 21:42:10 in a UTC+2 time zone. Parsers such as ALEAPP do this addition for you; when you check a value by hand, remember it.
Reading a protobuf without its schema
Many records in this module are protobuf, a compact binary format. A message is a series of fields, and each field starts with a key that combines a field number with a wire type: 0 for a variable-length integer (varint), 1 for 64 bits, 2 for length-delimited data and 5 for 32 bits. The bytes 08 96 01, for example, are field 1, a varint with the value 150. Field names and meanings are not in the file but in the schema, a .proto file. AOSP publishes the schemas for UsageStats and notification history; most apps publish none. A schema-less decoder, such as the protoc tool with its --decode_raw option, then shows only field numbers and raw values, and must guess whether length-delimited data is text, bytes or a nested message. Treat labels assigned without a schema as interpretation (lesson 7.1).
Digital Wellbeing
Digital Wellbeing is the screen time and usage dashboard on many Android devices. Google's version (package com.google.android.apps.wellbeing) keeps a database at /data/user/n/com.google.android.apps.wellbeing/databases/app_usage. Its events table stores a timestamp, read by tools as Unix milliseconds, a numeric type and a package_id that links to the packages table. Tools label the types with UsageEvents names, such as 1 for an activity resumed, 2 for paused and 18 for keyguard hidden, but Google does not document the table and that mapping has not been established from source, so treat the labels as unverified until you test them. For a period that both stores cover, compare its rows with UsageStats events for the same package. If type 1 and type 2 rows match ACTIVITY_RESUMED and ACTIVITY_PAUSED times to within a second, report the labels as confirmed for that device and app version; otherwise report the stored numbers. Samsung devices use their own Digital Wellbeing app, covered in lesson 3.7.
Two related stores are worth knowing. On Android 14 and later the Settings app keeps a battery usage database in DE storage, /data/user_de/n/com.android.settings/databases/battery-usage-db-v<number>, with periodic battery states and app usage events; on the Android 12 and 13 Pixel images ALEAPP tested, a similar battery-usage-db-v4 was kept by Google's Settings Intelligence app (com.google.android.settings.intelligence). The Settings database uses its own event codes (1 resumed, 2 stopped, 3 device shutdown), not UsageEvents numbering. Google's Device Health Services app (com.google.android.apps.turbo) keeps per-app lists of times in shared_prefs/app_usage_stats.xml. What each time marks is not documented, so use these as corroboration only.
Recent tasks and snapshots
The Recents screen, the list of apps shown by the overview button or gesture, is backed by files in /data/system_ce/n/:
- recent_tasks/<task ID>_task.xml, one per task, with attributes such as the task's real_activity and affinity (which app it belongs to), the calling_package that started it and last_time_moved, the device-clock time in Unix milliseconds when the task was last moved in the task order, for example brought to the front. Android 8.1 and earlier also stored first_active_time and last_active_time; AOSP has not written them since Android 9, so empty columns for them in a tool report are normal;
- snapshots/<task ID>.jpg and <task ID>_reduced.jpg, the full and low-resolution images of the app's screen when it left the foreground, with <task ID>.proto holding metadata about the snapshot.
A snapshot can show exactly what was on the screen: a message thread, a map or a document. That makes it valuable and also sensitive, so keep it within your scope. Not every image is a real screen capture. If any window of the app is marked secure (FLAG_SECURE, used by many banking and messaging apps) or the app disables recents screenshots, AOSP stores a substitute drawn from the app's theme instead of the screen content. On Android 11 and later the snapshot record carries an id taken from the system clock when it was made, which ALEAPP shows as a time; on Android 9 and 10 there is no such field. The Recents list changes constantly, so a missing task shows nothing about past use.
Notification history
Android 11 added Notification history, a user setting in the notification settings that is off by default in AOSP. When it is on, the setting notification_history_enabled is 1 in the user's settings_secure.xml, and the system stores notifications in protobuf files under /data/system_ce/n/notification_history/history/. Each record holds the posting package, the channel, the title and text, the time posted and, for conversations, a conversation ID. AOSP keeps these files for only one day, so the store normally covers about the 24 hours before acquisition.
The text of a notification is a copy of message content. It can show a message preview, the sender's name and the time even after the user deleted the message in the app, which lesson 5.5 develops. A notification shows that the app posted it, not that the user read it; for that, look for NOTIFICATION_SEEN events or opening of the app. Snoozed notifications are recorded separately, in /data/system/notification_policy.xml.
Interpreting usage artifacts
- Check the clock. All of these times come from the device clock. A time zone change or a manual clock change shifts everything. Samsung's Wellbeing database, for example, can log time zone changes; lesson 6.4 covers reconciliation.
- Look at sequences, not single events. KEYGUARD_HIDDEN, then ACTIVITY_RESUMED for a messaging app, then a sent message seconds later is a coherent story. An isolated event is not.
- Expect duplicates and gaps. Several stores record the same transition with slightly different times. A gap can mean that the phone was off, that data was not yet flushed or that the file was pruned.
- Know the versions. Event names, file formats and paths have changed several times. State the version you validated against.
Applying this to the Corvane case
Victor's Galaxy A phone is acquired about ten weeks after Day 1. The notification history from Day 2 no longer exists, because the system keeps it for about 24 hours. The daily UsageStats files, which hold the event log and are kept for 10 days, and the weekly files, kept for 4 weeks, have been pruned as well. That is itself a finding to report: the absence of usage events for Day 2 does not mean WhatsApp was not used. The monthly and yearly files can still show WhatsApp's aggregate use for the period (last time used and total foreground time), without single events, and Samsung's own Wellbeing database (lesson 3.7) may hold events of its own. Had the phone been acquired within a day, notification history could have held the preview text of Lena's WhatsApp messages and recent task snapshots might have shown the chat with the three photos. Acquisition timing decides which of these sources exist.
Exam focus: Know where UsageStats are stored on Android 9 and earlier, Android 10 and Android 11 and later, the role of the mappings file and that event times are offsets from the file's start time. Know the main event types, the retention of each interval, where recent tasks, snapshots and notification history are kept, that notification history is off by default and lasts about a day, and why usage records describe device state rather than intent.