Short answer
No. The Android Emulator does not provide a snapshot flag or option to force a sensor state reset on restore, there is no standardized adb command that clears all sensor-related state without supplying a value, and snapshot metadata cannot be configured to exclude host-side sensor state.
What is confirmed
- Emulator snapshots save guest OS RAM and disk state. Quick Boot restores that VM state; Cold Boot starts fresh.
- Location injection via the emulator is host-side. The Extended Controls Location tab and the emulator console
geo fix command feed a system-level override into Android's Location Manager.
- Restoring a snapshot reverts app and system settings stored inside the VM, but it does not reset the host-side location provider. The last coordinates set in Extended Controls or via
emu geo fix continue to be fed after restore.
Likely explanation for the observed behavior
GPS coordinates, battery level and telephony signal strength are presented to the guest as emulated hardware. The emulator keeps the active override values outside the VM snapshot. On restore the VM state rolls back, but the host provider keeps pushing the previously set coordinates, so apps see the old location even though the snapshot itself is clean.
App-internal caches may also retain location. Those caches are inside the VM and are reverted by the snapshot, while the system provider remains unchanged. This mix is why tests appear flaky.
Steps needed for a deterministic baseline after restore
- Restore the snapshot as normal via AVD Manager or
emulator -avd <name> -snapshot <name>.
- Immediately set a known location baseline before tests start. Do not rely on the snapshot to clear it.
adb -s <serial> emu geo fix <longitude> <latitude> [<altitude>]
Example baseline:
adb -s emulator-5554 emu geo fix -122.084 37.422 0
Emulator console equivalent:
telnet localhost <console-port>
geo fix -122.084 37.422 0
To make the reset repeatable in CI, run the geo fix command after every snapshot restore and before launching the test suite. If you need “no location”, set a neutral baseline you control, e.g., 0 0, and treat that as the known state.
What is not available
- No snapshot option to exclude sensor state. Sensor overrides are host-side, not part of the VM image.
- No adb command that clears all sensor state without a value.
emu geo fix requires longitude and latitude. There is no emu geo clear or equivalent.
- Battery and telephony signal are similarly host-controlled. They must be reset explicitly after restore via Extended Controls or emulator console commands.
Verification you can run locally:
- Set a coordinate in Extended Controls, take a snapshot.
- Change the coordinate, then restore the snapshot.
- Check the active coordinate in Extended Controls Location tab and via
adb shell dumpsys location. The restored VM will still see the last host-set coordinate.
One missing diagnostic detail that changes the recommendation: Are you injecting location via the Extended Controls UI, via adb emu geo fix, or via an in-app mock location provider? The reset procedure differs if an app is using its own mock provider versus the emulator system override.