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

Commit 444208a0 authored by Antoine SOULIER's avatar Antoine SOULIER
Browse files

GD/HCI: Allow return of Command Status or Complete, without

preconditionning

Bug: 360924438
Test: mma -j32
Flag: com.android.bluetooth.flags.hci_vendor_specific_extension
NO_IFTTT=Fuzzer actually not working, and test nothing

Change-Id: I0fe231b594883aa9fdcd3807f3316f4832c4f96f
parent 0dc741f8
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -142,6 +142,13 @@ private:
    }
  }

  void EnqueueCommand(
          std::unique_ptr<hci::AclCommandBuilder> /* command */,
          common::ContextualOnceCallback<
                  void(hci::CommandStatusOrCompleteView)> /* on_status_or_complete */) override {
    FAIL();
  }

public:
  virtual ~TestAclConnectionInterface() = default;

+7 −0
Original line number Diff line number Diff line
@@ -89,6 +89,13 @@ private:
    }
  }

  void EnqueueCommand(
          std::unique_ptr<hci::AclCommandBuilder> /* command */,
          common::ContextualOnceCallback<
                  void(hci::CommandStatusOrCompleteView)> /* on_status_or_complete */) override {
    FAIL();
  }

public:
  virtual ~TestLeAclConnectionInterface() = default;

+6 −0
Original line number Diff line number Diff line
@@ -24,6 +24,8 @@
namespace bluetooth {
namespace hci {

typedef std::variant<CommandStatusView, CommandCompleteView> CommandStatusOrCompleteView;

template <typename T>
class CommandInterface {
public:
@@ -40,6 +42,10 @@ public:
  virtual void EnqueueCommand(
          std::unique_ptr<T> command,
          common::ContextualOnceCallback<void(CommandStatusView)> on_status) = 0;

  virtual void EnqueueCommand(std::unique_ptr<T> command,
                              common::ContextualOnceCallback<void(CommandStatusOrCompleteView)>
                                      on_status_or_complete) = 0;
};
}  // namespace hci
}  // namespace bluetooth
+6 −0
Original line number Diff line number Diff line
@@ -78,6 +78,12 @@ public:
    FAIL() << "Controller properties should not generate Command Status";
  }

  void EnqueueCommand(std::unique_ptr<CommandBuilder> /* command */,
                      common::ContextualOnceCallback<void(
                              CommandStatusOrCompleteView)> /* on_status_or_complete */) override {
    FAIL() << "Controller properties should not generate Command Status";
  }

  void HandleCommand(std::unique_ptr<CommandBuilder> command_builder,
                     common::ContextualOnceCallback<void(CommandCompleteView)> on_complete) {
    auto bytes = std::make_shared<std::vector<uint8_t>>();
+5 −0
Original line number Diff line number Diff line
@@ -42,6 +42,11 @@ public:
  void EnqueueCommand(
          std::unique_ptr<T> /* command */,
          common::ContextualOnceCallback<void(hci::CommandStatusView)> /* on_status */) override {}

  void EnqueueCommand(
          std::unique_ptr<T> /* command */,
          common::ContextualOnceCallback<
                  void(hci::CommandStatusOrCompleteView)> /* on_status_or_complete */) override {}
};

class FuzzHciLayer : public HciLayer {
Loading