Skip to content

Commit 54aeef8

Browse files
author
Memfault Inc.
committed
Memfault BORT SDK 5.0.0 (Build 2450655)
1 parent c1af868 commit 54aeef8

File tree

92 files changed

+3044
-1343
lines changed

Some content is hidden

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

92 files changed

+3044
-1343
lines changed

CHANGELOG.md

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

3+
## v5.0.0 - September 12, 2024
4+
5+
### :boom: Breaking Changes
6+
7+
- Bort has been moved from the `system` partition to the `system-ext` partition.
8+
This enables the use of Generic System Images.
9+
- The AOSP patches to `product/mainline.mk`/`mainline_system.mk` (Android 11)
10+
and `product/generic_system.mk` (Android 12+) have been removed. These were
11+
required to whitelist Bort in the `system` partition. These were the only
12+
required AOSP patches if using Android 9+, meaning that all remaining AOSP
13+
patches are now optional, to enhance Bort functionality (except if using
14+
Android 8).
15+
- To support this change, we have forked the Bort SDK because of
16+
backwards-incompatible `bp` file changes required to support `system-ext`. We
17+
will continue to support Android 8-10 on the `8-10` branch, and the `master`
18+
branch will support android versions 11+. No other work is required other than
19+
making sure to check out the correct branch - the AOSP build will fail if
20+
using the wrong branch.
21+
- You will need to remove the aforementioned patch, if already applied and
22+
committed to your AOSP repo.
23+
24+
### :rocket: New Features
25+
26+
- Added the ability for Bort to upload any DropBoxManager tags, without the need
27+
to add specific processing for each in the SDK. This is configurable from the
28+
dashboard - by default we will start collecting `SYSTEM_AUDIT`, `SYSTEM_BOOT`,
29+
`SYSTEM_FSCK`, `SYSTEM_RECOVERY_LOG`, `SYSTEM_RESTART` entries, which can be
30+
viewed on the Device Timeline.
31+
32+
### :construction: Fixes
33+
34+
Bug fixes in the Bort SDK are now broken out into their own section in this
35+
changelog.
36+
37+
- Fixed a bug where Bort would drop reboot events after a factory reset, if
38+
`RUNTIME_ENABLE_REQUIRED=true` and Bort was not enabled at the time of boot.
39+
Bort will now upload the latest reboot when it is enabled, if not already
40+
processed.
41+
42+
### :chart_with_upwards_trend: Improvements
43+
44+
- Store the software version alongside a metric report, so that metrics will not
45+
be associated with the wrong software version in the case of an OTA update.
46+
- Also, collect metrics immediately after boot, if an OTA update was just
47+
installed - reducing the potential for metrics to be assigned to the wrong
48+
software version.
49+
50+
### :house: Internal
51+
52+
- Refactored HRT file generation.
53+
- Switched to using the Room gradle plugin.
54+
355
## v4.19.0 - August 13, 2024
456

557
### :rocket: New Features

MemfaultDumpstateRunner/Android.bp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,5 @@ cc_binary {
2828
"liblog",
2929
],
3030
init_rc: ["memfault_init.rc"],
31+
system_ext_specific: true,
3132
}

MemfaultDumpstateRunner/memfault_init.rc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ service memfault_dumpstatez /system/bin/dumpstate -S -d -z -q \
2323
# into Bort's filesystem sandboxed location. See MemfaultDumpstateRunner.cpp for
2424
# the source code of the program itself.
2525

26-
service memfault_dumpstate_runner /system/bin/MemfaultDumpstateRunner
26+
service memfault_dumpstate_runner /system_ext/bin/MemfaultDumpstateRunner
2727
class core
2828
disabled
2929
oneshot

MemfaultDumpster/Android.bp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,5 @@ cc_library_shared {
1313
"com/memfault/dumpster/IDumpsterBasicCommandListener.aidl",
1414
"com/memfault/dumpster/IDumpster.aidl",
1515
],
16+
system_ext_specific: true,
1617
}

