Skip to content

Commit

Permalink
v5.10.1
Browse files Browse the repository at this point in the history
  • Loading branch information
fractalwrench authored Jul 15, 2021
2 parents 83a05b1 + 7e0f05c commit cd4833c
Show file tree
Hide file tree
Showing 55 changed files with 700 additions and 515 deletions.
17 changes: 16 additions & 1 deletion .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ steps:
command: './gradlew test'

- label: ':android: Android 7 Instrumentation tests'
key: 'NDK-smoke-test'
key: 'core-instrumentation-tests'
depends_on:
- "android-ci"
timeout_in_minutes: 30
Expand All @@ -168,6 +168,21 @@ steps:
concurrency: 9
concurrency_group: 'browserstack-app'

- label: ':android: NDK Instrumentation tests'
key: 'ndk-instrumentation-tests'
depends_on:
- "android-ci"
timeout_in_minutes: 30
command: ./scripts/build-instrumentation-tests.sh && ./scripts/run-instrumentation-test.sh
plugins:
- docker-compose#v3.7.0:
run: android-ci
env:
INSTRUMENTATION_DEVICES: '["Google Pixel-7.1"]'
TEST_APK_LOCATION: 'bugsnag-plugin-android-ndk/build/outputs/apk/androidTest/debug/bugsnag-plugin-android-ndk-debug-androidTest.apk'
concurrency: 9
concurrency_group: 'browserstack-app'

- label: ':android: Performance benchmarks'
key: 'perf-benchmarks'
depends_on:
Expand Down
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Changelog

## 5.10.1 (2021-07-15)

### Bug fixes

* Prefer `calloc()` to `malloc()` in NDK code
[#1320](https://github.com/bugsnag/bugsnag-android/pull/1320)

* Ensure correct value always collected for activeScreen
[#1322](https://github.com/bugsnag/bugsnag-android/pull/1322)

## 5.10.0 (2021-07-14)

### Enhancements
Expand Down
2 changes: 1 addition & 1 deletion bugsnag-android-core/detekt-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<CurrentIssues>
<ID>ImplicitDefaultLocale:DeliveryHeaders.kt$String.format("%02x", byte)</ID>
<ID>LongParameterList:App.kt$App$( /** * The architecture of the running application binary */ var binaryArch: String?, /** * The package name of the application */ var id: String?, /** * The release stage set in [Configuration.releaseStage] */ var releaseStage: String?, /** * The version of the application set in [Configuration.version] */ var version: String?, /** The revision ID from the manifest (React Native apps only) */ var codeBundleId: String?, /** * The unique identifier for the build of the application set in [Configuration.buildUuid] */ var buildUuid: String?, /** * The application type set in [Configuration#version] */ var type: String?, /** * The version code of the application set in [Configuration.versionCode] */ var versionCode: Number? )</ID>
<ID>LongParameterList:AppDataCollector.kt$AppDataCollector$( appContext: Context, private val packageManager: PackageManager?, private val config: ImmutableConfig, private val sessionTracker: SessionTracker, private val activityManager: ActivityManager?, private val launchCrashTracker: LaunchCrashTracker, private val contextState: ContextState, private val logger: Logger )</ID>
<ID>LongParameterList:AppDataCollector.kt$AppDataCollector$( appContext: Context, private val packageManager: PackageManager?, private val config: ImmutableConfig, private val sessionTracker: SessionTracker, private val activityManager: ActivityManager?, private val launchCrashTracker: LaunchCrashTracker, private val logger: Logger )</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 */ 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$( config: ImmutableConfig, binaryArch: String?, id: String?, releaseStage: String?, version: String?, codeBundleId: String?, duration: Number?, durationInForeground: Number?, inForeground: Boolean?, isLaunching: Boolean? )</ID>
<ID>LongParameterList:Device.kt$Device$( buildInfo: DeviceBuildInfo, /** * The Application Binary Interface used */ var cpuAbi: Array&lt;String&gt;?, /** * 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 */ var runtimeVersions: MutableMap&lt;String, Any&gt;? )</ID>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,34 @@ class AppDataCollectorTest {
client.sessionTracker,
am,
client.launchCrashTracker,
client.contextState,
NoopLogger
)
val app = collector.getAppDataMetadata()
assertNull(app["backgroundWorkRestricted"])
assertEquals("com.bugsnag.android.core.test", app["processName"] as String)
}

@Test
fun testActiveScreenValue() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
`when`(am.isBackgroundRestricted).thenReturn(false)
}

