Search in sources :

Example 11 with Logger

use of com.google.firebase.crashlytics.internal.Logger in project GreenHouse by utsanjan.

the class IdManager method createAndStoreIid.

private synchronized String createAndStoreIid(String fidToCache, SharedPreferences prefs) {
    String iid;
    iid = formatId(UUID.randomUUID().toString());
    Logger logger = Logger.getLogger();
    logger.d("Created new Crashlytics IID: " + iid);
    prefs.edit().putString("crashlytics.installation.id", iid).putString(PREFKEY_FIREBASE_IID, fidToCache).apply();
    return iid;
}
Also used : Logger(com.google.firebase.crashlytics.internal.Logger)

Example 12 with Logger

use of com.google.firebase.crashlytics.internal.Logger in project GreenHouse by utsanjan.

the class AnalyticsConnectorReceiver method onMessageTriggered.

// com.google.firebase.analytics.connector.AnalyticsConnector.AnalyticsConnectorListener
@Override
public void onMessageTriggered(int id, Bundle extras) {
    Logger logger = Logger.getLogger();
    logger.d("AnalyticsConnectorReceiver received message: " + id + " " + extras);
    if (extras != null) {
        Bundle params = extras.getBundle(EVENT_PARAMS_KEY);
        if (params == null) {
            params = new Bundle();
        }
        String origin = params.getString(EVENT_ORIGIN_KEY);
        if (CRASHLYTICS_ORIGIN.equals(origin)) {
            dispatchCrashlyticsOriginEvent(id, extras);
            return;
        }
        String name = extras.getString("name");
        if (name != null) {
            dispatchBreadcrumbEvent(name, params);
        }
    }
}
Also used : Bundle(android.os.Bundle) Logger(com.google.firebase.crashlytics.internal.Logger)

Example 13 with Logger

use of com.google.firebase.crashlytics.internal.Logger in project GreenHouse by utsanjan.

the class CommonUtils method getAppIconHashOrNull.

public static String getAppIconHashOrNull(Context context) {
    InputStream is = null;
    String str = null;
    try {
        is = context.getResources().openRawResource(getAppIconResourceId(context));
        String sha1 = sha1(is);
        if (!isNullOrEmpty(sha1)) {
            str = sha1;
        }
        return str;
    } catch (Exception e) {
        Logger logger = Logger.getLogger();
        logger.w("Could not calculate hash for app icon:" + e.getMessage());
        return null;
    } finally {
        closeOrLog(is, "Failed to close icon input stream.");
    }
}
Also used : InputStream(java.io.InputStream) Logger(com.google.firebase.crashlytics.internal.Logger) IOException(java.io.IOException) NoSuchAlgorithmException(java.security.NoSuchAlgorithmException) InvalidKeyException(java.security.InvalidKeyException)

Example 14 with Logger

use of com.google.firebase.crashlytics.internal.Logger in project GreenHouse by utsanjan.

the class DefaultSettingsSpiCall method invoke.

// com.google.firebase.crashlytics.internal.settings.network.SettingsSpiCall
@Override
public JSONObject invoke(SettingsRequest requestData, boolean dataCollectionToken) {
    if (dataCollectionToken) {
        try {
            Map<String, String> queryParams = getQueryParamsFor(requestData);
            HttpRequest httpRequest = getHttpRequest(queryParams);
            HttpRequest httpRequest2 = applyHeadersTo(httpRequest, requestData);
            Logger logger = this.logger;
            logger.d("Requesting settings from " + getUrl());
            Logger logger2 = this.logger;
            logger2.d("Settings query params were: " + queryParams);
            HttpResponse httpResponse = httpRequest2.execute();
            Logger logger3 = this.logger;
            logger3.d("Settings request ID: " + httpResponse.header(AbstractSpiCall.HEADER_REQUEST_ID));
            JSONObject toReturn = handleResponse(httpResponse);
            return toReturn;
        } catch (IOException e) {
            this.logger.e("Settings request failed.", e);
            return null;
        }
    } else {
        throw new RuntimeException("An invalid data collection token was used.");
    }
}
Also used : HttpRequest(com.google.firebase.crashlytics.internal.network.HttpRequest) JSONObject(org.json.JSONObject) HttpResponse(com.google.firebase.crashlytics.internal.network.HttpResponse) IOException(java.io.IOException) Logger(com.google.firebase.crashlytics.internal.Logger)

