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

Commit 15afe878 authored by Hansong Zhang's avatar Hansong Zhang Committed by Automerger Merge Worker
Browse files

Send OnModeChange non success event to shim am: 11839a60

Original change: https://android-review.googlesource.com/c/platform/system/bt/+/1564872

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I1a47d196531a8951200c51bbd981f2eea4aa5adb
parents 44682523 11839a60
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -64,8 +64,8 @@ class AclConnectionTracker : public ConnectionManagementCallbacks {
  void OnReadClockOffsetComplete(uint16_t clock_offset) override {
  void OnReadClockOffsetComplete(uint16_t clock_offset) override {
    SAVE_OR_CALL(OnReadClockOffsetComplete, clock_offset)
    SAVE_OR_CALL(OnReadClockOffsetComplete, clock_offset)
  }
  }
  void OnModeChange(Mode current_mode, uint16_t interval) override {
  void OnModeChange(ErrorCode status, Mode current_mode, uint16_t interval) override {
    SAVE_OR_CALL(OnModeChange, current_mode, interval)
    SAVE_OR_CALL(OnModeChange, status, current_mode, interval)
  }
  }
  void OnSniffSubrating(
  void OnSniffSubrating(
      uint16_t maximum_transmit_latency,
      uint16_t maximum_transmit_latency,
+1 −2
Original line number Original line Diff line number Diff line
@@ -413,7 +413,6 @@ struct classic_impl : public security::ISecurityManagerListener {
    if (status != ErrorCode::SUCCESS) {
    if (status != ErrorCode::SUCCESS) {
      std::string error_code = ErrorCodeText(status);
      std::string error_code = ErrorCodeText(status);
      LOG_ERROR("Received on_mode_change on handle 0x0%04hx with error code %s", handle, error_code.c_str());
      LOG_ERROR("Received on_mode_change on handle 0x0%04hx with error code %s", handle, error_code.c_str());
      return;
    }
    }
    auto callbacks = get_callbacks(handle);
    auto callbacks = get_callbacks(handle);
    if (callbacks == nullptr) {
    if (callbacks == nullptr) {
@@ -423,7 +422,7 @@ struct classic_impl : public security::ISecurityManagerListener {
    }
    }
    Mode current_mode = mode_change_view.GetCurrentMode();
    Mode current_mode = mode_change_view.GetCurrentMode();
    uint16_t interval = mode_change_view.GetInterval();
    uint16_t interval = mode_change_view.GetInterval();
    callbacks->OnModeChange(current_mode, interval);
    callbacks->OnModeChange(status, current_mode, interval);
  }
  }


  void on_sniff_subrating(EventView packet) {
  void on_sniff_subrating(EventView packet) {
+1 −1
Original line number Original line Diff line number Diff line
@@ -38,7 +38,7 @@ class ConnectionManagementCallbacks {
  // Invoked when controller sends Read Clock Offset Complete event with Success error code
  // Invoked when controller sends Read Clock Offset Complete event with Success error code
  virtual void OnReadClockOffsetComplete(uint16_t clock_offset) = 0;
  virtual void OnReadClockOffsetComplete(uint16_t clock_offset) = 0;
  // Invoked when controller sends Mode Change event with Success error code
  // Invoked when controller sends Mode Change event with Success error code
  virtual void OnModeChange(Mode current_mode, uint16_t interval) = 0;
  virtual void OnModeChange(ErrorCode status, Mode current_mode, uint16_t interval) = 0;
  // Invoked when controller sends Sniff Subrating event with Success error code
  // Invoked when controller sends Sniff Subrating event with Success error code
  virtual void OnSniffSubrating(
  virtual void OnSniffSubrating(
      uint16_t maximum_transmit_latency,
      uint16_t maximum_transmit_latency,
+4 −4
Original line number Original line Diff line number Diff line
@@ -483,7 +483,7 @@ class AclManagerWithConnectionTest : public AclManagerTest {
    MOCK_METHOD1(OnEncryptionChange, void(EncryptionEnabled enabled));
    MOCK_METHOD1(OnEncryptionChange, void(EncryptionEnabled enabled));
    MOCK_METHOD0(OnChangeConnectionLinkKeyComplete, void());
    MOCK_METHOD0(OnChangeConnectionLinkKeyComplete, void());
    MOCK_METHOD1(OnReadClockOffsetComplete, void(uint16_t clock_offse));
    MOCK_METHOD1(OnReadClockOffsetComplete, void(uint16_t clock_offse));
    MOCK_METHOD2(OnModeChange, void(Mode current_mode, uint16_t interval));
    MOCK_METHOD3(OnModeChange, void(ErrorCode status, Mode current_mode, uint16_t interval));
    MOCK_METHOD4(
    MOCK_METHOD4(
        OnSniffSubrating,
        OnSniffSubrating,
        void(
        void(
@@ -949,7 +949,7 @@ TEST_F(AclManagerWithConnectionTest, send_hold_mode) {
  ASSERT_EQ(command_view.GetHoldModeMaxInterval(), 0x0500);
  ASSERT_EQ(command_view.GetHoldModeMaxInterval(), 0x0500);
  ASSERT_EQ(command_view.GetHoldModeMinInterval(), 0x0020);
  ASSERT_EQ(command_view.GetHoldModeMinInterval(), 0x0020);


  EXPECT_CALL(mock_connection_management_callbacks_, OnModeChange(Mode::HOLD, 0x0020));
  EXPECT_CALL(mock_connection_management_callbacks_, OnModeChange(ErrorCode::SUCCESS, Mode::HOLD, 0x0020));
  test_hci_layer_->IncomingEvent(ModeChangeBuilder::Create(ErrorCode::SUCCESS, handle_, Mode::HOLD, 0x0020));
  test_hci_layer_->IncomingEvent(ModeChangeBuilder::Create(ErrorCode::SUCCESS, handle_, Mode::HOLD, 0x0020));
}
}


@@ -964,7 +964,7 @@ TEST_F(AclManagerWithConnectionTest, send_sniff_mode) {
  ASSERT_EQ(command_view.GetSniffAttempt(), 0x0040);
  ASSERT_EQ(command_view.GetSniffAttempt(), 0x0040);
  ASSERT_EQ(command_view.GetSniffTimeout(), 0x0014);
  ASSERT_EQ(command_view.GetSniffTimeout(), 0x0014);


  EXPECT_CALL(mock_connection_management_callbacks_, OnModeChange(Mode::SNIFF, 0x0028));
  EXPECT_CALL(mock_connection_management_callbacks_, OnModeChange(ErrorCode::SUCCESS, Mode::SNIFF, 0x0028));
  test_hci_layer_->IncomingEvent(ModeChangeBuilder::Create(ErrorCode::SUCCESS, handle_, Mode::SNIFF, 0x0028));
  test_hci_layer_->IncomingEvent(ModeChangeBuilder::Create(ErrorCode::SUCCESS, handle_, Mode::SNIFF, 0x0028));
}
}


@@ -975,7 +975,7 @@ TEST_F(AclManagerWithConnectionTest, send_exit_sniff_mode) {
  auto command_view = ExitSniffModeView::Create(packet);
  auto command_view = ExitSniffModeView::Create(packet);
  ASSERT_TRUE(command_view.IsValid());
  ASSERT_TRUE(command_view.IsValid());


  EXPECT_CALL(mock_connection_management_callbacks_, OnModeChange(Mode::ACTIVE, 0x00));
  EXPECT_CALL(mock_connection_management_callbacks_, OnModeChange(ErrorCode::SUCCESS, Mode::ACTIVE, 0x00));
  test_hci_layer_->IncomingEvent(ModeChangeBuilder::Create(ErrorCode::SUCCESS, handle_, Mode::ACTIVE, 0x00));
  test_hci_layer_->IncomingEvent(ModeChangeBuilder::Create(ErrorCode::SUCCESS, handle_, Mode::ACTIVE, 0x00));
}
}


+1 −1
Original line number Original line Diff line number Diff line
@@ -411,7 +411,7 @@ class AclManagerFacadeService : public AclManagerFacade::Service, public Connect
      LOG_INFO("OnReadClockOffsetComplete clock_offset:%d", clock_offset);
      LOG_INFO("OnReadClockOffsetComplete clock_offset:%d", clock_offset);
    };
    };


    void OnModeChange(Mode current_mode, uint16_t interval) override {
    void OnModeChange(ErrorCode status, Mode current_mode, uint16_t interval) override {
      LOG_INFO("OnModeChange Mode:%d, interval:%d", (uint8_t)current_mode, interval);
      LOG_INFO("OnModeChange Mode:%d, interval:%d", (uint8_t)current_mode, interval);
    };
    };


Loading