MemfaultDumpster/Android.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,5 @@ LOCAL_SHARED_LIBRARIES := \
2727
LOCAL_PROTOC_OPTIMIZE_TYPE := full
2828
LOCAL_STATIC_LIBRARIES := liblog
2929
LOCAL_INIT_RC := memfault_dumpster.rc
30+
LOCAL_SYSTEM_EXT_MODULE := true
3031
include $(BUILD_EXECUTABLE)

MemfaultDumpster/memfault_dumpster.rc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ on post-fs-data
66
mkdir /data/system/MemfaultDumpster/ 0700 root root
77
wait /data/system/MemfaultDumpster/
88

9-
service memfault_dumpster /system/bin/MemfaultDumpster
9+
service memfault_dumpster /system_ext/bin/MemfaultDumpster
1010
class core

MemfaultPackages/Android.mk

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@ LOCAL_PATH := $(call my-dir)
22

33
include $(LOCAL_PATH)/bort_src_gen.mk
44

5+
ifeq ($(shell test $(PLATFORM_SDK_VERSION) -ge 30 && echo true),true)
6+
_BORT_ETC_PATH := $(TARGET_OUT_SYSTEM_EXT_ETC)
7+
else
8+
_BORT_ETC_PATH := $(TARGET_OUT_ETC)
9+
endif
10+
511

612
# Check that ensures MemfaultBort.x509.pem matches signature of MemfaultBort.apk
713
################################################################################
@@ -31,7 +37,7 @@ include $(CLEAR_VARS)
3137

3238
LOCAL_MODULE := com.memfault.bort.xml
3339
LOCAL_MODULE_CLASS := ETC
34-
LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)/permissions
40+
LOCAL_MODULE_PATH := $(_BORT_ETC_PATH)/permissions
3541
BORT_XML_TARGET := $(LOCAL_MODULE_PATH)/$(LOCAL_MODULE)
3642
$(call bort_src_gen,$(LOCAL_PATH)/com.memfault.bort.xml.in,$(BORT_XML_TARGET))
3743
LOCAL_ADDITIONAL_DEPENDENCIES := $(BORT_XML_TARGET)
@@ -57,6 +63,7 @@ LOCAL_REQUIRED_MODULES := com.memfault.bort.xml CheckMemfaultBortSignature
5763

5864
# The priv-app folder
5965
TARGET_OUT_DATA_APPS_PRIVILEGED := $(TARGET_OUT_DATA)/priv-app
66+
LOCAL_SYSTEM_EXT_MODULE := true
6067
include $(BUILD_PREBUILT)
6168

6269
# MemfaultBortOta.apk
@@ -66,7 +73,7 @@ include $(CLEAR_VARS)
6673

6774
LOCAL_MODULE := com.memfault.bort.ota.xml
6875
LOCAL_MODULE_CLASS := ETC
69-
LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)/permissions
76+
LOCAL_MODULE_PATH := $(_BORT_ETC_PATH)/permissions
7077
BORT_XML_TARGET := $(LOCAL_MODULE_PATH)/$(LOCAL_MODULE)
7178
$(call bort_src_gen,$(LOCAL_PATH)/com.memfault.bort.ota.xml.in,$(BORT_XML_TARGET))
7279
LOCAL_ADDITIONAL_DEPENDENCIES := $(BORT_XML_TARGET)
@@ -92,6 +99,7 @@ LOCAL_REQUIRED_MODULES := com.memfault.bort.ota.xml CheckMemfaultBortOtaSignatur
9299

93100
# The priv-app folder
94101
TARGET_OUT_DATA_APPS_PRIVILEGED := $(TARGET_OUT_DATA)/priv-app
102+
LOCAL_SYSTEM_EXT_MODULE := true
95103
include $(BUILD_PREBUILT)
96104

97105

