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

Commit d9a61444 authored by David Anderson's avatar David Anderson Committed by Gerrit Code Review
Browse files

Merge changes Ibeffa4a3,Ibce3bac9

* changes:
  libsnapshot: Add a way to detach snapuserd.
  libsnapshot: Remove special-case code for first-stage init.
parents d7f31801 ff118cec
Loading
Loading
Loading
Loading
+0 −4
Original line number Diff line number Diff line
@@ -120,9 +120,5 @@ bool DeviceInfo::SetSlotAsUnbootable([[maybe_unused]] unsigned int slot) {
#endif
}

std::string DeviceInfo::GetSnapuserdFirstStagePidVar() const {
    return kSnapuserdFirstStagePidVar;
}

}  // namespace snapshot
}  // namespace android
+0 −1
Original line number Diff line number Diff line
@@ -39,7 +39,6 @@ class DeviceInfo final : public SnapshotManager::IDeviceInfo {
    bool SetBootControlMergeStatus(MergeStatus status) override;
    bool SetSlotAsUnbootable(unsigned int slot) override;
    bool IsRecovery() const override;
    std::string GetSnapuserdFirstStagePidVar() const override;

  private:
    bool EnsureBootHal();
+0 −1
Original line number Diff line number Diff line
@@ -32,7 +32,6 @@ class MockDeviceInfo : public SnapshotManager::IDeviceInfo {
    MOCK_METHOD(bool, SetBootControlMergeStatus, (MergeStatus status), (override));
    MOCK_METHOD(bool, SetSlotAsUnbootable, (unsigned int slot), (override));
    MOCK_METHOD(bool, IsRecovery, (), (const, override));
    MOCK_METHOD(std::string, GetSnapuserdFirstStagePidVar, (), (const, override));
};

}  // namespace android::snapshot
+0 −1
Original line number Diff line number Diff line
@@ -107,7 +107,6 @@ class ISnapshotManager {
        virtual bool SetSlotAsUnbootable(unsigned int slot) = 0;
        virtual bool IsRecovery() const = 0;
        virtual bool IsTestDevice() const { return false; }
        virtual std::string GetSnapuserdFirstStagePidVar() const = 0;
    };
    virtual ~ISnapshotManager() = default;

+5 −5
Original line number Diff line number Diff line
@@ -30,7 +30,6 @@ namespace snapshot {

static constexpr uint32_t PACKET_SIZE = 512;

static constexpr char kSnapuserdSocketFirstStage[] = "snapuserd_first_stage";
static constexpr char kSnapuserdSocket[] = "snapuserd";

static constexpr char kSnapuserdFirstStagePidVar[] = "FIRST_STAGE_SNAPUSERD_PID";
@@ -38,10 +37,6 @@ static constexpr char kSnapuserdFirstStagePidVar[] = "FIRST_STAGE_SNAPUSERD_PID"
// Ensure that the second-stage daemon for snapuserd is running.
bool EnsureSnapuserdStarted();

// Start the first-stage version of snapuserd, returning its pid. This is used
// by first-stage init, as well as vts_libsnapshot_test. On failure, -1 is returned.
pid_t StartFirstStageSnapuserd();

class SnapuserdClient {
  private:
    android::base::unique_fd sockfd_;
@@ -75,6 +70,11 @@ class SnapuserdClient {
    // Wait for snapuserd to disassociate with a dm-user control device. This
    // must ONLY be called if the control device has already been deleted.
    bool WaitForDeviceDelete(const std::string& control_device);

    // 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.
    bool DetachSnapuserd();
};

}  // namespace snapshot
Loading