Skip to content

Commit

Permalink
Limit SafetyNet workarounds to unstable GMS process
Browse files Browse the repository at this point in the history
The unstable process is where SafetyNet attestation actually runs, so
we only need to spoof the model in that process. Leaving other processes
fixes various issues caused by model detection and flag provisioning,
including screen-off Voice Match in Google Assistant, broken At a Glance
weather and settings on Android 12, and more.

Change-Id: Idcf663907a6c3d0408dbd45b1ac53c9eb4200df8
  • Loading branch information
kdrag0n authored and Dyneteve committed Aug 17, 2022
1 parent cac8283 commit fce9b65
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ public final class AttestationHooks {
private static final String TAG = "GmsCompat/Attestation";

private static final String PACKAGE_GMS = "com.google.android.gms";
private static final String PROCESS_UNSTABLE = "com.google.android.gms.unstable";

private static volatile boolean sIsGms = false;

private AttestationHooks() { }
Expand All @@ -55,7 +57,8 @@ private static void spoofBuildGms() {
}

public static void initApplicationBeforeOnCreate(Application app) {
if (PACKAGE_GMS.equals(app.getPackageName())) {
if (PACKAGE_GMS.equals(app.getPackageName()) &&
PROCESS_UNSTABLE.equals(Application.getProcessName())) {
sIsGms = true;
spoofBuildGms();
}
Expand Down

0 comments on commit fce9b65

Please sign in to comment.