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

Commit 51b127c7 authored by Yifan Hong's avatar Yifan Hong Committed by Gerrit Code Review
Browse files

Merge changes I845d2250,I4faa0785

* changes:
  libsnapshot: proto use correct index
  libsnapshot: Export COW image size
parents b0b5d4f4 a3007640
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -132,7 +132,7 @@ message SnapshotUpdateStatus {
    uint64 metadata_sectors = 4;
}

// Next: 2
// Next: 4
message SnapshotMergeReport {
    // Status of the update after the merge attempts.
    UpdateState state = 1;
@@ -140,4 +140,7 @@ message SnapshotMergeReport {
    // Number of reboots that occurred after issuing and before completeing the
    // merge of all the snapshot devices.
    int32 resume_count = 2;

    // Total size of all the COW images before the update.
    uint64 cow_file_size = 3;
}
+1 −1
Original line number Diff line number Diff line
@@ -25,7 +25,7 @@ class MockSnapshotManager : public ISnapshotManager {
    MOCK_METHOD(bool, BeginUpdate, (), (override));
    MOCK_METHOD(bool, CancelUpdate, (), (override));
    MOCK_METHOD(bool, FinishedSnapshotWrites, (bool wipe), (override));
    MOCK_METHOD(bool, InitiateMerge, (), (override));
    MOCK_METHOD(bool, InitiateMerge, (uint64_t * cow_file_size), (override));

    MOCK_METHOD(UpdateState, ProcessUpdateState,
                (const std::function<bool()>& callback, const std::function<bool()>& before_cancel),
+2 −2
Original line number Diff line number Diff line
@@ -124,7 +124,7 @@ class ISnapshotManager {

    // Initiate a merge on all snapshot devices. This should only be used after an
    // update has been marked successful after booting.
    virtual bool InitiateMerge() = 0;
    virtual bool InitiateMerge(uint64_t* cow_file_size = nullptr) = 0;

    // Perform any necessary post-boot actions. This should be run soon after
    // /data is mounted.
@@ -281,7 +281,7 @@ class SnapshotManager final : public ISnapshotManager {
    bool BeginUpdate() override;
    bool CancelUpdate() override;
    bool FinishedSnapshotWrites(bool wipe) override;
    bool InitiateMerge() override;
    bool InitiateMerge(uint64_t* cow_file_size = nullptr) override;
    UpdateState ProcessUpdateState(const std::function<bool()>& callback = {},
                                   const std::function<bool()>& before_cancel = {}) override;
    UpdateState GetUpdateState(double* progress = nullptr) override;
+4 −0
Original line number Diff line number Diff line
@@ -29,6 +29,8 @@ class ISnapshotMergeStats {
    // Called when merge starts or resumes.
    virtual bool Start() = 0;
    virtual void set_state(android::snapshot::UpdateState state) = 0;
    virtual void set_cow_file_size(uint64_t cow_file_size) = 0;
    virtual uint64_t cow_file_size() = 0;

    // Called when merge ends. Properly clean up permanent storage.
    class Result {
@@ -50,6 +52,8 @@ class SnapshotMergeStats : public ISnapshotMergeStats {
    // ISnapshotMergeStats overrides
    bool Start() override;
    void set_state(android::snapshot::UpdateState state) override;
    void set_cow_file_size(uint64_t cow_file_size) override;
    uint64_t cow_file_size() override;
    std::unique_ptr<Result> Finish() override;

  private:
+1 −1
Original line number Diff line number Diff line
@@ -27,7 +27,7 @@ class SnapshotManagerStub : public ISnapshotManager {
    bool BeginUpdate() override;
    bool CancelUpdate() override;
    bool FinishedSnapshotWrites(bool wipe) override;
    bool InitiateMerge() override;
    bool InitiateMerge(uint64_t* cow_file_size = nullptr) override;
    UpdateState ProcessUpdateState(const std::function<bool()>& callback = {},
                                   const std::function<bool()>& before_cancel = {}) override;
    UpdateState GetUpdateState(double* progress = nullptr) override;
Loading