Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
import com.google.firebase.crashlytics.internal.persistence.FileStore;
import com.google.firebase.crashlytics.internal.settings.Settings;
import com.google.firebase.crashlytics.internal.settings.SettingsProvider;
import com.google.firebase.sessions.api.CrashEventReceiver;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FilenameFilter;
Expand Down Expand Up @@ -189,6 +190,11 @@ synchronized void handleUncaughtException(
Logger.getLogger()
.d("Handling uncaught " + "exception \"" + ex + "\" from thread " + thread.getName());

// Notify the Firebase Sessions SDK that a fatal crash has occurred.
if (!isOnDemand) {
CrashEventReceiver.notifyCrashOccurred();
}

// Capture the time that the crash occurs and close over it so that the time doesn't
// reflect when we get around to executing the task later.
final long timestampMillis = System.currentTimeMillis();
Expand Down
2 changes: 1 addition & 1 deletion firebase-sessions/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Unreleased

* [changed] Added internal api for Crashlytics to notify Sessions of crash events

# 2.1.1
* [unchanged] Updated to keep SDK versions aligned.
Expand Down
5 changes: 5 additions & 0 deletions firebase-sessions/api.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
// Signature format: 3.0
package com.google.firebase.sessions.api {

public final class CrashEventReceiver {
method public static void notifyCrashOccurred();
field public static final com.google.firebase.sessions.api.CrashEventReceiver INSTANCE;
}

public final class FirebaseSessionsDependencies {
method public static void addDependency(com.google.firebase.sessions.api.SessionSubscriber.Name subscriberName);
method public static void register(com.google.firebase.sessions.api.SessionSubscriber subscriber);
Expand Down
2 changes: 1 addition & 1 deletion firebase-sessions/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@
# See the License for the specific language governing permissions and
# limitations under the License.

version=2.1.3
version=2.2.0
latestReleasedVersion=2.1.2
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* Copyright 2025 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.google.firebase.sessions.api

/**
* Internal API used by Firebase Crashlytics to notify the Firebase Sessions SDK of fatal crashes.
*
* This object provides a static-like entry point that Crashlytics calls to inform Sessions a fatal
* crash has occurred.
*/
object CrashEventReceiver {
/**
* Notifies the Firebase Sessions SDK that a fatal crash has occurred.
*
* This method should be called by Firebase Crashlytics as soon as it detects a fatal crash. It
* safely processes the crash notification, treating the crash as a background event, to ensure
* that the session state is updated correctly.
*
* @see SharedSessionRepository.appBackground
*/
@JvmStatic
fun notifyCrashOccurred() {
// TODO(mrober): Implement in #7039
}
}
Loading