Merge "libsnapshot: OTA upgrade when vendor partition is S"
This commit is contained in:
commit
a3ab0a41f2
3 changed files with 27 additions and 6 deletions
|
|
@ -3205,15 +3205,27 @@ Return SnapshotManager::CreateUpdateSnapshots(const DeltaArchiveManifest& manife
|
||||||
status.set_compression_enabled(cow_creator.compression_enabled);
|
status.set_compression_enabled(cow_creator.compression_enabled);
|
||||||
if (cow_creator.compression_enabled) {
|
if (cow_creator.compression_enabled) {
|
||||||
if (!device()->IsTestDevice()) {
|
if (!device()->IsTestDevice()) {
|
||||||
|
bool userSnapshotsEnabled = IsUserspaceSnapshotsEnabled();
|
||||||
|
const std::string UNKNOWN = "unknown";
|
||||||
|
const std::string vendor_release = android::base::GetProperty(
|
||||||
|
"ro.vendor.build.version.release_or_codename", UNKNOWN);
|
||||||
|
|
||||||
|
// No user-space snapshots if vendor partition is on Android 12
|
||||||
|
if (vendor_release.find("12") != std::string::npos) {
|
||||||
|
LOG(INFO) << "Userspace snapshots disabled as vendor partition is on Android: "
|
||||||
|
<< vendor_release;
|
||||||
|
userSnapshotsEnabled = false;
|
||||||
|
}
|
||||||
|
|
||||||
// Userspace snapshots is enabled only if compression is enabled
|
// Userspace snapshots is enabled only if compression is enabled
|
||||||
status.set_userspace_snapshots(IsUserspaceSnapshotsEnabled());
|
status.set_userspace_snapshots(userSnapshotsEnabled);
|
||||||
if (IsUserspaceSnapshotsEnabled()) {
|
if (userSnapshotsEnabled) {
|
||||||
is_snapshot_userspace_ = true;
|
is_snapshot_userspace_ = true;
|
||||||
status.set_io_uring_enabled(IsIouringEnabled());
|
status.set_io_uring_enabled(IsIouringEnabled());
|
||||||
LOG(INFO) << "User-space snapshots enabled";
|
LOG(INFO) << "Userspace snapshots enabled";
|
||||||
} else {
|
} else {
|
||||||
is_snapshot_userspace_ = false;
|
is_snapshot_userspace_ = false;
|
||||||
LOG(INFO) << "User-space snapshots disabled";
|
LOG(INFO) << "Userspace snapshots disabled";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Terminate stale daemon if any
|
// Terminate stale daemon if any
|
||||||
|
|
|
||||||
|
|
@ -932,7 +932,6 @@ void CowSnapuserdMetadataTest::ValidatePartialFilledArea() {
|
||||||
|
|
||||||
ASSERT_EQ(area_sz, 2);
|
ASSERT_EQ(area_sz, 2);
|
||||||
|
|
||||||
size_t new_chunk = 263;
|
|
||||||
// Verify the partially filled area
|
// Verify the partially filled area
|
||||||
void* buffer = snapuserd_->GetExceptionBuffer(1);
|
void* buffer = snapuserd_->GetExceptionBuffer(1);
|
||||||
loff_t offset = 0;
|
loff_t offset = 0;
|
||||||
|
|
@ -941,7 +940,6 @@ void CowSnapuserdMetadataTest::ValidatePartialFilledArea() {
|
||||||
de = reinterpret_cast<struct disk_exception*>((char*)buffer + offset);
|
de = reinterpret_cast<struct disk_exception*>((char*)buffer + offset);
|
||||||
ASSERT_EQ(de->old_chunk, i);
|
ASSERT_EQ(de->old_chunk, i);
|
||||||
offset += sizeof(struct disk_exception);
|
offset += sizeof(struct disk_exception);
|
||||||
new_chunk += 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
de = reinterpret_cast<struct disk_exception*>((char*)buffer + offset);
|
de = reinterpret_cast<struct disk_exception*>((char*)buffer + offset);
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,17 @@ namespace android {
|
||||||
namespace snapshot {
|
namespace snapshot {
|
||||||
|
|
||||||
bool Daemon::IsUserspaceSnapshotsEnabled() {
|
bool Daemon::IsUserspaceSnapshotsEnabled() {
|
||||||
|
const std::string UNKNOWN = "unknown";
|
||||||
|
const std::string vendor_release =
|
||||||
|
android::base::GetProperty("ro.vendor.build.version.release_or_codename", UNKNOWN);
|
||||||
|
|
||||||
|
// No user-space snapshots if vendor partition is on Android 12
|
||||||
|
if (vendor_release.find("12") != std::string::npos) {
|
||||||
|
LOG(INFO) << "Userspace snapshots disabled as vendor partition is on Android: "
|
||||||
|
<< vendor_release;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return android::base::GetBoolProperty("ro.virtual_ab.userspace.snapshots.enabled", false);
|
return android::base::GetBoolProperty("ro.virtual_ab.userspace.snapshots.enabled", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue