Snap for 13226929 from 9a7d777c1304b50690449d17fbed8ba0d06bdb49 to 25Q2-release
Change-Id: I3ae4c1fa5e8530a202ca26208e7ee7005a5d62f7
diff --git a/fs_mgr/README.overlayfs.md b/fs_mgr/README.overlayfs.md
index 94b2f8c..df5d775 100644
--- a/fs_mgr/README.overlayfs.md
+++ b/fs_mgr/README.overlayfs.md
@@ -79,16 +79,15 @@
done file by file. Be mindful of wasted space. For example, defining
**BOARD_IMAGE_PARTITION_RESERVED_SIZE** has a negative impact on the
right-sizing of images and requires more free dynamic partition space.
-- The kernel requires **CONFIG_OVERLAY_FS=y**. If the kernel version is higher
- than 4.4, it requires source to be in line with android-common kernels.
- The patch series is available on the upstream mailing list and the latest as
- of Sep 5 2019 is https://www.spinics.net/lists/linux-mtd/msg08331.html
- This patch adds an override_creds _mount_ option to OverlayFS that
- permits legacy behavior for systems that do not have overlapping
- sepolicy rules, principals of least privilege, which is how Android behaves.
- For 4.19 and higher a rework of the xattr handling to deal with recursion
- is required. https://patchwork.kernel.org/patch/11117145/ is a start of that
- adjustment.
+- The kernel requires **CONFIG_OVERLAY_FS=y**. overlayfs is used 'as is' as of
+ android 16, no modifications are required.
+- In order for overlayfs to work, overlays are mounted in the overlay_remounter
+ domain, defined here: system/sepolicy/private/overlay_remounter.te. This domain
+ must have full access to the files on the underlying volumes, add any other file
+ and directory types here
+- For devices with dynamic partitions, we use a simpler logic to decide which
+ partitions to remount, being all logical ones. In case this isn't correct,
+ we added the overlay=on and overlay=off mount flags to allow detailed control.
- _adb enable-verity_ frees up OverlayFS and reverts the device to the state
prior to content updates. The update engine performs a full OTA.
- _adb remount_ overrides are incompatible with OTA resources, so the update
diff --git a/fs_mgr/fs_mgr_overlayfs_mount.cpp b/fs_mgr/fs_mgr_overlayfs_mount.cpp
index 69d3161..762e70d 100644
--- a/fs_mgr/fs_mgr_overlayfs_mount.cpp
+++ b/fs_mgr/fs_mgr_overlayfs_mount.cpp
@@ -49,6 +49,10 @@
#include "fs_mgr_overlayfs_mount.h"
#include "fs_mgr_priv.h"
+// Flag to simplify algorithm for choosing which partitions to overlay to simply overlay
+// all dynamic partitions
+constexpr bool overlay_dynamic_partitions_only = true;
+
using namespace std::literals;
using namespace android::fs_mgr;
using namespace android::storage_literals;
@@ -669,6 +673,19 @@
Fstab candidates;
for (const auto& entry : fstab) {
+ // fstab overlay flag overrides all other behavior
+ if (entry.fs_mgr_flags.overlay_off) continue;
+ if (entry.fs_mgr_flags.overlay_on) {
+ candidates.push_back(entry);
+ continue;
+ }
+
+ // overlay_dynamic_partitions_only simplifies logic to overlay exactly dynamic partitions
+ if (overlay_dynamic_partitions_only) {
+ if (entry.fs_mgr_flags.logical) candidates.push_back(entry);
+ continue;
+ }
+
// Filter out partitions whose type doesn't match what's mounted.
// This avoids spammy behavior on devices which can mount different
// filesystems for each partition.
diff --git a/fs_mgr/libfstab/fstab.cpp b/fs_mgr/libfstab/fstab.cpp
index 010fbc8..ec23ce5 100644
--- a/fs_mgr/libfstab/fstab.cpp
+++ b/fs_mgr/libfstab/fstab.cpp
@@ -209,6 +209,8 @@
CheckFlag("metadata_csum", ext_meta_csum);
CheckFlag("fscompress", fs_compress);
CheckFlag("overlayfs_remove_missing_lowerdir", overlayfs_remove_missing_lowerdir);
+ CheckFlag("overlay=on", overlay_on);
+ CheckFlag("overlay=off", overlay_off);
#undef CheckFlag
diff --git a/fs_mgr/libfstab/include/fstab/fstab.h b/fs_mgr/libfstab/include/fstab/fstab.h
index 0ff3188..4924ae3 100644
--- a/fs_mgr/libfstab/include/fstab/fstab.h
+++ b/fs_mgr/libfstab/include/fstab/fstab.h
@@ -87,6 +87,8 @@
bool fs_compress : 1;
bool overlayfs_remove_missing_lowerdir : 1;
bool is_zoned : 1;
+ bool overlay_on : 1;
+ bool overlay_off : 1;
} fs_mgr_flags = {};
bool is_encryptable() const { return fs_mgr_flags.crypt; }
diff --git a/healthd/BatteryMonitor.cpp b/healthd/BatteryMonitor.cpp
index b0a14bb..0e75033 100644
--- a/healthd/BatteryMonitor.cpp
+++ b/healthd/BatteryMonitor.cpp
@@ -715,49 +715,54 @@
char vs[128];
const HealthInfo& props = *mHealthInfo;
+ snprintf(vs, sizeof(vs), "Cached HealthInfo:\n");
+ write(fd, vs, strlen(vs));
snprintf(vs, sizeof(vs),
- "ac: %d usb: %d wireless: %d dock: %d current_max: %d voltage_max: %d\n",
+ " ac: %d usb: %d wireless: %d dock: %d current_max: %d voltage_max: %d\n",
props.chargerAcOnline, props.chargerUsbOnline, props.chargerWirelessOnline,
props.chargerDockOnline, props.maxChargingCurrentMicroamps,
props.maxChargingVoltageMicrovolts);
write(fd, vs, strlen(vs));
- snprintf(vs, sizeof(vs), "status: %d health: %d present: %d\n",
+ snprintf(vs, sizeof(vs), " status: %d health: %d present: %d\n",
props.batteryStatus, props.batteryHealth, props.batteryPresent);
write(fd, vs, strlen(vs));
- snprintf(vs, sizeof(vs), "level: %d voltage: %d temp: %d\n", props.batteryLevel,
+ snprintf(vs, sizeof(vs), " level: %d voltage: %d temp: %d\n", props.batteryLevel,
props.batteryVoltageMillivolts, props.batteryTemperatureTenthsCelsius);
write(fd, vs, strlen(vs));
if (!mHealthdConfig->batteryCurrentNowPath.empty()) {
+ snprintf(vs, sizeof(vs), " current now: %d\n", props.batteryCurrentMicroamps);
+ write(fd, vs, strlen(vs));
+ }
+
+ if (!mHealthdConfig->batteryCycleCountPath.empty()) {
+ snprintf(vs, sizeof(vs), " cycle count: %d\n", props.batteryCycleCount);
+ write(fd, vs, strlen(vs));
+ }
+
+ if (!mHealthdConfig->batteryFullChargePath.empty()) {
+ snprintf(vs, sizeof(vs), " Full charge: %d\n", props.batteryFullChargeUah);
+ write(fd, vs, strlen(vs));
+ }
+
+ snprintf(vs, sizeof(vs), "Real-time Values:\n");
+ write(fd, vs, strlen(vs));
+
+ if (!mHealthdConfig->batteryCurrentNowPath.empty()) {
v = getIntField(mHealthdConfig->batteryCurrentNowPath);
- snprintf(vs, sizeof(vs), "current now: %d\n", v);
+ snprintf(vs, sizeof(vs), " current now: %d\n", v);
write(fd, vs, strlen(vs));
}
if (!mHealthdConfig->batteryCurrentAvgPath.empty()) {
v = getIntField(mHealthdConfig->batteryCurrentAvgPath);
- snprintf(vs, sizeof(vs), "current avg: %d\n", v);
+ snprintf(vs, sizeof(vs), " current avg: %d\n", v);
write(fd, vs, strlen(vs));
}
if (!mHealthdConfig->batteryChargeCounterPath.empty()) {
v = getIntField(mHealthdConfig->batteryChargeCounterPath);
- snprintf(vs, sizeof(vs), "charge counter: %d\n", v);
- write(fd, vs, strlen(vs));
- }
-
- if (!mHealthdConfig->batteryCurrentNowPath.empty()) {
- snprintf(vs, sizeof(vs), "current now: %d\n", props.batteryCurrentMicroamps);
- write(fd, vs, strlen(vs));
- }
-
- if (!mHealthdConfig->batteryCycleCountPath.empty()) {
- snprintf(vs, sizeof(vs), "cycle count: %d\n", props.batteryCycleCount);
- write(fd, vs, strlen(vs));
- }
-
- if (!mHealthdConfig->batteryFullChargePath.empty()) {
- snprintf(vs, sizeof(vs), "Full charge: %d\n", props.batteryFullChargeUah);
+ snprintf(vs, sizeof(vs), " charge counter: %d\n", v);
write(fd, vs, strlen(vs));
}
}