gmscompat: Un-spoof GMS while adding google account

GMS uses its DroidGuard service (the same that's used for safetynet)
to get the device name from the build fingerprint, which from our
current certified props, is Pixel XL. The device name after Google
login shows up in the login alert accordingly as Pixel XL, which is
inconvenient especially when you have multiple devices on the same ROM.

By restarting the DroidGuard service process (gms.unstable) as soon as
the user starts adding Google account (i.e when the GMS add account
activity is started and moved to the top of the task stack), we can
skip spoofing to certified props in this instance. When the user
stops/finishes adding account (GMS add account activity is no longer
at the top of the task stack), restart the process again, this time
spoofing to certified props in order to be ready for safetynet.

This ensures while adding a Google account, GMS reads the original
properties of the device and labels the device with its original name,
while in any other situation GMS reads certified properties required
to pass SafetyNet/Play Integrity.

Test:
- Add google account from setup wizard, settings, any other app
- Observe correct device name in gmail login alert
- SafetyNet (basic, CTS), Play Integrity (basic, device) passes.

Change-Id: Ifc9bd4d4295cfb7c0eaad6172e12f88c22d6ec26
Signed-off-by: SamarV-121 <samar@samarv121.dev>
2 files changed