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

Commit 4ab2007d authored by android-build-team Robot's avatar android-build-team Robot
Browse files

Snap for 7030823 from 82362fa1 to sc-release

Change-Id: I6a287aa96de3ec0daac7307cdc763b8c1c50f6c6
parents ea7ccaf9 82362fa1
Loading
Loading
Loading
Loading
+11 −8
Original line number Diff line number Diff line
@@ -384,16 +384,19 @@ typedef struct {
      p_app_sink_data_cback; /* Sink application callback for media packets */
} tBTA_AV_SEP;

enum : uint8_t {
  /* initiator/acceptor role for adaption */
#define BTA_AV_ROLE_AD_INT 0x00 /* initiator */
#define BTA_AV_ROLE_AD_ACP 0x01 /* acceptor */
  BTA_AV_ROLE_AD_INT = 0x00, /* initiator */
  BTA_AV_ROLE_AD_ACP = 0x01, /* acceptor */

  /* initiator/acceptor signaling roles */
#define BTA_AV_ROLE_START_ACP 0x00
#define BTA_AV_ROLE_START_INT 0x10 /* do not change this value */
  BTA_AV_ROLE_START_ACP = 0x00,
  BTA_AV_ROLE_START_INT = 0x10, /* do not change this value */

#define BTA_AV_ROLE_SUSPEND 0x20     /* suspending on start */
#define BTA_AV_ROLE_SUSPEND_OPT 0x40 /* Suspend on Start option is set */
  BTA_AV_ROLE_SUSPEND = 0x20,     /* suspending on start */
  BTA_AV_ROLE_SUSPEND_OPT = 0x40, /* Suspend on Start option is set */
};
typedef uint8_t tBTA_AV_ROLE;

/* union of all event datatypes */
union tBTA_AV_DATA {
+14 −27
Original line number Diff line number Diff line
@@ -25,40 +25,26 @@

#define LOG_TAG "bt_bta_dm"

#include <base/bind.h>
#include <base/callback.h>
#include <base/logging.h>
#include <string.h>

#include "bt_common.h"
#include "bt_target.h"
#include "bt_types.h"
#include "bta_api.h"
#include "bta_dm_api.h"
#include "bta_dm_ci.h"
#include "bta_dm_co.h"
#include "bta_dm_int.h"
#include "bta_sys.h"
#include "btif_dm.h"
#include "btif_storage.h"
#include "btm_api.h"
#include "btm_int.h"
#include "btu.h"
#include <cstdint>

#include "bta/dm/bta_dm_int.h"
#include "bta/gatt/bta_gattc_int.h"
#include "bta/include/bta_dm_ci.h"
#include "btif/include/btif_dm.h"
#include "btif/include/btif_storage.h"
#include "btif/include/stack_manager.h"
#include "device/include/controller.h"
#include "device/include/interop.h"
#include "gap_api.h" /* For GAP_BleReadPeerPrefConnParams */
#include "l2c_api.h"
#include "main/shim/btm_api.h"
#include "main/shim/shim.h"
#include "osi/include/log.h"
#include "osi/include/osi.h"
#include "sdp_api.h"
#include "stack/btm/btm_sec.h"
#include "stack/btm/neighbor_inquiry.h"
#include "stack/gatt/connection_manager.h"
#include "stack/include/acl_api.h"
#include "stack/include/gatt_api.h"
#include "stack_manager.h"
#include "utl.h"
#include "stack/include/bt_types.h"
#include "stack/include/btu.h"
#include "types/raw_address.h"

#if (GAP_INCLUDED == TRUE)
#include "gap_api.h"
@@ -66,8 +52,9 @@

using bluetooth::Uuid;

void BTIF_dm_enable();
void BTIF_dm_disable();
void BTIF_dm_enable();
void btm_ble_adv_init(void);

static void bta_dm_inq_results_cb(tBTM_INQ_RESULTS* p_inq, uint8_t* p_eir,
                                  uint16_t eir_len);
+19 −0
Original line number Diff line number Diff line
@@ -62,6 +62,7 @@ class PySecurity(Closable):

    _ui_event_stream = None
    _bond_event_stream = None
    _oob_data_event_stream = None

