Factory reset paths
Script reset: S03
S03factory-reset.sh runs only when /data/do_factory_reset exists. Its find command deletes top-level entries under /data except:
crashespermanenttelemetry_dumpfwlabelupdate_successfuldo_factory_reset
It retains only ten recent files in crashes and telemetry_dump, syncs, then removes the marker. Overlay files are included in the deletion, so a reset also removes ADB/SSH payloads and returns the device to setup mode.
Button reset: S60
S60check-factory-reset.sh invokes check-factory-reset with /dev/input/event0 and key codes 114,115 (Volume Down and Volume Up). Return code 1 means the combo was detected. The script creates do_factory_reset and forces a reboot. S03 executes on that next boot.
Agent reset: hwResetDevice
Decompiled: voice-agent:0x16fd10 (hwResetDevice) opens /data/do_factory_reset with O_CREAT|O_WRONLY|O_TRUNC, syncs it, and emits a reset event.
voice-agent:0x158e30 (OnSetupFailed) calls hwResetDevice when its setup-failure code equals 4. This is separate from the physical volume-button path: setup/provisioning failure can produce the same data wipe.
UBI recovery reset
S02datamount.sh has a lower-level recovery path. If it cannot find an attached UBI device for data, it runs ubidetach and ubiformat, then creates a new data volume when necessary. This is not equivalent to S03:
- S03 removes files but preserves selected directories.
- UBI formatting recreates the volume and destroys all volume contents, including
permanent.
A postmortem must inspect the volume table and preserved directories before attributing a wipe to one specific path.
Practical diagnosis table
| Evidence | Likely path |
|---|---|
do_factory_reset exists before S03 |
Button or hwResetDevice marker path |
permanent survives |
S03 file cleanup, not full UBI format |
permanent disappears and no S89 log exists |
Early UBI failure or another full-volume operation |
| Reset follows setup failure code 4 | voice-agent::OnSetupFailed |
| Reset follows volume combo | check-factory-reset + S60 |