@@ -101,7 +109,7 @@ include $(BUILD_PREBUILT)
101109
include $(CLEAR_VARS)
102110
LOCAL_MODULE := com.memfault.usagereporter.xml
103111
LOCAL_MODULE_CLASS := ETC
104-
LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)/permissions
112+
LOCAL_MODULE_PATH := $(_BORT_ETC_PATH)/permissions
105113
USAGE_REPORTER_XML_TARGET := $(LOCAL_MODULE_PATH)/$(LOCAL_MODULE)
106114
$(call bort_src_gen,$(LOCAL_PATH)/com.memfault.usagereporter.xml.in,$(USAGE_REPORTER_XML_TARGET))
107115
LOCAL_ADDITIONAL_DEPENDENCIES := $(USAGE_REPORTER_XML_TARGET)
@@ -126,6 +134,7 @@ LOCAL_REQUIRED_MODULES := com.memfault.usagereporter.xml
126134

127135
# The priv-app folder
128136
TARGET_OUT_DATA_APPS_PRIVILEGED := $(TARGET_OUT_DATA)/priv-app
137+
LOCAL_SYSTEM_EXT_MODULE := true
129138
include $(BUILD_PREBUILT)
130139

131140
include $(LOCAL_PATH)/reporting-libs/reporting-lib-java/Android.mk

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,19 @@ import kotlinx.serialization.Serializable
55
import org.kocakosm.jblake2.Blake2b
66
import java.lang.StringBuilder
77

8+
fun interface LineScrubbingCleaners {
9+
operator fun invoke(): List<LineScrubbingCleaner>
10+
}
11+
812
interface LineScrubbingCleaner {
913
fun clean(line: String): String
1014
}
1115

1216
class DataScrubber(
13-
private val cleaners: List<LineScrubbingCleaner> = listOf(),
17+
private val cleaners: LineScrubbingCleaners,
1418
private val hash: (line: String) -> String = ::blake2b,
1519
) {
16-
operator fun invoke(line: String): String = cleaners.fold(line) { data, matcher ->
20+
operator fun invoke(line: String): String = cleaners().fold(line) { data, matcher ->
1721
matcher.clean(data)
1822
}
1923

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,11 @@ data class DeviceInfo(
3535
"${getBuildFingerprint()}::${props[settings.androidBuildVersionKey] ?: "unknown"}"
3636
}
3737
return DeviceInfo(
38-
settings.overriddenSerialNumber ?: props[settings.androidSerialNumberKey] ?: getFallbackAndroidId(),
39-
hardwareVersionFromSettingsAndSystemProperties(settings, props),
40-
softwareVersion,
38+
deviceSerial = settings.overriddenSerialNumber
39+
?: props[settings.androidSerialNumberKey]
40+
?: getFallbackAndroidId(),
41+
hardwareVersion = hardwareVersionFromSettingsAndSystemProperties(settings, props),
42+
softwareVersion = softwareVersion,
4143
)
4244
}
4345

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

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,19 @@ class RealDeviceInfoProvider @Inject constructor(
2424
) : DeviceInfoProvider {
2525
private val deviceInfo = CachedAsyncProperty {
2626
DeviceInfo.fromSettingsAndSystemProperties(
27-
lastSettings,
28-
dumpsterClient.getprop() ?: emptyMap(),
29-
application,
27+
settings = lastSettings,
28+
props = dumpsterClient.getprop() ?: emptyMap(),
29+
context = application,
3030
)
3131
}
3232
private var lastSettings = deviceInfoSettings.asParams(overrideSerial)
3333
private val mutex = Mutex()
3434

3535
override suspend fun getDeviceInfo(): DeviceInfo = mutex.withLock {
36-
if (lastSettings != deviceInfoSettings.asParams(overrideSerial)) {
36+
val newSettings = deviceInfoSettings.asParams(overrideSerial)
37+
if (lastSettings != newSettings) {
3738
Logger.d("Invalidating deviceInfo")
38-
lastSettings = deviceInfoSettings.asParams(overrideSerial)
39+
lastSettings = newSettings
3940
deviceInfo.invalidate()
4041
}
4142
deviceInfo.get()

0 commit comments

Comments
 (0)