    def __init__(self, device):
        logging.debug("DUT: Init")
@@ -72,6 +73,8 @@ class PySecurity(Closable):
        self._enforce_security_policy_stream = EventStream(
            self._device.security.FetchEnforceSecurityPolicyEvents(empty_proto.Empty()))
        self._disconnect_event_stream = EventStream(self._device.security.FetchDisconnectEvents(empty_proto.Empty()))
        self._oob_data_event_stream = EventStream(
            self._device.security.FetchGetOutOfBandDataEvents(empty_proto.Empty()))

    def create_bond(self, address, type):
        """
@@ -253,8 +256,24 @@ class PySecurity(Closable):
                address=common.BluetoothAddressWithType(address=common.BluetoothAddress(address=address), type=type),
                policy=policy))

    def get_oob_data_from_controller(self, oob_data_present):
        self._device.security.GetOutOfBandData(empty_proto.Empty())
        oob_data = []

        def get_oob_data(event):
            nonlocal oob_data
            oob_data = [
                list(event.p192_data.confirmation_value),
                list(event.p192_data.random_value), [0 for i in range(0, 16)], [0 for i in range(0, 16)]
            ]
            return True

        assertThat(self._oob_data_event_stream).emits(get_oob_data)
        return oob_data

    def close(self):
        safeClose(self._ui_event_stream)
        safeClose(self._bond_event_stream)
        safeClose(self._enforce_security_policy_stream)
        safeClose(self._disconnect_event_stream)
        safeClose(self._oob_data_event_stream)
+12 −6
Original line number Diff line number Diff line
@@ -35,10 +35,10 @@ async fn provide_facade(hal_exports: HalExports, rt: Arc<Runtime>) -> HciHalFaca
#[derive(Clone, Stoppable)]
pub struct HciHalFacadeService {
    rt: Arc<Runtime>,
    cmd_tx: mpsc::UnboundedSender<HciCommand>,
    evt_rx: Arc<Mutex<mpsc::UnboundedReceiver<HciEvent>>>,
    acl_tx: mpsc::UnboundedSender<RawPacket>,
    acl_rx: Arc<Mutex<mpsc::UnboundedReceiver<HciEvent>>>,
    cmd_tx: mpsc::Sender<HciCommand>,
    evt_rx: Arc<Mutex<mpsc::Receiver<HciEvent>>>,
    acl_tx: mpsc::Sender<RawPacket>,
    acl_rx: Arc<Mutex<mpsc::Receiver<HciEvent>>>,
}

impl GrpcFacade for HciHalFacadeService {
@@ -49,12 +49,18 @@ impl GrpcFacade for HciHalFacadeService {

impl HciHalFacade for HciHalFacadeService {
    fn send_command(&mut self, _ctx: RpcContext<'_>, mut cmd: Command, sink: UnarySink<Empty>) {
        self.cmd_tx.send(cmd.take_payload().into()).unwrap();
        let cmd_tx = self.cmd_tx.clone();
        self.rt.block_on(async move {
            cmd_tx.send(cmd.take_payload().into()).await.unwrap();
        });
        sink.success(Empty::default());
    }

    fn send_acl(&mut self, _ctx: RpcContext<'_>, mut acl: AclPacket, sink: UnarySink<Empty>) {
        self.acl_tx.send(acl.take_payload().into()).unwrap();
        let acl_tx = self.acl_tx.clone();
        self.rt.block_on(async move {
            acl_tx.send(acl.take_payload().into()).await.unwrap();
        });
        sink.success(Empty::default());
    }

+3 −4
Original line number Diff line number Diff line
//! Implementation of the HAl that talks to BT controller over Android's HIDL
use crate::internal::Hal;
use crate::HalExports;
use crate::internal::{Hal, RawHalExports};
use bt_packet::{HciCommand, HciEvent, RawPacket};
use bytes::Bytes;
use gddi::{module, provides};
@@ -13,12 +12,12 @@ use tokio::sync::mpsc::{unbounded_channel, UnboundedReceiver, UnboundedSender};
module! {
    hidl_hal_module,
    providers {
        HalExports => provide_hidl_hal,
        RawHalExports => provide_hidl_hal,
    }
}

#[provides]
async fn provide_hidl_hal(rt: Arc<Runtime>) -> HalExports {
async fn provide_hidl_hal(rt: Arc<Runtime>) -> RawHalExports {
    let (hal_exports, hal) = Hal::new();
    let (init_tx, mut init_rx) = unbounded_channel();
    *CALLBACKS.lock().unwrap() = Some(Callbacks {
Loading