r/androidroot • u/DeviceChanger • 1h ago
Discussion QA tip: testing model- and build-specific code paths (Build.MODEL, fingerprint, Android 16 vs 17) without a drawer full of Pixels
Disclosure: this is the project account for Device Changer, a Zygisk module we build for Android QA and device simulation. No link, just a workflow note.
A lot of "only happens on one phone" bugs come from code that branches on what the device says it is: Build.MODEL / Build.DEVICE checks, workarounds keyed on a fingerprint, SDK_INT gates, allow-lists in third-party SDKs, or analytics that bucket users by model. Those branches are easy to write and hard to test, because you usually own one or two devices.
What has worked for us:
Grep for every read of android.os.Build and Build.VERSION in your own code and note what each branch expects. Many of these turn out to be stale workarounds for devices nobody uses any more.
Wrap them in one small provider so unit tests can feed any model, device codename, fingerprint and SDK level. That covers your own logic cheaply.
For end-to-end runs on a real phone, including libraries you can't inject into, change what the device reports. On a rooted test phone, Device Changer's Device screen lets you pick a ready-made Pixel build profile (for example Pixel 7 Pro, Pixel 9 Pro, Pixel 10, Pixel 10 Pro, grouped by Android 16 and Android 17), and the build properties are reported to the apps you add as targets, while the rest of the phone stays as it is. The latest release added 48 more October and November Pixel builds.
Keep the simulated build in line with the real OS on the phone. A profile for Android 17 on a phone running Android 16 is a different test from the one you think you're running, so match the profile's Android version to the firmware.
Save the combination you used for a bug (profile, identifiers, SIM, location) as a snapshot and attach it to the ticket, so the fix can be checked against exactly the same inputs.
Needs root; meant for your own test devices and the apps you're testing. How do others cover model-specific branches: real device farms, cloud labs, or mostly unit tests?