Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e6ef7f8d authored by Akilesh Kailash's avatar Akilesh Kailash Committed by Automerger Merge Worker
Browse files

Merge "libsnapshot:snapuserd: Terminate daemon after applying OTA." am: 591edca4

Original change: https://android-review.googlesource.com/c/platform/system/core/+/1663841

Change-Id: I959ca9db5f20a9af47934db18ac21618f6ce9bf1
parents e5c1b569 591edca4
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -69,6 +69,8 @@ class SnapuserdClient {
    // must ONLY be called if the control device has already been deleted.
    bool WaitForDeviceDelete(const std::string& control_device);

    void CloseConnection() { sockfd_ = {}; }

    // Detach snapuserd. This shuts down the listener socket, and will cause
    // snapuserd to gracefully exit once all handler threads have terminated.
    // This should only be used on first-stage instances of snapuserd.
+11 −0
Original line number Diff line number Diff line
@@ -2297,6 +2297,17 @@ bool SnapshotManager::UnmapAllSnapshots(LockedFile* lock) {
            return false;
        }
    }

    // Terminate the daemon and release the snapuserd_client_ object.
    // If we need to re-connect with the daemon, EnsureSnapuserdConnected()
    // will re-create the object and establish the socket connection.
    if (snapuserd_client_) {
        LOG(INFO) << "Shutdown snapuserd daemon";
        snapuserd_client_->DetachSnapuserd();
        snapuserd_client_->CloseConnection();
        snapuserd_client_ = nullptr;
    }

    return true;
}

+2 −0
Original line number Diff line number Diff line
@@ -2019,6 +2019,8 @@ TEST_F(SnapshotUpdateTest, MapAllSnapshots) {

    // Read bytes back and verify they match the cache.
    ASSERT_TRUE(IsPartitionUnchanged("sys_b"));

    ASSERT_TRUE(sm->UnmapAllSnapshots());
}

TEST_F(SnapshotUpdateTest, CancelOnTargetSlot) {