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

Commit d6b3f087 authored by Yifan Hong's avatar Yifan Hong Committed by android-build-merger
Browse files

Merge "libsnapshot: Only EnsureImageManager when it is needed." am: 81a0738c

am: 3d613876

Change-Id: If93509ecbdad0635d6df41b2b8e13d5d879e1165
parents e1aa3b38 3d613876
Loading
Loading
Loading
Loading
+1 −2
Original line number Original line Diff line number Diff line
@@ -342,7 +342,6 @@ bool SnapshotManager::MapSnapshot(LockedFile* lock, const std::string& name,
                                  const std::chrono::milliseconds& timeout_ms,
                                  const std::chrono::milliseconds& timeout_ms,
                                  std::string* dev_path) {
                                  std::string* dev_path) {
    CHECK(lock);
    CHECK(lock);
    if (!EnsureImageManager()) return false;


    SnapshotStatus status;
    SnapshotStatus status;
    if (!ReadSnapshotStatus(lock, name, &status)) {
    if (!ReadSnapshotStatus(lock, name, &status)) {
@@ -1428,7 +1427,6 @@ bool SnapshotManager::MapCowDevices(LockedFile* lock, const CreateLogicalPartiti
                                    const SnapshotStatus& snapshot_status,
                                    const SnapshotStatus& snapshot_status,
                                    AutoDeviceList* created_devices, std::string* cow_name) {
                                    AutoDeviceList* created_devices, std::string* cow_name) {
    CHECK(lock);
    CHECK(lock);
    if (!EnsureImageManager()) return false;
    CHECK(snapshot_status.cow_partition_size() + snapshot_status.cow_file_size() > 0);
    CHECK(snapshot_status.cow_partition_size() + snapshot_status.cow_file_size() > 0);
    auto begin = std::chrono::steady_clock::now();
    auto begin = std::chrono::steady_clock::now();


@@ -1440,6 +1438,7 @@ bool SnapshotManager::MapCowDevices(LockedFile* lock, const CreateLogicalPartiti


    // Map COW image if necessary.
    // Map COW image if necessary.
    if (snapshot_status.cow_file_size() > 0) {
    if (snapshot_status.cow_file_size() > 0) {
        if (!EnsureImageManager()) return false;
        auto remaining_time = GetRemainingTime(params.timeout_ms, begin);
        auto remaining_time = GetRemainingTime(params.timeout_ms, begin);
        if (remaining_time.count() < 0) return false;
        if (remaining_time.count() < 0) return false;