Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Jason <[email protected]>
  • Loading branch information
fractalwrench and lemnik committed Jun 29, 2021
1 parent 1735897 commit 3b759bb
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
4 changes: 1 addition & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
* Cache results from PackageManager
[#1288](https://github.com/bugsnag/bugsnag-android/pull/1288)

<<<<<<< HEAD
* Use ring buffer to store breadcrumbs
[#1286](https://github.com/bugsnag/bugsnag-android/pull/1286)

Expand All @@ -47,10 +46,9 @@

* Replace calls to String.format() with concatenation
[#1293](https://github.com/bugsnag/bugsnag-android/pull/1293)
=======

* Register system callbacks on background thread
[#1292](https://github.com/bugsnag/bugsnag-android/pull/1292)
>>>>>>> f61b285a (perf: register system callbacks on background thread)

* Optimize capture of thread traces
[#1300](https://github.com/bugsnag/bugsnag-android/pull/1300)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ public void onLowMemoryEvent() {
when(context.getApplicationContext()).thenReturn(context);
Client client = new Client(context, BugsnagTestUtils.generateConfiguration());

// block until observer is registered
client.bgTaskService.shutdown();

// capture the registered ComponentCallbacks
verify(context, times(1)).registerComponentCallbacks(componentCallbacksCaptor.capture());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,10 +223,6 @@ public Unit invoke(String activity, Map<String, ?> metadata) {
exceptionHandler.install();
}

// register listeners for system events in the background.
systemBroadcastReceiver = new SystemBroadcastReceiver(this, logger);
registerListenersInBackground();

// load last run info
lastRunInfoStore = new LastRunInfoStore(immutableConfig);
lastRunInfo = loadLastRunInfo();
Expand All @@ -239,6 +235,10 @@ public Unit invoke(String activity, Map<String, ?> metadata) {
eventStore.flushAsync();
sessionTracker.flushAsync();

// register listeners for system events in the background.
systemBroadcastReceiver = new SystemBroadcastReceiver(this, logger);
registerListenersInBackground();

// leave auto breadcrumb
Map<String, Object> data = Collections.emptyMap();
leaveAutoBreadcrumb("Bugsnag loaded", BreadcrumbType.STATE, data);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ internal class SystemBroadcastReceiver(

fun shortenActionNameIfNeeded(action: String): String {
return if (isAndroidKey(action)) {
action.substring(action.lastIndexOf(".") + 1)
action.substringAfterLast('.')
} else {
action
}
Expand Down

0 comments on commit 3b759bb

Please sign in to comment.