package com.gh4a.utils;

import android.app.Application;
import android.content.pm.ApplicationInfo;
import android.os.Build;
import android.text.TextUtils;

import com.crashlytics.android.Crashlytics;

import io.fabric.sdk.android.Fabric;

public class CrashReportingHelper {
    private static final int MAX_TRACKED_URLS = 5;
    private static int sNextUrlTrackingPosition = 0;
    private static boolean sHasCrashlytics;

    public static void onCreate(Application app) {
        boolean isDebuggable = (app.getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0;
        sHasCrashlytics = (!isDebuggable && !TextUtils.equals(Build.DEVICE, "sdk"));

        if (sHasCrashlytics) {
            Fabric.with(app, new Crashlytics());
        }
    }
    public static void trackVisitedUrl(Application app, String url) {
        if (sHasCrashlytics) {
            Crashlytics.setString("github-url-" + sNextUrlTrackingPosition, url);
            Crashlytics.setInt("last-url-position", sNextUrlTrackingPosition);
            if (++sNextUrlTrackingPosition >= MAX_TRACKED_URLS) {
                sNextUrlTrackingPosition = 0;
            }
        }
    }
}
@@ -599,17 +599,16 @@
 ytics = 
-(
 !isDebug
@@ -621,45 +621,19 @@
 && !
-TextUtils.equals(Build.DEVICE, %22sdk%22)
+isEmulator(
 );%0A%0A
@@ -1131,10 +1131,267 @@
  %7D%0A    %7D
+%0A%0A    private static boolean isEmulator() %7B%0A        return Build.FINGERPRINT.startsWith(%22unknown%22)%0A                %7C%7C Build.FINGERPRINT.startsWith(%22unknown%22)%0A                %7C%7C (Build.BRAND.startsWith(%22generic%22) && Build.DEVICE.startsWith(%22generic%22));%0A    %7D
 %0A%7D

Fix checking for being run in emulator.