Loading fs_mgr/libsnapshot/snapshot.cpp +15 −2 Original line number Original line Diff line number Diff line Loading @@ -3273,8 +3273,21 @@ Return SnapshotManager::CreateUpdateSnapshots(const DeltaArchiveManifest& manife snapuserd_client_ = nullptr; snapuserd_client_ = nullptr; } } } else { } else { status.set_userspace_snapshots(!IsDmSnapshotTestingEnabled()); bool userSnapshotsEnabled = true; if (IsDmSnapshotTestingEnabled()) { 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; } userSnapshotsEnabled = (userSnapshotsEnabled && !IsDmSnapshotTestingEnabled()); status.set_userspace_snapshots(userSnapshotsEnabled); if (!userSnapshotsEnabled) { is_snapshot_userspace_ = false; is_snapshot_userspace_ = false; LOG(INFO) << "User-space snapshots disabled for testing"; LOG(INFO) << "User-space snapshots disabled for testing"; } else { } else { Loading fs_mgr/libsnapshot/snapshot_test.cpp +18 −5 Original line number Original line Diff line number Diff line Loading @@ -91,7 +91,7 @@ std::string fake_super; void MountMetadata(); void MountMetadata(); bool ShouldUseCompression(); bool ShouldUseCompression(); bool ShouldUseUserspaceSnapshots(); bool IsDaemonRequired(); class SnapshotTest : public ::testing::Test { class SnapshotTest : public ::testing::Test { public: public: Loading Loading @@ -1208,7 +1208,7 @@ TEST_F(SnapshotUpdateTest, FullUpdateFlow) { // Initiate the merge and wait for it to be completed. // Initiate the merge and wait for it to be completed. ASSERT_TRUE(init->InitiateMerge()); ASSERT_TRUE(init->InitiateMerge()); ASSERT_EQ(init->IsSnapuserdRequired(), ShouldUseUserspaceSnapshots()); ASSERT_EQ(init->IsSnapuserdRequired(), IsDaemonRequired()); { { // We should have started in SECOND_PHASE since nothing shrinks. // We should have started in SECOND_PHASE since nothing shrinks. ASSERT_TRUE(AcquireLock()); ASSERT_TRUE(AcquireLock()); Loading Loading @@ -1342,7 +1342,7 @@ TEST_F(SnapshotUpdateTest, SpaceSwapUpdate) { // Initiate the merge and wait for it to be completed. // Initiate the merge and wait for it to be completed. ASSERT_TRUE(init->InitiateMerge()); ASSERT_TRUE(init->InitiateMerge()); ASSERT_EQ(init->IsSnapuserdRequired(), ShouldUseUserspaceSnapshots()); ASSERT_EQ(init->IsSnapuserdRequired(), IsDaemonRequired()); { { // Check that the merge phase is FIRST_PHASE until at least one call // Check that the merge phase is FIRST_PHASE until at least one call // to ProcessUpdateState() occurs. // to ProcessUpdateState() occurs. Loading Loading @@ -1450,7 +1450,7 @@ TEST_F(SnapshotUpdateTest, ConsistencyCheckResume) { // Initiate the merge and wait for it to be completed. // Initiate the merge and wait for it to be completed. ASSERT_TRUE(init->InitiateMerge()); ASSERT_TRUE(init->InitiateMerge()); ASSERT_EQ(init->IsSnapuserdRequired(), ShouldUseUserspaceSnapshots()); ASSERT_EQ(init->IsSnapuserdRequired(), IsDaemonRequired()); { { // Check that the merge phase is FIRST_PHASE until at least one call // Check that the merge phase is FIRST_PHASE until at least one call // to ProcessUpdateState() occurs. // to ProcessUpdateState() occurs. Loading Loading @@ -2750,13 +2750,26 @@ void SnapshotTestEnvironment::TearDown() { } } } } bool ShouldUseUserspaceSnapshots() { bool IsDaemonRequired() { if (FLAGS_force_config == "dmsnap") { if (FLAGS_force_config == "dmsnap") { return false; return false; } } const std::string UNKNOWN = "unknown"; const std::string vendor_release = android::base::GetProperty("ro.vendor.build.version.release_or_codename", UNKNOWN); // No userspace snapshots if vendor partition is on Android 12 // However, for GRF devices, snapuserd daemon will be on // vendor ramdisk in Android 12. if (vendor_release.find("12") != std::string::npos) { return true; } if (!FLAGS_force_config.empty()) { if (!FLAGS_force_config.empty()) { return true; return true; } } return IsUserspaceSnapshotsEnabled(); return IsUserspaceSnapshotsEnabled(); } } Loading Loading
fs_mgr/libsnapshot/snapshot.cpp +15 −2 Original line number Original line Diff line number Diff line Loading @@ -3273,8 +3273,21 @@ Return SnapshotManager::CreateUpdateSnapshots(const DeltaArchiveManifest& manife snapuserd_client_ = nullptr; snapuserd_client_ = nullptr; } } } else { } else { status.set_userspace_snapshots(!IsDmSnapshotTestingEnabled()); bool userSnapshotsEnabled = true; if (IsDmSnapshotTestingEnabled()) { 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; } userSnapshotsEnabled = (userSnapshotsEnabled && !IsDmSnapshotTestingEnabled()); status.set_userspace_snapshots(userSnapshotsEnabled); if (!userSnapshotsEnabled) { is_snapshot_userspace_ = false; is_snapshot_userspace_ = false; LOG(INFO) << "User-space snapshots disabled for testing"; LOG(INFO) << "User-space snapshots disabled for testing"; } else { } else { Loading
fs_mgr/libsnapshot/snapshot_test.cpp +18 −5 Original line number Original line Diff line number Diff line Loading @@ -91,7 +91,7 @@ std::string fake_super; void MountMetadata(); void MountMetadata(); bool ShouldUseCompression(); bool ShouldUseCompression(); bool ShouldUseUserspaceSnapshots(); bool IsDaemonRequired(); class SnapshotTest : public ::testing::Test { class SnapshotTest : public ::testing::Test { public: public: Loading Loading @@ -1208,7 +1208,7 @@ TEST_F(SnapshotUpdateTest, FullUpdateFlow) { // Initiate the merge and wait for it to be completed. // Initiate the merge and wait for it to be completed. ASSERT_TRUE(init->InitiateMerge()); ASSERT_TRUE(init->InitiateMerge()); ASSERT_EQ(init->IsSnapuserdRequired(), ShouldUseUserspaceSnapshots()); ASSERT_EQ(init->IsSnapuserdRequired(), IsDaemonRequired()); { { // We should have started in SECOND_PHASE since nothing shrinks. // We should have started in SECOND_PHASE since nothing shrinks. ASSERT_TRUE(AcquireLock()); ASSERT_TRUE(AcquireLock()); Loading Loading @@ -1342,7 +1342,7 @@ TEST_F(SnapshotUpdateTest, SpaceSwapUpdate) { // Initiate the merge and wait for it to be completed. // Initiate the merge and wait for it to be completed. ASSERT_TRUE(init->InitiateMerge()); ASSERT_TRUE(init->InitiateMerge()); ASSERT_EQ(init->IsSnapuserdRequired(), ShouldUseUserspaceSnapshots()); ASSERT_EQ(init->IsSnapuserdRequired(), IsDaemonRequired()); { { // Check that the merge phase is FIRST_PHASE until at least one call // Check that the merge phase is FIRST_PHASE until at least one call // to ProcessUpdateState() occurs. // to ProcessUpdateState() occurs. Loading Loading @@ -1450,7 +1450,7 @@ TEST_F(SnapshotUpdateTest, ConsistencyCheckResume) { // Initiate the merge and wait for it to be completed. // Initiate the merge and wait for it to be completed. ASSERT_TRUE(init->InitiateMerge()); ASSERT_TRUE(init->InitiateMerge()); ASSERT_EQ(init->IsSnapuserdRequired(), ShouldUseUserspaceSnapshots()); ASSERT_EQ(init->IsSnapuserdRequired(), IsDaemonRequired()); { { // Check that the merge phase is FIRST_PHASE until at least one call // Check that the merge phase is FIRST_PHASE until at least one call // to ProcessUpdateState() occurs. // to ProcessUpdateState() occurs. Loading Loading @@ -2750,13 +2750,26 @@ void SnapshotTestEnvironment::TearDown() { } } } } bool ShouldUseUserspaceSnapshots() { bool IsDaemonRequired() { if (FLAGS_force_config == "dmsnap") { if (FLAGS_force_config == "dmsnap") { return false; return false; } } const std::string UNKNOWN = "unknown"; const std::string vendor_release = android::base::GetProperty("ro.vendor.build.version.release_or_codename", UNKNOWN); // No userspace snapshots if vendor partition is on Android 12 // However, for GRF devices, snapuserd daemon will be on // vendor ramdisk in Android 12. if (vendor_release.find("12") != std::string::npos) { return true; } if (!FLAGS_force_config.empty()) { if (!FLAGS_force_config.empty()) { return true; return true; } } return IsUserspaceSnapshotsEnabled(); return IsUserspaceSnapshotsEnabled(); } } Loading