val collector = AppDataCollector(
context,
context.packageManager,
client.immutableConfig,
client.sessionTracker,
am,
client.launchCrashTracker,
NoopLogger
)
client.context = "Some Custom Context"
client.sessionTracker.updateForegroundTracker("MyActivity", true, 0L)
val app = collector.getAppDataMetadata()
assertEquals("MyActivity", app["activeScreen"] as String)
}

/**
* The flag is set in the app metadata if the user has enabled background restrictions
*/
Expand All @@ -71,7 +91,6 @@ class AppDataCollectorTest {
client.sessionTracker,
am,
client.launchCrashTracker,
client.contextState,
NoopLogger
)
val app = collector.getAppDataMetadata()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ internal class AppDataCollector(
private val sessionTracker: SessionTracker,
private val activityManager: ActivityManager?,
private val launchCrashTracker: LaunchCrashTracker,
private val contextState: ContextState,
private val logger: Logger
) {
var codeBundleId: String? = null
Expand Down Expand Up @@ -51,7 +50,7 @@ internal class AppDataCollector(
fun getAppDataMetadata(): MutableMap<String, Any?> {
val map = HashMap<String, Any?>()
map["name"] = appName
map["activeScreen"] = contextState.getContext()
map["activeScreen"] = sessionTracker.contextActivity
map["memoryUsage"] = getMemoryUsage()
map["lowMemory"] = isLowMemory()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ public Unit invoke(Boolean hasConnection, String networkState) {

launchCrashTracker = new LaunchCrashTracker(immutableConfig);
appDataCollector = new AppDataCollector(appContext, appContext.getPackageManager(),
immutableConfig, sessionTracker, am, launchCrashTracker, contextState, logger);
immutableConfig, sessionTracker, am, launchCrashTracker, logger);

// load the device + user information
SharedPrefMigrator sharedPrefMigrator = new SharedPrefMigrator(appContext);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import java.io.IOException
*/
class Notifier @JvmOverloads constructor(
var name: String = "Android Bugsnag Notifier",
var version: String = "5.10.0",
var version: String = "5.10.1",
var url: String = "https://bugsnag.com"
) : JsonStream.Streamable {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ class AppDataCollectorForegroundTest {
sessionTracker,
null,
launchCrashTracker,
ContextState(),
NoopLogger
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ internal class AppDataCollectorSerializationTest {
sessionTracker,
am,
launchCrashTracker,
ContextState(),
NoopLogger
)
appData.codeBundleId = "foo-99"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ internal class AppMetadataSerializationTest {
`when`(context.packageName).thenReturn("com.example.foo")

// populate metadata fields
val contextState = ContextState()
contextState.setAutomaticContext("MyActivity")
`when`(sessionTracker.contextActivity).thenReturn("MyActivity")
`when`(pm.getApplicationLabel(any())).thenReturn("MyApp")
`when`(pm.getApplicationInfo(any(), anyInt())).thenReturn(ApplicationInfo())

Expand All @@ -52,7 +51,6 @@ internal class AppMetadataSerializationTest {
sessionTracker,
am,
launchCrashTracker,
contextState,
NoopLogger
)
appData.codeBundleId = "foo-99"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,31 +1,23 @@
package com.bugsnag.android.ndk

import org.junit.Assert.assertEquals
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.Parameterized

@RunWith(Parameterized::class)
internal class AppMetadataSerializationTest {

companion object {
init {
System.loadLibrary("bugsnag-ndk")
System.loadLibrary("bugsnag-ndk-test")
}

@JvmStatic
@Parameterized.Parameters
fun testCases() = 0..0
}

external fun run(testCase: Int, expectedJson: String): Int

@Parameterized.Parameter
lateinit var testCase: Number
external fun run(): String

@Test
fun testPassesNativeSuite() {
val expectedJson = loadJson("app_meta_data_serialization_$testCase.json")
verifyNativeRun(run(testCase.toInt(), expectedJson))
val expected = loadJson("app_meta_data_serialization.json")
val json = run()
assertEquals(expected, json)
}
}
Original file line number Diff line number Diff line change
@@ -1,31 +1,23 @@
package com.bugsnag.android.ndk

import org.junit.Assert.assertEquals
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.Parameterized

@RunWith(Parameterized::class)
internal class AppSerializationTest {

companion object {
init {
System.loadLibrary("bugsnag-ndk")
System.loadLibrary("bugsnag-ndk-test")
}

@JvmStatic
@Parameterized.Parameters
fun testCases() = 0..0
}

external fun run(testCase: Int, expectedJson: String): Int

@Parameterized.Parameter
lateinit var testCase: Number
external fun run(): String

@Test
fun testPassesNativeSuite() {
val expectedJson = loadJson("app_serialization_$testCase.json")
verifyNativeRun(run(testCase.toInt(), expectedJson))
val expected = loadJson("app_serialization.json")
val json = run()
assertEquals(expected, json)
}
}
Original file line number Diff line number Diff line change
@@ -1,31 +1,23 @@
package com.bugsnag.android.ndk

import org.junit.Assert.assertEquals
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.Parameterized

@RunWith(Parameterized::class)
internal class BreadcrumbStateSerializationTest {

companion object {
init {
System.loadLibrary("bugsnag-ndk")
System.loadLibrary("bugsnag-ndk-test")
}

@JvmStatic
@Parameterized.Parameters
fun testCases() = 0..0
}

external fun run(testCase: Int, expectedJson: String): Int

@Parameterized.Parameter
lateinit var testCase: Number
external fun run(): String

@Test
fun testPassesNativeSuite() {
val expectedJson = loadJson("breadcrumbs_serialization_$testCase.json")
verifyNativeRun(run(testCase.toInt(), expectedJson))
fun testBreadcrumbSerialization() {
val expected = loadJson("breadcrumbs_serialization.json")
val json = run()
assertEquals(expected, json)
}
}
Original file line number Diff line number Diff line change
@@ -1,31 +1,23 @@
package com.bugsnag.android.ndk

import org.junit.Assert.assertEquals
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.Parameterized

@RunWith(Parameterized::class)
internal class ContextSerializationTest {

companion object {
init {
System.loadLibrary("bugsnag-ndk")
System.loadLibrary("bugsnag-ndk-test")
}

@JvmStatic
@Parameterized.Parameters
fun testCases() = 0..0
}

external fun run(testCase: Int, expectedJson: String): Int

@Parameterized.Parameter
lateinit var testCase: Number
external fun run(): String

@Test
fun testPassesNativeSuite() {
val expectedJson = loadJson("context_serialization_$testCase.json")
verifyNativeRun(run(testCase.toInt(), expectedJson))
val expected = loadJson("context_serialization.json")
val json = run()
assertEquals(expected, json)
}
}
Original file line number Diff line number Diff line change
@@ -1,31 +1,23 @@
package com.bugsnag.android.ndk

import org.junit.Assert.assertEquals
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.Parameterized

@RunWith(Parameterized::class)
internal class CustomMetadataSerializationTest {

companion object {
init {
System.loadLibrary("bugsnag-ndk")
System.loadLibrary("bugsnag-ndk-test")
}

@JvmStatic
@Parameterized.Parameters
fun testCases() = 0..0
}

external fun run(testCase: Int, expectedJson: String): Int

@Parameterized.Parameter
lateinit var testCase: Number
external fun run(): String

@Test
fun testPassesNativeSuite() {
val expectedJson = loadJson("custom_meta_data_serialization_$testCase.json")
verifyNativeRun(run(testCase.toInt(), expectedJson))
val expected = loadJson("custom_meta_data_serialization.json")
val json = run()
assertEquals(expected, json)
}
}
Original file line number Diff line number Diff line change
@@ -1,31 +1,23 @@
package com.bugsnag.android.ndk

import org.junit.Assert.assertEquals
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.Parameterized

@RunWith(Parameterized::class)
internal class DeviceSerializationTest {

companion object {
init {
System.loadLibrary("bugsnag-ndk")
System.loadLibrary("bugsnag-ndk-test")
}

@JvmStatic
@Parameterized.Parameters
fun testCases() = 0..0
}

external fun run(testCase: Int, expectedJson: String): Int

@Parameterized.Parameter
lateinit var testCase: Number
external fun run(): String

@Test
fun testPassesNativeSuite() {
val expectedJson = loadJson("device_serialization_$testCase.json")
verifyNativeRun(run(testCase.toInt(), expectedJson))
val expected = loadJson("device_serialization.json")
val json = run()
assertEquals(expected, json)
}
}
Loading

0 comments on commit cd4833c

Please sign in to comment.