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

Commit 7f292825 authored by android-build-team Robot's avatar android-build-team Robot
Browse files

Snap for 6227479 from f9ce5fd9 to rvc-release

Change-Id: I225a36ce5474e2db3f8f1270e4b80dff8b781c09
parents ba0f8652 f9ce5fd9
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -109,6 +109,9 @@ void btif_a2dp_sink_on_stopped(tBTA_AV_SUSPEND* p_av_suspend);
// |tBTA_AV_SUSPEND|.
void btif_a2dp_sink_on_suspended(tBTA_AV_SUSPEND* p_av_suspend);

// Start the decoder for the A2DP Sink module.
bool btif_a2dp_sink_on_start(void);

// Enable/disable discarding of received A2DP frames.
// If |enable| is true, the discarding is enabled, otherwise is disabled.
void btif_a2dp_sink_set_rx_flush(bool enable);
+65 −1
Original line number Diff line number Diff line
@@ -64,7 +64,9 @@ enum {
  BTIF_MEDIA_SINK_DECODER_UPDATE = 1,
  BTIF_MEDIA_SINK_CLEAR_TRACK,
  BTIF_MEDIA_SINK_SET_FOCUS_STATE,
  BTIF_MEDIA_SINK_AUDIO_RX_FLUSH
  BTIF_MEDIA_SINK_AUDIO_RX_FLUSH,
  BTIF_MEDIA_SINK_START,
  BTIF_MEDIA_SINK_SUSPEND
};

