Skip to content

Commit 3f39669

Browse files
author
Memfault Inc.
committed
Memfault BORT SDK 4.17.0 (Build 2186875)
1 parent 04f58a6 commit 3f39669

File tree

146 files changed

+4017
-6260
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

146 files changed

+4017
-6260
lines changed

CHANGELOG.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,39 @@
11
# Memfault Bort Changelog
22

3+
## v4.17.0 - June 24, 2024
4+
5+
### :rocket: New Features
6+
7+
- Support for the new [Session](https://mflt.io/android-sessions) metrics. This
8+
enables Memfault to be used for more product-specific use cases by associating
9+
metrics to product functionality.
10+
- The latest reporting-lib on each platform have been updated to start, end,
11+
and record metrics to sessions (reporting-lib 1.5 has been published to
12+
Maven with Sessions support).
13+
- Every session will automatically include relevant `sync_successful`,
14+
`sync_failure`, `memfault_sync_successful`, `memfault_sync_failure`,
15+
`connectivity_expected_time_ms` and `connectivity_connected_time_ms` Device
16+
Vitals metrics. `operational_crashes` will also be automatically recorded,
17+
even if the value is 0.
18+
- Support for new Daily Heartbeats has been added. This enables support for
19+
daily metric aggregations to supplement or replace Hourly Heartbeats for lower
20+
upload frequency use cases. Please contact us for more information.
21+
- Daily Heartbeats will contain every metric that Hourly Heartbeats do,
22+
besides batterystats at the moment.
23+
24+
### :chart_with_upwards_trend: Improvements
25+
26+
- The `structuredlogd` metrics database has been replaced by a Room database
27+
inside the Bort app. This move allows us to more quickly iterate on
28+
improvements to how metrics are persisted. The `structuredlogd` service now
29+
forwards all calls to the Bort app for backwards compatibility.
30+
- Bort Lite's serial can be overridden using by sending an
31+
`INTENT_ACTION_OVERRIDE_SERIAL` intent with an `INTENT_EXTRA_SERIAL` string
32+
extra.
33+
- DropBox is now queried when Bort starts in Dev Mode.
34+
- A bug was fixed where Device information would be incorrectly cached until
35+
Bort restarted.
36+
337
## v4.16.0 - May 28, 2024
438

539
### :rocket: New Features

MemfaultPackages/bort-ota-lib/src/main/java/com/memfault/bort/FallbackOtaSettings.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ class FallbackOtaSettings @Inject constructor(
3232
deviceInfoSettings = bundledSdkSettings.deviceInfoSettings(),
3333
dumpsterClient = dumpsterClient,
3434
application = application,
35+
overrideSerial = NoOpOverrideSerial,
3536
)
3637
}
3738
private val deviceInfo by lazy { runBlocking { deviceInfoProvider.getDeviceInfo() } }

MemfaultPackages/bort-shared/src/main/java/com/memfault/bort/DeviceInfo.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ data class DeviceInfoParams(
1212
val androidBuildVersionKey: String,
1313
val androidHardwareVersionKey: String,
1414
val androidSerialNumberKey: String,
15+
val overriddenSerialNumber: String?,
1516
)
1617