Example 15 with Logger

use of com.google.firebase.crashlytics.internal.Logger in project GreenHouse by utsanjan.

the class CrashlyticsController method finalizePreviousNativeSession.

private void finalizePreviousNativeSession(String previousSessionId) {
    Logger logger = Logger.getLogger();
    logger.d("Finalizing native report for session " + previousSessionId);
    NativeSessionFileProvider nativeSessionFileProvider = this.nativeComponent.getSessionFileProvider(previousSessionId);
    File minidumpFile = nativeSessionFileProvider.getMinidumpFile();
    if (minidumpFile == null || !minidumpFile.exists()) {
        Logger logger2 = Logger.getLogger();
        logger2.w("No minidump data found for session " + previousSessionId);
        return;
    }
    LogFileManager previousSessionLogManager = new LogFileManager(this.context, this.logFileDirectoryProvider, previousSessionId);
    File nativeSessionDirectory = new File(getNativeSessionFilesDir(), previousSessionId);
    if (!nativeSessionDirectory.mkdirs()) {
        Logger.getLogger().d("Couldn't create native sessions directory");
        return;
    }
    List<NativeSessionFile> nativeSessionFiles = getNativeSessionFiles(nativeSessionFileProvider, previousSessionId, getContext(), getFilesDir(), previousSessionLogManager.getBytesForLog());
    NativeSessionFileGzipper.processNativeSessions(nativeSessionDirectory, nativeSessionFiles);
    this.reportingCoordinator.finalizeSessionWithNativeEvent(makeFirebaseSessionIdentifier(previousSessionId), nativeSessionFiles);
    previousSessionLogManager.clearLog();
}
Also used : NativeSessionFileProvider(com.google.firebase.crashlytics.internal.NativeSessionFileProvider) Logger(com.google.firebase.crashlytics.internal.Logger) File(java.io.File) LogFileManager(com.google.firebase.crashlytics.internal.log.LogFileManager)

Aggregations

Logger (com.google.firebase.crashlytics.internal.Logger)33 IOException (java.io.IOException)12 File (java.io.File)10 CrashlyticsReport (com.google.firebase.crashlytics.internal.model.CrashlyticsReport)4 HttpRequest (com.google.firebase.crashlytics.internal.network.HttpRequest)4 HttpResponse (com.google.firebase.crashlytics.internal.network.HttpResponse)4 NoSuchAlgorithmException (java.security.NoSuchAlgorithmException)2 JSONObject (org.json.JSONObject)2 SharedPreferences (android.content.SharedPreferences)1 Bundle (android.os.Bundle)1 SuccessContinuation (com.google.android.gms.tasks.SuccessContinuation)1 Task (com.google.android.gms.tasks.Task)1 NativeSessionFileProvider (com.google.firebase.crashlytics.internal.NativeSessionFileProvider)1 AnalyticsConnectorReceiver (com.google.firebase.crashlytics.internal.analytics.AnalyticsConnectorReceiver)1 AnalyticsReceiver (com.google.firebase.crashlytics.internal.analytics.AnalyticsReceiver)1 CrashlyticsReportWithSessionId (com.google.firebase.crashlytics.internal.common.CrashlyticsReportWithSessionId)1 LogFileManager (com.google.firebase.crashlytics.internal.log.LogFileManager)1 HttpRequestFactory (com.google.firebase.crashlytics.internal.network.HttpRequestFactory)1 FileStore (com.google.firebase.crashlytics.internal.persistence.FileStore)1 FileStoreImpl (com.google.firebase.crashlytics.internal.persistence.FileStoreImpl)1