typedef struct {
@@ -149,6 +151,8 @@ static void btif_a2dp_sink_set_focus_state_event(
    btif_a2dp_sink_focus_state_t state);
static void btif_a2dp_sink_audio_rx_flush_event();
static void btif_a2dp_sink_clear_track_event_req();
static void btif_a2dp_sink_on_start_event();
static void btif_a2dp_sink_on_suspend_event();

UNUSED_ATTR static const char* dump_media_event(uint16_t event) {
  switch (event) {
@@ -156,6 +160,8 @@ UNUSED_ATTR static const char* dump_media_event(uint16_t event) {
    CASE_RETURN_STR(BTIF_MEDIA_SINK_CLEAR_TRACK)
    CASE_RETURN_STR(BTIF_MEDIA_SINK_SET_FOCUS_STATE)
    CASE_RETURN_STR(BTIF_MEDIA_SINK_AUDIO_RX_FLUSH)
    CASE_RETURN_STR(BTIF_MEDIA_SINK_START)
    CASE_RETURN_STR(BTIF_MEDIA_SINK_SUSPEND)
    default:
      break;
  }
@@ -364,6 +370,12 @@ static void btif_a2dp_sink_command_ready(BT_HDR* p_msg) {
    case BTIF_MEDIA_SINK_AUDIO_RX_FLUSH:
      btif_a2dp_sink_audio_rx_flush_event();
      break;
    case BTIF_MEDIA_SINK_START:
      btif_a2dp_sink_on_start_event();
      break;
    case BTIF_MEDIA_SINK_SUSPEND:
      btif_a2dp_sink_on_suspend_event();
      break;
    default:
      LOG_ERROR(LOG_TAG, "%s: unknown event %d", __func__, p_msg->event);
      break;
@@ -392,6 +404,11 @@ void btif_a2dp_sink_update_decoder(const uint8_t* p_codec_info) {

void btif_a2dp_sink_on_idle() {
  LOG_INFO(LOG_TAG, "%s", __func__);
  BT_HDR* p_buf = reinterpret_cast<BT_HDR*>(osi_malloc(sizeof(BT_HDR)));
  p_buf->event = BTIF_MEDIA_SINK_SUSPEND;
  btif_a2dp_sink_cb.worker_thread.DoInThread(
      FROM_HERE, base::BindOnce(btif_a2dp_sink_command_ready, p_buf));

  if (btif_a2dp_sink_state == BTIF_A2DP_SINK_STATE_OFF) return;
  btif_a2dp_sink_audio_handle_stop_decoding();
  btif_a2dp_sink_clear_track_event_req();
@@ -399,16 +416,37 @@ void btif_a2dp_sink_on_idle() {

void btif_a2dp_sink_on_stopped(UNUSED_ATTR tBTA_AV_SUSPEND* p_av_suspend) {
  LOG_INFO(LOG_TAG, "%s", __func__);
  BT_HDR* p_buf = reinterpret_cast<BT_HDR*>(osi_malloc(sizeof(BT_HDR)));
  p_buf->event = BTIF_MEDIA_SINK_SUSPEND;
  btif_a2dp_sink_cb.worker_thread.DoInThread(
      FROM_HERE, base::BindOnce(btif_a2dp_sink_command_ready, p_buf));

  if (btif_a2dp_sink_state == BTIF_A2DP_SINK_STATE_OFF) return;
  btif_a2dp_sink_audio_handle_stop_decoding();
}

void btif_a2dp_sink_on_suspended(UNUSED_ATTR tBTA_AV_SUSPEND* p_av_suspend) {
  LOG_INFO(LOG_TAG, "%s", __func__);
  BT_HDR* p_buf = reinterpret_cast<BT_HDR*>(osi_malloc(sizeof(BT_HDR)));
  p_buf->event = BTIF_MEDIA_SINK_SUSPEND;
  btif_a2dp_sink_cb.worker_thread.DoInThread(
      FROM_HERE, base::BindOnce(btif_a2dp_sink_command_ready, p_buf));

  if (btif_a2dp_sink_state == BTIF_A2DP_SINK_STATE_OFF) return;
  btif_a2dp_sink_audio_handle_stop_decoding();
}

bool btif_a2dp_sink_on_start() {
  LOG_INFO(LOG_TAG, "%s", __func__);

  BT_HDR* p_buf = reinterpret_cast<BT_HDR*>(osi_malloc(sizeof(BT_HDR)));
  p_buf->event = BTIF_MEDIA_SINK_START;
  btif_a2dp_sink_cb.worker_thread.DoInThread(
      FROM_HERE, base::BindOnce(btif_a2dp_sink_command_ready, p_buf));

  return true;
}

static void btif_a2dp_sink_audio_handle_stop_decoding() {
  LOG_INFO(LOG_TAG, "%s", __func__);
  alarm_t* old_alarm;
@@ -592,6 +630,10 @@ static void btif_a2dp_sink_decoder_update_event(
    return;
  }

  if (btif_a2dp_sink_cb.decoder_interface->decoder_configure != nullptr) {
    btif_a2dp_sink_cb.decoder_interface->decoder_configure(p_buf->codec_info);
  }

  APPL_TRACE_DEBUG("%s: create audio track", __func__);
  btif_a2dp_sink_cb.audio_track =
#ifndef OS_GENERIC
@@ -694,3 +736,25 @@ static void btif_a2dp_sink_clear_track_event_req() {
  btif_a2dp_sink_cb.worker_thread.DoInThread(
      FROM_HERE, base::BindOnce(btif_a2dp_sink_command_ready, p_buf));
}

static void btif_a2dp_sink_on_start_event() {
  LOG_INFO(LOG_TAG, "%s", __func__);

  if ((btif_a2dp_sink_cb.decoder_interface != nullptr) &&
      (btif_a2dp_sink_cb.decoder_interface->decoder_start != nullptr)) {
    btif_a2dp_sink_cb.decoder_interface->decoder_start();
  }

  return;
}

static void btif_a2dp_sink_on_suspend_event() {
  LOG_INFO(LOG_TAG, "%s", __func__);

  if ((btif_a2dp_sink_cb.decoder_interface != nullptr) &&
      (btif_a2dp_sink_cb.decoder_interface->decoder_suspend != nullptr)) {
    btif_a2dp_sink_cb.decoder_interface->decoder_suspend();
  }

  return;
}
+1 −0
Original line number Diff line number Diff line
@@ -1869,6 +1869,7 @@ bool BtifAvStateMachine::StateOpened::ProcessEvent(uint32_t event,
      if (peer_.IsSource() && peer_.IsActivePeer()) {
        // Remove flush state, ready for streaming
        btif_a2dp_sink_set_rx_flush(false);
        btif_a2dp_sink_on_start();
      }

      if (should_suspend) {
+0 −94
Original line number Diff line number Diff line
@@ -174,48 +174,6 @@ cc_binary {
    },
}

cc_binary {
    name: "bluetooth_cert_stack",
    defaults: [
        "gd_defaults",
    ],
    host_supported: true,
    srcs: [
        "cert/cert_main.cc",
        "cert/grpc_root_server.cc",
        "cert/read_only_property_server.cc",
        "grpc/grpc_module.cc",
        ":BluetoothCertSource_l2cap_layer",
    ],
    generated_headers: [
        "BluetoothGeneratedPackets_h",
        "BluetoothCertStackGeneratedStub_h",
    ],
    generated_sources: [
        "BluetoothCertStackGeneratedStub_cc",
    ],
    static_libs: [
        "libbluetooth_gd",
    ],
    shared_libs: [
        "libchrome",
        "libgrpc++_unsecure",
        "libprotobuf-cpp-full",
    ],
    target: {
        android: {
            shared_libs: [
                "android.hardware.bluetooth@1.0",
                "libhidlbase",
                "libutils",
            ],
        },
    },
    sanitize: {
        address: true,
    },
}

cc_test {
    name: "bluetooth_test_gd",
    test_suites: ["device-tests"],
@@ -507,13 +465,11 @@ genrule {
        "touch $(genDir)/hci/__init__.py; " +
        "touch $(genDir)/hci/facade/__init__.py; " +
        "touch $(genDir)/l2cap/classic/__init__.py; " +
        "touch $(genDir)/l2cap/classic/cert/__init__.py; " +
        "touch $(genDir)/neighbor/facade/__init__.py; " +
        "touch $(genDir)/security/__init__.py; " +
        "$(location soong_zip) -C $(genDir) -D $(genDir) -o $(out)",
    srcs: [
        ":BluetoothFacadeProto",
        ":BluetoothCertStackProto",
    ],
    out: ["bluetooth_cert_generated_py.zip"],
    dist: {
@@ -522,56 +478,6 @@ genrule {

}

filegroup {
    name: "BluetoothCertStackProto",
    srcs: [
        "cert/rootservice.proto",
        "l2cap/classic/cert/api.proto",
    ],
}

genrule {
    name: "BluetoothCertStackGeneratedStub_h",
    tools: [
        "aprotoc",
        "protoc-gen-grpc-cpp-plugin",
    ],
    cmd: "$(location aprotoc) -Ipackages/modules/Bluetooth/system/gd -Iexternal/protobuf/src --plugin=protoc-gen-grpc=$(location protoc-gen-grpc-cpp-plugin) $(in) --grpc_out=$(genDir) --cpp_out=$(genDir)",
    srcs: [
        ":BluetoothCertStackProto",
        ":BluetoothFacadeProto", // we need to use facade/common.proto
    ],
    out: [
        "cert/rootservice.grpc.pb.h",
        "cert/rootservice.pb.h",
        "facade/common.grpc.pb.h",
        "facade/common.pb.h",
        "l2cap/classic/cert/api.grpc.pb.h",
        "l2cap/classic/cert/api.pb.h",
    ],
}

genrule {
    name: "BluetoothCertStackGeneratedStub_cc",
    tools: [
        "aprotoc",
        "protoc-gen-grpc-cpp-plugin",
    ],
    cmd: "$(location aprotoc) -Ipackages/modules/Bluetooth/system/gd -Iexternal/protobuf/src --plugin=protoc-gen-grpc=$(location protoc-gen-grpc-cpp-plugin) $(in) --grpc_out=$(genDir) --cpp_out=$(genDir)",
    srcs: [
        ":BluetoothCertStackProto",
        ":BluetoothFacadeProto", // we need to use facade/common.proto
    ],
    out: [
        "cert/rootservice.grpc.pb.cc",
        "cert/rootservice.pb.cc",
        "facade/common.grpc.pb.cc",
        "facade/common.pb.cc",
        "l2cap/classic/cert/api.grpc.pb.cc",
        "l2cap/classic/cert/api.pb.cc",
    ],
}

cc_defaults {
  name: "bluetooth_py3_native_extension_defaults",
  include_dirs: [
+0 −3
Original line number Diff line number Diff line
@@ -5,10 +5,8 @@ bluetooth_cert_test_file_list := \
    $(call all-named-files-under,*.sh,cert) \
    $(call all-named-files-under,*.proto,cert facade hal hci/cert hci/facade l2cap/classic \
	    l2cap/classic/cert neighbor/facade security) \
    cert/cert_testcases \
    cert/cert_testcases_facade_only \
    cert/android_devices_config.json \
    cert/host_only_config.json \
    cert/host_only_config_facade_only.json \
    hal/cert/simple_hal_test.py \
    hci/cert/acl_manager_test.py \
@@ -18,7 +16,6 @@ bluetooth_cert_test_file_list := \
    hci/cert/le_advertising_manager_test.py \
    hci/cert/le_scanning_manager_test.py \
    l2cap/classic/cert/l2cap_test.py \
    l2cap/classic/cert/simple_l2cap_test.py \
    l2cap/classic/cert/pts_l2cap_test.py \
    neighbor/cert/neighbor_test.py \
    security/cert/simple_security_test.py \
Loading