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

Commit 96c5d575 authored by Joseph Hwang's avatar Joseph Hwang Committed by Automerger Merge Worker
Browse files

Merge changes from topic "erroneous_data_reporting_reland" am: 1957c7ca am:...

Merge changes from topic "erroneous_data_reporting_reland" am: 1957c7ca am: 0a2fac89 am: 2c15ad62 am: 80dabf60

Original change: https://android-review.googlesource.com/c/platform/packages/modules/Bluetooth/+/2524698



Change-Id: I39e2b332576dcc224a3fdf1c40c557da1db1ef20
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 3b8dbb20 80dabf60
Loading
Loading
Loading
Loading
+36 −0
Original line number Diff line number Diff line
@@ -178,6 +178,13 @@ struct Controller::impl {
          handler->BindOnceOn(this, &Controller::impl::le_set_host_feature_handler));
    }

    if (is_supported(OpCode::READ_DEFAULT_ERRONEOUS_DATA_REPORTING)) {
      hci_->EnqueueCommand(
          ReadDefaultErroneousDataReportingBuilder::Create(),
          handler->BindOnceOn(
              this, &Controller::impl::read_default_erroneous_data_reporting_handler));
    }

    // Skip vendor capabilities check if configured.
    if (os::GetSystemPropertyBool(
            kPropertyVendorCapabilitiesEnabled, kDefaultVendorCapabilitiesEnabled)) {
@@ -381,6 +388,35 @@ struct Controller::impl {
    ASSERT_LOG(status == ErrorCode::SUCCESS, "Status 0x%02hhx, %s", status, ErrorCodeText(status).c_str());
  }

  void read_default_erroneous_data_reporting_handler(CommandCompleteView view) {
    auto complete_view = ReadDefaultErroneousDataReportingCompleteView::Create(view);
    ASSERT(complete_view.IsValid());
    ErrorCode status = complete_view.GetStatus();
    ASSERT_LOG(
        status == ErrorCode::SUCCESS, "Status 0x%02hhx, %s", status, ErrorCodeText(status).c_str());
    Enable erroneous_data_reporting = complete_view.GetErroneousDataReporting();
    LOG_INFO("read default erroneous data reporting: %hhu", erroneous_data_reporting);

    // Enable Erroneous Data Reporting if it is disabled and the write command is supported.
    if (erroneous_data_reporting == Enable::DISABLED &&
        is_supported(OpCode::WRITE_DEFAULT_ERRONEOUS_DATA_REPORTING)) {
      std::unique_ptr<WriteDefaultErroneousDataReportingBuilder> packet =
          WriteDefaultErroneousDataReportingBuilder::Create(Enable::ENABLED);
      hci_->EnqueueCommand(
          std::move(packet),
          module_.GetHandler()->BindOnceOn(
              this, &Controller::impl::write_default_erroneous_data_reporting_handler));
    }
  }

  void write_default_erroneous_data_reporting_handler(CommandCompleteView view) {
    auto complete_view = WriteDefaultErroneousDataReportingCompleteView::Create(view);
    ASSERT(complete_view.IsValid());
    ErrorCode status = complete_view.GetStatus();
    ASSERT_LOG(
        status == ErrorCode::SUCCESS, "Status 0x%02hhx, %s", status, ErrorCodeText(status).c_str());
  }

  void le_read_local_supported_features_handler(CommandCompleteView view) {
    auto complete_view = LeReadLocalSupportedFeaturesCompleteView::Create(view);
    ASSERT(complete_view.IsValid());
+34 −0
Original line number Diff line number Diff line
@@ -2506,6 +2506,40 @@ packet WriteInquiryResponseTransmitPowerLevelComplete : CommandComplete (command
  status : ErrorCode,
}

packet ReadDefaultErroneousDataReporting : Command (op_code = READ_DEFAULT_ERRONEOUS_DATA_REPORTING) {
}

test ReadDefaultErroneousDataReporting {
  "\x5a\x0c\x00",
}

packet ReadDefaultErroneousDataReportingComplete : CommandComplete (command_op_code = READ_DEFAULT_ERRONEOUS_DATA_REPORTING) {
  status : ErrorCode,
  erroneous_data_reporting : Enable,
}

test ReadDefaultErroneousDataReportingComplete {
  "\x0e\x05\x02\x5a\x0c\x00\x00", // status success, Erroneous data reporting disabled
  "\x0e\x05\x02\x5a\x0c\x00\x01", // status success, Erroneous data reporting enabled
}

packet WriteDefaultErroneousDataReporting : Command (op_code = WRITE_DEFAULT_ERRONEOUS_DATA_REPORTING) {
  erroneous_data_reporting : Enable,
}

test WriteDefaultErroneousDataReporting {
  "\x5b\x0c\x01\x00", // disable Erroneous Data reporting
  "\x5b\x0c\x01\x01", // enable Erroneous Data reporting
}

packet WriteDefaultErroneousDataReportingComplete : CommandComplete (command_op_code = WRITE_DEFAULT_ERRONEOUS_DATA_REPORTING) {
  status : ErrorCode,
}

test WriteDefaultErroneousDataReportingComplete {
  "\x0e\x04\x01\x5b\x0c\x00", // status success
}

enum KeypressNotificationType : 8 {
  ENTRY_STARTED = 0,
  DIGIT_ENTERED = 1,