1718
data class DeviceInfo(
@@ -34,7 +35,7 @@ data class DeviceInfo(
3435
"${getBuildFingerprint()}::${props[settings.androidBuildVersionKey] ?: "unknown"}"
3536
}
3637
return DeviceInfo(
37-
props[settings.androidSerialNumberKey] ?: getFallbackAndroidId(),
38+
settings.overriddenSerialNumber ?: props[settings.androidSerialNumberKey] ?: getFallbackAndroidId(),
3839
hardwareVersionFromSettingsAndSystemProperties(settings, props),
3940
softwareVersion,
4041
)

MemfaultPackages/bort-shared/src/main/java/com/memfault/bort/DeviceInfoProvider.kt

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ class RealDeviceInfoProvider @Inject constructor(
2020
private val deviceInfoSettings: DeviceInfoSettings,
2121
private val dumpsterClient: DumpsterClient,
2222
private val application: Application,
23+
private val overrideSerial: OverrideSerial,
2324
) : DeviceInfoProvider {
2425
private val deviceInfo = CachedAsyncProperty {
2526
DeviceInfo.fromSettingsAndSystemProperties(
@@ -28,22 +29,23 @@ class RealDeviceInfoProvider @Inject constructor(
2829
application,
2930
)
3031
}
31-
private var lastSettings = deviceInfoSettings.asParams()
32+
private var lastSettings = deviceInfoSettings.asParams(overrideSerial)
3233
private val mutex = Mutex()
3334

3435
override suspend fun getDeviceInfo(): DeviceInfo = mutex.withLock {
35-
if (lastSettings != deviceInfoSettings.asParams()) {
36+
if (lastSettings != deviceInfoSettings.asParams(overrideSerial)) {
3637
Logger.d("Invalidating deviceInfo")
37-
lastSettings = deviceInfoSettings.asParams()
38+
lastSettings = deviceInfoSettings.asParams(overrideSerial)
3839
deviceInfo.invalidate()
3940
}
4041
deviceInfo.get()
4142
}
4243
}
4344

44-
private fun DeviceInfoSettings.asParams() = DeviceInfoParams(
45+
private fun DeviceInfoSettings.asParams(overrideSerial: OverrideSerial) = DeviceInfoParams(
4546
androidBuildFormat = androidBuildFormat,
4647
androidBuildVersionKey = androidBuildVersionKey,
4748
androidHardwareVersionKey = androidHardwareVersionKey,
4849
androidSerialNumberKey = androidSerialNumberKey,
50+
overriddenSerialNumber = overrideSerial.overriddenSerial,
4951
)
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package com.memfault.bort
2+
3+
/**
4+
* Locally overridden serial number.
5+
*
6+
* This should only ever be used for Bort Lite (it does not affect bort-ota's fallback serial mechanism, so is not
7+
* safe to use there).
8+
*/
9+
interface OverrideSerial {
10+
var overriddenSerial: String?
11+
}
12+
13+
val NoOpOverrideSerial = object : OverrideSerial {
14+
override var overriddenSerial: String?
15+
get() = null
16+
set(_) = Unit
17+
}

MemfaultPackages/bort-shared/src/main/java/com/memfault/bort/connectivity/ConnectivityMetrics.kt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ import kotlinx.coroutines.launch
4040
import javax.inject.Inject
4141
import javax.inject.Singleton
4242

43+
const val CONNECTIVITY_TYPE_METRIC = "connectivity.type"
44+
4345
// Don't automatically include this in all apps using @ContributesMultibinding (it'll be included in OTA,
4446
// and Bort has to conditionally enable it only if UsageReporter is not installed).
4547
@Singleton
@@ -51,7 +53,7 @@ class ConnectivityMetrics
5153
) : Scoped {
5254
private val connectivityMetric = Reporting.report()
5355
.stateTracker<ConnectivityState>(
54-
name = "connectivity.type",
56+
name = CONNECTIVITY_TYPE_METRIC,
5557
aggregations = listOf(TIME_PER_HOUR, TIME_TOTALS),
5658
)
5759
private val airplaneModeMetric = Reporting.report().boolStateTracker(name = "airplane_mode")
@@ -190,7 +192,7 @@ class ConnectivityMetrics
190192
}
191193
}
192194

193-
private enum class ConnectivityState {
195+
enum class ConnectivityState {
194196
WIFI,
195197
CELLULAR,
196198
ETHERNET,
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package com.memfault.bort.json
2+
3+
import android.util.JsonWriter
4+
import java.io.File
5+
6+
inline fun File?.useJsonWriter(block: (JsonWriter?) -> Unit) {
7+
if (this == null) {
8+
block(null)
9+
} else {
10+
bufferedWriter().use { bufferedWriter ->
11+
JsonWriter(bufferedWriter).use { jsonWriter ->
12+
block(jsonWriter)
13+
}
14+
}
15+
}
16+
}

MemfaultPackages/bort-shared/src/main/java/com/memfault/bort/settings/FetchedSettings.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,9 @@ data class FetchedSettings(
384384
@SerialName("metric_report.high_res_telemetry")
385385
val highResTelemetryEnabled: Boolean = true,
386386

387+
@SerialName("metric_report.daily_heartbeat")
388+
val dailyHeartbeatEnabled: Boolean = false,
389+
387390
@SerialName("storage.apps_size_data_source_enabled")
388391
val storageAppsSizeDataSourceEnabled: Boolean = true,
389392

MemfaultPackages/bort-shared/src/main/java/com/memfault/bort/shared/Constants.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ const val INTENT_EXTRA_BUG_REPORT_REQUEST_STATUS = "com.memfault.intent.extra.BU
1313

1414
const val DROPBOX_ENTRY_ADDED_RECEIVER_QUALIFIED_NAME = "com.memfault.bort.receivers.DropBoxEntryAddedReceiver"
1515

16+
const val APPLICATION_ID_MEMFAULT_STRUCTUREDLOGD = "com.memfault.structuredlogd"
17+
1618
const val APPLICATION_ID_MEMFAULT_USAGE_REPORTER = "com.memfault.usagereporter"
1719
const val REPORTER_SERVICE_QUALIFIED_NAME = "$APPLICATION_ID_MEMFAULT_USAGE_REPORTER.ReporterService"
1820

MemfaultPackages/bort/build.gradle

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,8 @@ android {
2929
versionName loadVersionName() as String
3030

3131
buildConfigField "Boolean", "RUNTIME_ENABLE_REQUIRED", bortProperty("RUNTIME_ENABLE_REQUIRED")
32-
// This field isn't in the public bort.properties, so default to false. This will be removed
33-
// in the future when the native service database is removed.
34-
// This flag allows Bort Lite to use the internal metrics DB.
35-
buildConfigField "Boolean", "INTERNAL_METRICS_DB", bortProperty("INTERNAL_METRICS_DB") ?: "false"
32+
// This field isn't in the public bort.properties, so default to false.
33+
buildConfigField "Boolean", "BORT_LITE", bortProperty("BORT_LITE") ?: "false"
3634

3735
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
3836

0 commit comments

Comments
 (0)