Search in sources :

Example 26 with Logger

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

the class CommonUtils method getTotalRamInBytes.

public static synchronized long getTotalRamInBytes() {
    long bytes;
    synchronized (CommonUtils.class) {
        if (totalRamInBytes == -1) {
            long bytes2 = 0;
            String result = extractFieldFromSystemFile(new File("/proc/meminfo"), "MemTotal");
            if (!TextUtils.isEmpty(result)) {
                String result2 = result.toUpperCase(Locale.US);
                try {
                    if (result2.endsWith("KB")) {
                        bytes2 = convertMemInfoToBytes(result2, "KB", 1024);
                    } else if (result2.endsWith("MB")) {
                        bytes2 = convertMemInfoToBytes(result2, "MB", 1048576);
                    } else if (result2.endsWith("GB")) {
                        bytes2 = convertMemInfoToBytes(result2, "GB", BYTES_IN_A_GIGABYTE);
                    } else {
                        Logger logger = Logger.getLogger();
                        logger.d("Unexpected meminfo format while computing RAM: " + result2);
                    }
                } catch (NumberFormatException e) {
                    Logger logger2 = Logger.getLogger();
                    logger2.e("Unexpected meminfo format while computing RAM: " + result2, e);
                }
            }
            totalRamInBytes = bytes2;
        }
        bytes = totalRamInBytes;
    }
    return bytes;
}
Also used : Logger(com.google.firebase.crashlytics.internal.Logger) File(java.io.File)

Example 27 with Logger

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

the class CrashlyticsReportPersistence method persistEvent.

public void persistEvent(CrashlyticsReport.Session.Event event, String sessionId, boolean isHighPriority) {
    int maxEventsToKeep = this.settingsDataProvider.getSettings().getSessionData().maxCustomExceptionEvents;
    File sessionDirectory = getSessionDirectoryById(sessionId);
    String json = TRANSFORM.eventToJson(event);
    String fileName = generateEventFilename(this.eventCounter.getAndIncrement(), isHighPriority);
    try {
        writeTextFile(new File(sessionDirectory, fileName), json);
    } catch (IOException e) {
        Logger logger = Logger.getLogger();
        logger.d("Could not persist event for session " + sessionId, e);
    }
    trimEvents(sessionDirectory, maxEventsToKeep);
}
Also used : IOException(java.io.IOException) Logger(com.google.firebase.crashlytics.internal.Logger) File(java.io.File)

Example 28 with Logger

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

the class CrashlyticsReportPersistence method loadFinalizedReports.

public List<CrashlyticsReportWithSessionId> loadFinalizedReports() {
    List<File> allReportFiles = getAllFinalizedReportFiles();
    ArrayList<CrashlyticsReportWithSessionId> allReports = new ArrayList<>();
    allReports.ensureCapacity(allReportFiles.size());
    for (File reportFile : getAllFinalizedReportFiles()) {
        try {
            CrashlyticsReport jsonReport = TRANSFORM.reportFromJson(readTextFile(reportFile));
            allReports.add(CrashlyticsReportWithSessionId.create(jsonReport, reportFile.getName()));
        } catch (IOException e) {
            Logger logger = Logger.getLogger();
            logger.d("Could not load report file " + reportFile + "; deleting", e);
            reportFile.delete();
        }
    }
    return allReports;
}
Also used : CrashlyticsReport(com.google.firebase.crashlytics.internal.model.CrashlyticsReport) ArrayList(java.util.ArrayList) CrashlyticsReportWithSessionId(com.google.firebase.crashlytics.internal.common.CrashlyticsReportWithSessionId) IOException(java.io.IOException) Logger(com.google.firebase.crashlytics.internal.Logger) File(java.io.File)

Example 29 with Logger

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

the class ProcMapEntryParser method parse.

/* JADX INFO: Access modifiers changed from: package-private */
public static ProcMapEntry parse(String mapEntry) {
    Matcher m = MAP_REGEX.matcher(mapEntry);
    if (!m.matches()) {
        return null;
    }
    try {
        long address = Long.valueOf(m.group(1), 16).longValue();
        long size = Long.valueOf(m.group(2), 16).longValue() - address;
        String perms = m.group(3);
        String path = m.group(4);
        return new ProcMapEntry(address, size, perms, path);
    } catch (Exception e) {
        Logger logger = Logger.getLogger();
        logger.d("Could not parse map entry: " + mapEntry);
        return null;
    }
}
Also used : Matcher(java.util.regex.Matcher) Logger(com.google.firebase.crashlytics.internal.Logger)

Example 30 with Logger

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

the class SessionReport method remove.

// com.google.firebase.crashlytics.internal.report.model.Report
@Override
public void remove() {
    Logger logger = Logger.getLogger();
    logger.d("Removing report at " + this.file.getPath());
    this.file.delete();
}
Also used : Logger(com.google.firebase.crashlytics.internal.Logger)

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