Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
fbe1d17
Maze v11 test
Feb 9, 2026
25efa10
w3c touch
Feb 9, 2026
50d8c27
Bump Maze Runner to v11
Feb 9, 2026
3e7a26b
Remove dependency on openssl 4
Feb 10, 2026
7632b1e
Merge pull request #2388 from bugsnag/main
YYChen01988 Feb 11, 2026
e02cce0
Merge pull request #2386 from bugsnag/tms/maze-v11
twometresteve Feb 11, 2026
4bece86
feat(oom): provide a separate error handling path for `OutOfMemoryErr…
lemnik Jan 29, 2026
c44e518
feat(oom): add basic OutOfMemory handling to the NDK module, allowing…
lemnik Jan 29, 2026
32e2e0a
feat(oom): correctly report C errors as `signal` and Android errors a…
lemnik Jan 29, 2026
9c60430
chore(oom): added the the OomHandler to the API dump
lemnik Feb 3, 2026
5b261d7
chore(oom): formatting fixes
lemnik Feb 3, 2026
0dd9355
refactor(oom): extracted the native OutOfMemoryHandler registration i…
lemnik Feb 4, 2026
39ff732
test(Throwable.anyCauseMatches): added unit tests for Throwable.anyCa…
lemnik Feb 4, 2026
1273203
test(NativeOutOfMemoryPlugin): added mazerunner scenario for the Nati…
lemnik Feb 5, 2026
6574e4f
fix(oom): moved the OutOfMemoryHandler implementation for NativeOutOf…
lemnik Feb 5, 2026
2cb25ca
test(NativeOutOfMemoryPlugin): moved NativeOOMHandlerScenario to the …
lemnik Feb 5, 2026
cd953cc
test(NativeOutOfMemoryPlugin): added a native OOM marker to the event…
lemnik Feb 5, 2026
cdb8c49
test(NativeOutOfMemoryPlugin): change NativeOutOfMemoryPlugin to use …
lemnik Feb 6, 2026
00a75d0
chore(oom): added NativeOutOfMemoryPlugin changelog
lemnik Feb 12, 2026
d0cef6a
Merge pull request #2384 from bugsnag/PLAT-15492/improve-oom-reporting
lemnik Feb 12, 2026
8a4397f
feat(AppHang): added `recoveryTimeMillis` to the AppHang plugin
lemnik Nov 27, 2025
220d4c4
test(AppHang): increase the unit test `APP_HANG_THRESHOLD` to reduce …
lemnik Dec 1, 2025
20e12c1
feat(AppHang): added appHangCooldownMillis to debounce app hang error…
lemnik Feb 12, 2026
3d5c8b8
chore(AppHang): minor cleanup of LooperMonitorThread for readability
lemnik Feb 12, 2026
ed828b7
chore(Makefile): added apiCheck to the `make check` target
lemnik Feb 12, 2026
870d249
Merge pull request #2389 from bugsnag/PLAT-15240/apphang-recovery
lemnik Feb 13, 2026
6e29df1
feat(rooting): moved root detection to a dedicated background thread …
lemnik Feb 23, 2026
98d7d07
test(CXXMarkLaunchCompletedScenario): changed CXXMarkLaunchCompletedS…
lemnik Feb 23, 2026
582d8f6
fix(DeviceID): DeviceIdStore.load should be thread safe to avoid doub…
lemnik Feb 23, 2026
1dba6a0
fix(ndk): corrected the maximum length of the `event->context` for `b…
lemnik Feb 23, 2026
06886aa
fix(ndk): populate_app_data should retrieve isLaunching from the `app…
lemnik Feb 23, 2026
cc58462
build(deps): bump gradle/actions from 5.0.1 to 5.0.2
dependabot[bot] Feb 24, 2026
930fc10
build(deps): bump github/codeql-action from 4.32.2 to 4.32.4
dependabot[bot] Feb 24, 2026
696a8be
test(CXXMarkLaunchCompletedScenario): change back to InterceptingDeli…
lemnik Feb 24, 2026
0758a34
Merge pull request #2392 from bugsnag/dependabot/github_actions/gradl…
lemnik Feb 25, 2026
de4a59a
Merge pull request #2393 from bugsnag/dependabot/github_actions/githu…
lemnik Feb 25, 2026
5a6fd3e
Merge pull request #2391 from bugsnag/PLAT-15668/bg-root-detection
lemnik Feb 25, 2026
d95eefe
fix(AppHang): reduce the frequency and overhead of the AppHang heartb…
lemnik Feb 26, 2026
575ed4b
Merge pull request #2395 from bugsnag/PLAT-15739/apphang-reduced-over…
lemnik Mar 2, 2026
7abb05c
v6.25.0
lemnik Mar 2, 2026
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
6 changes: 3 additions & 3 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd #v6.0.2
with:
submodules: recursive
- uses: gradle/actions/wrapper-validation@f29f5a9d7b09a7c6b29859002d29d24e1674c884 #v5.0.1
- uses: gradle/actions/wrapper-validation@0723195856401067f7a2779048b490ace7a47d7c #v5.0.2

- uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 #v5.2.0
with:
Expand All @@ -64,7 +64,7 @@ jobs:

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@45cbd0c69e560cd9e7cd7f8c32362050c9b7ded2 #v4.32.2
uses: github/codeql-action/init@89a39a4e59826350b863aa6b6252a07ad50cf83e #v4.32.4
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
Expand All @@ -83,6 +83,6 @@ jobs:
./gradlew --no-daemon assemble

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@45cbd0c69e560cd9e7cd7f8c32362050c9b7ded2 #v4.32.2
uses: github/codeql-action/analyze@89a39a4e59826350b863aa6b6252a07ad50cf83e #v4.32.4
with:
category: "/language:${{matrix.language}}"
4 changes: 2 additions & 2 deletions .github/workflows/scorecard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ jobs:
# Upload the results to GitHub's code scanning dashboard (optional).
# Commenting out will disable upload of results to your repo's Code Scanning dashboard
- name: "Upload to code-scanning"
uses: github/codeql-action/upload-sarif@45cbd0c69e560cd9e7cd7f8c32362050c9b7ded2 # v4.32.2
uses: github/codeql-action/upload-sarif@89a39a4e59826350b863aa6b6252a07ad50cf83e # v4.32.4
with:
sarif_file: results.sarif

Expand All @@ -77,4 +77,4 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: gradle/actions/wrapper-validation@f29f5a9d7b09a7c6b29859002d29d24e1674c884 # v5.0.1
- uses: gradle/actions/wrapper-validation@0723195856401067f7a2779048b490ace7a47d7c # v5.0.2
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
# Changelog

## 6.25.0 (2026-03-02)

### Enhancements

* Added `NativeOutOfMemoryPlugin` as a new way to report `OutOfMemoryError`s that uses pre-allocated memory in the NDK module instead of allocating an `Event` object. When used `OutOfMemoryError`s will be more reliably reported, but will not be passed to `OnErrorCallback`s (`OnSendCallback` works as expected).
[#2384](https://github.com/bugsnag/bugsnag-android/pull/2384)
* Added `appHangCooldownMillis` to the AppHangPlugin to control the number of AppHang errors produced when the app is performance constrained
[#2389](https://github.com/bugsnag/bugsnag-android/pull/2389)
* Moved root/jailbreak detection onto a background thread so that it no longer blocks startup (this should improve startup performance in most common cases)
[#2391](https://github.com/bugsnag/bugsnag-android/pull/2391)

### Bug Fixes

* Reduced the heartbeat overheads of `BugsnagAppHangPlugin` reducing both the CPU cost of a heartbeat and the frequency.
[#2395](https://github.com/bugsnag/bugsnag-android/pull/2395)

## 6.24.0 (2026-02-11)

### Enhancements
Expand Down
4 changes: 1 addition & 3 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@ source "https://rubygems.org"
#gem 'bugsnag-maze-runner', path: '../maze-runner'

# Or a specific release:
gem 'bugsnag-maze-runner', '~>10.0'
gem 'bugsnag-maze-runner', '~>11.0'

# Or follow master:
#gem 'bugsnag-maze-runner', git: 'https://github.com/bugsnag/maze-runner'

gem "license_finder", "~> 7.0"

gem "openssl", "~> 4.0"
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,6 @@ endif

.PHONY: check
check:
@./gradlew lint detekt ktlintCheck checkstyle
@./gradlew lint detekt ktlintCheck checkstyle apiCheck
@./scripts/run-cpp-check.sh
@./scripts/run-clang-format-ci-check.sh
15 changes: 15 additions & 0 deletions bugsnag-android-core/api/bugsnag-android-core.api
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ public final class com/bugsnag/android/Bugsnag {
public static fun getLastRunInfo ()Lcom/bugsnag/android/LastRunInfo;
public static fun getMetadata (Ljava/lang/String;)Ljava/util/Map;
public static fun getMetadata (Ljava/lang/String;Ljava/lang/String;)Ljava/lang/Object;
public static fun getOutOfMemoryHandler ()Lcom/bugsnag/android/OutOfMemoryHandler;
public static fun getUser ()Lcom/bugsnag/android/User;
public static fun isStarted ()Z
public static fun leaveBreadcrumb (Ljava/lang/String;)V
Expand All @@ -103,6 +104,7 @@ public final class com/bugsnag/android/Bugsnag {
public static fun resumeSession ()Z
public static fun setContext (Ljava/lang/String;)V
public static fun setGroupingDiscriminator (Ljava/lang/String;)Ljava/lang/String;
public static fun setOutOfMemoryHandler (Lcom/bugsnag/android/OutOfMemoryHandler;)V
public static fun setUser (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
public static fun start (Landroid/content/Context;)Lcom/bugsnag/android/Client;
public static fun start (Landroid/content/Context;Lcom/bugsnag/android/Configuration;)Lcom/bugsnag/android/Client;
Expand Down Expand Up @@ -147,6 +149,7 @@ public class com/bugsnag/android/Client : com/bugsnag/android/CallbackAware, com
public fun getLastRunInfo ()Lcom/bugsnag/android/LastRunInfo;
public fun getMetadata (Ljava/lang/String;)Ljava/util/Map;
public fun getMetadata (Ljava/lang/String;Ljava/lang/String;)Ljava/lang/Object;
public fun getOutOfMemoryHandler ()Lcom/bugsnag/android/OutOfMemoryHandler;
public fun getUser ()Lcom/bugsnag/android/User;
public fun leaveBreadcrumb (Ljava/lang/String;)V
public fun leaveBreadcrumb (Ljava/lang/String;Ljava/util/Map;Lcom/bugsnag/android/BreadcrumbType;)V
Expand All @@ -161,6 +164,7 @@ public class com/bugsnag/android/Client : com/bugsnag/android/CallbackAware, com
public fun resumeSession ()Z
public fun setContext (Ljava/lang/String;)V
public fun setGroupingDiscriminator (Ljava/lang/String;)Ljava/lang/String;
public fun setOutOfMemoryHandler (Lcom/bugsnag/android/OutOfMemoryHandler;)V
public fun setUser (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
public fun startSession ()V
}
Expand Down Expand Up @@ -700,6 +704,10 @@ public abstract interface class com/bugsnag/android/OnSessionCallback {
public abstract fun onSession (Lcom/bugsnag/android/Session;)Z
}

public abstract interface class com/bugsnag/android/OutOfMemoryHandler {
public abstract fun onOutOfMemory (Ljava/lang/OutOfMemoryError;)Z
}

public abstract interface class com/bugsnag/android/Plugin {
public abstract fun load (Lcom/bugsnag/android/Client;)V
public abstract fun unload ()V
Expand Down Expand Up @@ -869,6 +877,10 @@ public final class com/bugsnag/android/StateEvent$StartSession : com/bugsnag/and
public final fun getUnhandledCount ()I
}

public final class com/bugsnag/android/StateEvent$SynchronizeState : com/bugsnag/android/StateEvent {
public static final field INSTANCE Lcom/bugsnag/android/StateEvent$SynchronizeState;
}

public final class com/bugsnag/android/StateEvent$UpdateContext : com/bugsnag/android/StateEvent {
public final field context Ljava/lang/String;
public fun <init> (Ljava/lang/String;)V
Expand Down Expand Up @@ -1171,13 +1183,15 @@ public final class com/bugsnag/android/internal/TaskType : java/lang/Enum {
public abstract interface class com/bugsnag/android/internal/dag/Provider {
public abstract fun get ()Ljava/lang/Object;
public abstract fun getOrNull ()Ljava/lang/Object;
public abstract fun isComplete ()Z
}

public abstract class com/bugsnag/android/internal/dag/RunnableProvider : com/bugsnag/android/internal/dag/Provider, java/lang/Runnable {
public fun <init> ()V
public fun get ()Ljava/lang/Object;
public fun getOrNull ()Ljava/lang/Object;
public abstract fun invoke ()Ljava/lang/Object;
public fun isComplete ()Z
public final fun run ()V
}

Expand All @@ -1189,6 +1203,7 @@ public final class com/bugsnag/android/internal/dag/ValueProvider : com/bugsnag/
public fun get ()Ljava/lang/Object;
public fun getOrNull ()Ljava/lang/Object;
public fun hashCode ()I
public fun isComplete ()Z
public fun toString ()Ljava/lang/String;
}

3 changes: 1 addition & 2 deletions bugsnag-android-core/detekt-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<ID>LongParameterList:AppWithState.kt$AppWithState$( binaryArch: String?, id: String?, releaseStage: String?, version: String?, codeBundleId: String?, buildUuid: Provider&lt;String?>?, type: String?, versionCode: Number?, /** * The number of milliseconds the application was running before the event occurred */ var duration: Number?, /** * The number of milliseconds the application was running in the foreground before the * event occurred */ var durationInForeground: Number?, /** * Whether the application was in the foreground when the event occurred */ var inForeground: Boolean?, /** * Whether the application was launching when the event occurred */ var isLaunching: Boolean? )</ID>
<ID>LongParameterList:AppWithState.kt$AppWithState$( binaryArch: String?, id: String?, releaseStage: String?, version: String?, codeBundleId: String?, buildUuid: String?, type: String?, versionCode: Number?, /** * The number of milliseconds the application was running before the event occurred */ duration: Number?, /** * The number of milliseconds the application was running in the foreground before the * event occurred */ durationInForeground: Number?, /** * Whether the application was in the foreground when the event occurred */ inForeground: Boolean?, /** * Whether the application was launching when the event occurred */ isLaunching: Boolean? )</ID>
<ID>LongParameterList:AppWithState.kt$AppWithState$( config: ImmutableConfig, binaryArch: String?, id: String?, releaseStage: String?, version: String?, codeBundleId: String?, duration: Number?, durationInForeground: Number?, inForeground: Boolean?, isLaunching: Boolean? )</ID>
<ID>LongParameterList:DataCollectionModule.kt$DataCollectionModule$( contextModule: ContextModule, configModule: ConfigModule, systemServiceModule: SystemServiceModule, trackerModule: TrackerModule, bgTaskService: BackgroundTaskService, connectivity: Connectivity, deviceIdStore: Provider&lt;DeviceIdStore>, memoryTrimState: MemoryTrimState )</ID>
<ID>LongParameterList:DataCollectionModule.kt$DataCollectionModule$( contextModule: ContextModule, configModule: ConfigModule, systemServiceModule: SystemServiceModule, trackerModule: TrackerModule, bgTaskService: BackgroundTaskService, connectivity: Connectivity, deviceId: Provider&lt;DeviceIdStore.DeviceIds?>, memoryTrimState: MemoryTrimState, clientObservable: ClientObservable )</ID>
<ID>LongParameterList:Device.kt$Device$( buildInfo: DeviceBuildInfo, /** * The Application Binary Interface used */ var cpuAbi: Array&lt;String>?, /** * Whether the device has been jailbroken */ var jailbroken: Boolean?, /** * A UUID generated by Bugsnag and used for the individual application on a device */ var id: String?, /** * The IETF language tag of the locale used */ var locale: String?, /** * The total number of bytes of memory on the device */ var totalMemory: Long?, /** * A collection of names and their versions of the primary languages, frameworks or * runtimes that the application is running on */ runtimeVersions: MutableMap&lt;String, Any>? )</ID>
<ID>LongParameterList:DeviceBuildInfo.kt$DeviceBuildInfo$( val manufacturer: String?, val model: String?, val osVersion: String?, val apiLevel: Int?, val osBuild: String?, val fingerprint: String?, val tags: String?, val brand: String?, val cpuAbis: Array&lt;String>? )</ID>
<ID>LongParameterList:DeviceDataCollector.kt$DeviceDataCollector$( private val connectivity: Connectivity, private val appContext: Context, resources: Resources, private val deviceIdStore: Provider&lt;DeviceIdStore.DeviceIds?>, private val buildInfo: DeviceBuildInfo, private val dataDirectory: File, private val rootedFuture: Provider&lt;Boolean>?, private val bgTaskService: BackgroundTaskService, private val logger: Logger )</ID>
Expand Down Expand Up @@ -84,7 +84,6 @@
<ID>SwallowedException:ConnectivityCompat.kt$ConnectivityLegacy$e: NullPointerException</ID>
<ID>SwallowedException:ContextExtensions.kt$exc: RuntimeException</ID>
<ID>SwallowedException:DeviceDataCollector.kt$DeviceDataCollector$e: Throwable</ID>
<ID>SwallowedException:DeviceDataCollector.kt$DeviceDataCollector$exc: Exception</ID>
<ID>SwallowedException:DeviceDataCollector.kt$DeviceDataCollector$exception: Exception</ID>
<ID>SwallowedException:DeviceIdFilePersistence.kt$DeviceIdFilePersistence$exc: OverlappingFileLockException</ID>
<ID>SwallowedException:EventStore.kt$EventStore$exception: RejectedExecutionException</ID>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,26 @@ public static void clearFeatureFlags() {
getClient().clearFeatureFlags();
}

/**
* Override or intercept the default error handling for {@link OutOfMemoryError}s.
*
* @param handler the new handler to use (or null to revert to normal error handling for OOMs)
* @see #getOutOfMemoryHandler()
*/
public static void setOutOfMemoryHandler(@Nullable OutOfMemoryHandler handler) {
getClient().setOutOfMemoryHandler(handler);
}

/**
* Return the currently defined {@link OutOfMemoryHandler} if one is being used.
*
* @return the current {@code OutOfMemoryHandler} or null if none is set
*/
@Nullable
public static OutOfMemoryHandler getOutOfMemoryHandler() {
return getClient().getOutOfMemoryHandler();
}

/**
* Get the current Bugsnag Client instance.
*/
Expand Down
33 changes: 29 additions & 4 deletions bugsnag-android-core/src/main/java/com/bugsnag/android/Client.java
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ public Client(@NonNull Context androidContext, @NonNull String apiKey) {
* @param configuration a configuration for the Client
*/
public Client(@NonNull Context androidContext, @NonNull final Configuration configuration) {
ContextModule contextModule = new ContextModule(androidContext, bgTaskService);
ContextModule contextModule = new ContextModule(androidContext);
appContext = contextModule.getCtx();

notifier = configuration.getNotifier();
Expand Down Expand Up @@ -186,16 +186,16 @@ public Unit invoke(Boolean hasConnection, String networkState) {

// lookup system services
final SystemServiceModule systemServiceModule =
new SystemServiceModule(contextModule, bgTaskService);
new SystemServiceModule(contextModule);

// setup further state trackers and data collection
TrackerModule trackerModule = new TrackerModule(configModule,
storageModule, this, bgTaskService, callbackState);

DataCollectionModule dataCollectionModule = new DataCollectionModule(contextModule,
configModule, systemServiceModule, trackerModule,
bgTaskService, connectivity, storageModule.getDeviceIdStore(),
memoryTrimState);
bgTaskService, connectivity, storageModule.getDeviceId(),
memoryTrimState, clientObservable);

// load the device + user information
userState = storageModule.loadUser(configuration.getUser());
Expand Down Expand Up @@ -938,6 +938,31 @@ void notifyInternalWithErrorOptions(@NonNull Event event,
}
}

/**
* Override or intercept the default error handling for {@link OutOfMemoryError}s.
*
* @param handler the new handler to use (or null to revert to normal error handling for OOMs)
* @see #getOutOfMemoryHandler()
*/
public void setOutOfMemoryHandler(@Nullable OutOfMemoryHandler handler) {
if (exceptionHandler != null) {
exceptionHandler.setOutOfMemoryHandler(handler);
}
}

/**
* Return the currently defined {@link OutOfMemoryHandler} if one is being used.
*
* @return the current {@code OutOfMemoryHandler} or null if none is set
*/
@Nullable
public OutOfMemoryHandler getOutOfMemoryHandler() {
if (exceptionHandler == null) {
return null;
}
return exceptionHandler.getOutOfMemoryHandler();
}

/**
* Returns the current buffer of breadcrumbs that will be sent with captured events. This
* ordered list represents the most recent breadcrumbs to be captured up to the limit
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,8 @@ internal class ClientObservable : BaseObservable() {
fun postNdkDeliverPending() {
updateState { StateEvent.DeliverPending }
}

fun postSynchronizeState() {
updateState { StateEvent.SynchronizeState }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.bugsnag.android

import android.os.Environment
import com.bugsnag.android.internal.BackgroundTaskService
import com.bugsnag.android.internal.RootDetectionProvider
import com.bugsnag.android.internal.dag.BackgroundDependencyModule
import com.bugsnag.android.internal.dag.ConfigModule
import com.bugsnag.android.internal.dag.ContextModule
Expand All @@ -19,8 +20,9 @@ internal class DataCollectionModule(
trackerModule: TrackerModule,
bgTaskService: BackgroundTaskService,
connectivity: Connectivity,
deviceIdStore: Provider<DeviceIdStore>,
memoryTrimState: MemoryTrimState
deviceId: Provider<DeviceIdStore.DeviceIds?>,
memoryTrimState: MemoryTrimState,
clientObservable: ClientObservable
) : BackgroundDependencyModule(bgTaskService) {

private val ctx = contextModule.ctx
Expand All @@ -41,17 +43,15 @@ internal class DataCollectionModule(
)
}

private val rootDetection = provider {
val rootDetector = RootDetector(logger = logger, deviceBuildInfo = deviceBuildInfo)
rootDetector.isRooted()
}
private val rootDetection = RootDetectionProvider(deviceBuildInfo, clientObservable, logger)
.apply { start() }

val deviceDataCollector = provider {
DeviceDataCollector(
connectivity,
ctx,
ctx.resources,
deviceIdStore.map { it.load() },
deviceId,
deviceBuildInfo,
dataDir,
rootDetection,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,10 @@ internal class DeviceDataCollector(
}

private fun checkIsRooted(): Boolean {
val rooted = rootedFuture ?: return false
return try {
rootedFuture != null && rootedFuture.get()
} catch (exc: Exception) {
rooted.isComplete && rooted.get()
} catch (_: Exception) {
false
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ internal class DeviceIdStore @JvmOverloads @Suppress("LongParameterList") constr
return internalPersistence.loadDeviceId(true)
}

@Synchronized
fun load(): DeviceIds? {
if (deviceIds != null) {
return deviceIds
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ class ExceptionHandler implements UncaughtExceptionHandler {
private final Logger logger;
private boolean enabled = true;

private OutOfMemoryHandler outOfMemoryHandler = null;

ExceptionHandler(Client client, Logger logger) {
this.client = client;
this.logger = logger;
Expand All @@ -37,13 +39,26 @@ void uninstall() {
Thread.setDefaultUncaughtExceptionHandler(originalHandler);
}

public void setOutOfMemoryHandler(OutOfMemoryHandler outOfMemoryHandler) {
this.outOfMemoryHandler = outOfMemoryHandler;
}

public OutOfMemoryHandler getOutOfMemoryHandler() {
return outOfMemoryHandler;
}

@Override
public void uncaughtException(@NonNull Thread thread, @NonNull Throwable throwable) {
try {
if (!enabled || client.getConfig().shouldDiscardError(throwable)) {
return;
}

if (throwable instanceof OutOfMemoryError
&& tryHandleOutOfMemory((OutOfMemoryError) throwable)) {
return;
}

boolean strictModeThrowable = strictModeHandler.isStrictModeThrowable(throwable);

// Notify any subscribed clients of the uncaught exception
Expand Down Expand Up @@ -88,4 +103,13 @@ private void forwardToOriginalHandler(@NonNull Thread thread, @NonNull Throwable
logger.w("Exception", throwable);
}
}

private boolean tryHandleOutOfMemory(OutOfMemoryError oom) {
OutOfMemoryHandler handler = outOfMemoryHandler;
if (handler == null) {
return false;
}

return handler.onOutOfMemory(oom);
}
}
Loading
Loading