Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Add a few more checks to isEmulator while being mindful of performanc…
…e. This should give very good coverage.
  • Loading branch information
mrober committed Mar 16, 2021
commit 02398136197d9627e531a4f2a8e112e366dc00d1
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@
public class CommonUtils {

private static final String SHA1_INSTANCE = "SHA-1";
private static final String GOLDFISH = "goldfish";
private static final String RANCHU = "ranchu";
private static final String SDK = "sdk";

public static final String SHARED_PREFS_NAME = "com.google.firebase.crashlytics";
Expand Down Expand Up @@ -402,7 +404,10 @@ public static int getResourcesIdentifier(Context context, String key, String res
*/
public static boolean isEmulator(Context context) {
final String androidId = Secure.getString(context.getContentResolver(), Secure.ANDROID_ID);
return Build.PRODUCT.contains(SDK) || androidId == null;
return Build.PRODUCT.contains(SDK)
|| Build.HARDWARE.contains(GOLDFISH)
|| Build.HARDWARE.contains(RANCHU)
|| androidId == null;
}

public static boolean isRooted(Context context) {
Expand Down