AOSP patches
Why Patch AOSP?
The Android SDK includes AOSP patches for a few reasons:
- To enable the SDK to function (depending on AOSP version and the Android SDK version - see below).
- To enable or enhance specific pieces of Android SDK functionality.
Do I have to patch AOSP to use the Android SDK?
On Android 8, an AOSP patch is always required. On Android 11+, an AOSP patch was required until SDK version 5.0. See below for details of those patches.
If patches are not required, then the remaining patches can be optionally applied (noting the functionality that will be lost if they are not applied). We will work in the future to reduce the number of patches, replacing the lost functionality by other means where possible.
This should enable e.g. using a Generic System Image (GSI) on recent Android versions, if desired.
Applying patches
See the Integration Guide.
Patch details
Required Patches
Patch | Android Versions | Required | Notes |
---|---|---|---|
build/core/tasks | Android 8 | Yes | Allowlists Memfault components in the Android 8 build. |
system/sepolicy | Android 8 | Yes | Applies Memfault's sepolicy modifications on Android 8. |
system/core/liblog | Android 8-10 | Yes (if using Continuous Logging mode) | Fixes a bug which causes Continuous Logging mode to fail on Android versions 8-10. |
build/make/target/product | Android 11-14 | Yes (When using Android SDK < 5.0) | Required to allowlist the SDK in the /system partition on Android version 11 and above. Removed in 5.0, where the Android SDK is moved to /system-ext . |
Optional Patches
Patch | Android Versions | Required | Notes |
---|---|---|---|
system/core/debuggerd | Android 8-9 | No | Adds a timestamp to tombstones on Android 8-9. We recommend applying this patch on those versions, for more accurate timestamping of native crashes. |
art/runtime | Android 10+ | No | Adds the GNU build ID to native stacktraces output by the OS (including tombstone, ANR DropBoxManager entries). We recommend applying this patch, to enable Memfault to symbolicate native stacktraces. We are investigating whether this patch can be removed in the future, while retaining the ability to symbolicate native stacktraces. |
frameworks/base/core | All Versions | No | Configures batterystats to always collect data even when not discharging. Without this patch, devices with no battery, or with a battery but not in a discharging state, will not collect batterystats metrics (including e.g. GPS, Screen, Wifi, Phone, etc metrics). We recommend applying this patch to collect more comprehensive metrics. |
frameworks/native/cmds/dumpstate | All Versions | No | Adds a "minimal mode" dumpstate (i.e. minimal bugreport) capability, which collects a small subset of data when the Android SDK collects a bugreport. This is not currently in-use by any user - we may remove it in a future SDK version. |
build/make/target/product | Android 9-13 | No | Sets the vendor.memfault.bort.version.patch sysprop, to track whether the AOSP patches were applied on a build or not. |