Android Emulator Snapshot Restore Leaves GPS Location Unchanged
23.5K reputation · 04 Jan 2024, 20:42 UTC
Goal: Obtain a deterministic emulator state after restoring a snapshot so that location‑dependent tests start from a known baseline.
Constraint: While the snapshot mechanism reverts most system settings, certain hardware sensor states such as GPS coordinates, battery level, and telephony signal strength are not automatically cleared, leading to potential test flakiness. The appropriate way to reset these values—whether via an emulator flag, a snapshot option, or a standardized adb routine—is not clearly documented.
Questions:
• Does the emulator provide a flag or snapshot option to force sensor state reset on restore?
• Is there a standardized adb command that clears all sensor‑related state without requiring hard‑coded values?
• Can snapshot metadata be configured to exclude sensor state from the saved VM image?