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

Commit cfefccff authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge changes from topic "floss_suspend_resume_api" am: 3d7c0fce am: bebf8744

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

Change-Id: I9d87ff391d1580ef64e4aea56e2db88bd6422ecb
parents da3cb12f bebf8744
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -333,7 +333,7 @@ class HostBuild():
            'libbase_ver': self._get_basever(),
            'enable_exceptions': os.environ.get('CXXEXCEPTIONS', 0) == '1',
            'external_cflags': [],
            'external_cxxflags': [],
            'external_cxxflags': ["-DNDEBUG"],
            'enable_werror': False,
        }

+3 −0
Original line number Diff line number Diff line
syntax = "proto3";

import "google/protobuf/empty.proto";

package blueberry.facade.topshim;

service AdapterService {
  rpc FetchEvents(FetchEventsRequest) returns (stream FetchEventsResponse) {}
  rpc ToggleStack(ToggleStackRequest) returns (ToggleStackResponse) {}
  rpc SetDiscoveryMode(SetDiscoveryModeRequest) returns (SetDiscoveryModeResponse) {}
  rpc ClearEventFilter(google.protobuf.Empty) returns (google.protobuf.Empty) {}
}

enum EventType {
+5 −0
Original line number Diff line number Diff line
@@ -20,6 +20,8 @@ import grpc
from blueberry.facade.topshim import facade_pb2
from blueberry.facade.topshim import facade_pb2_grpc

from google.protobuf import empty_pb2 as empty_proto


class AdapterAutomationHelper():
    # Timeout for async wait
@@ -60,6 +62,9 @@ class AdapterAutomationHelper():
    async def verify_adapter_started(self):
        await asyncio.wait_for(self.pending_future, AdapterAutomationHelper.DEFAULT_TIMEOUT)

    async def clear_event_filter(self):
        await self.adapter_stub.ClearEventFilter(empty_proto.Empty())


class A2dpAutomationHelper():
    """Invoke gRPC on topshim for A2DP testing"""
+42 −0
Original line number Diff line number Diff line
#!/usr/bin/env python3
#
#   Copyright 2021 - The Android Open Source Project
#
#   Licensed under the Apache License, Version 2.0 (the "License");
#   you may not use this file except in compliance with the License.
#   You may obtain a copy of the License at
#
#       http://www.apache.org/licenses/LICENSE-2.0
#
#   Unless required by applicable law or agreed to in writing, software
#   distributed under the License is distributed on an "AS IS" BASIS,
#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#   See the License for the specific language governing permissions and
#   limitations under the License.

import asyncio
from mobly import test_runner
from blueberry.tests.gd.rust.topshim.facade import topshim_base_test
from blueberry.tests.gd.rust.topshim.facade.automation_helper import AdapterAutomationHelper
import time


class SuspendTest(topshim_base_test.TopshimBaseTest):

    async def _test_verify_event_filter_cleared(self):
        self.dut_adapter = AdapterAutomationHelper(port=self.dut_port)
        event_loop = asyncio.get_running_loop()
        self.dut_adapter.fetch_events(event_loop)
        self.dut_adapter.pending_future = event_loop.create_future()
        await self.dut_adapter.clear_event_filter()
        #TODO(optedoblivion): Replace sleep with a call to LeGetRandom and synchronize on
        # the callback
        time.sleep(1)
        self.dut_adapter.event_handler.cancel()

    def test_verify_event_filter_cleared(self):
        asyncio.run(self._test_verify_event_filter_cleared())


if __name__ == "__main__":
    test_runner.main()
+14 −0
Original line number Diff line number Diff line
@@ -3996,6 +3996,20 @@ void bta_dm_proc_open_evt(tBTA_GATTC_OPEN* p_data) {
  }
}

/*******************************************************************************
 *
 * Function         bta_dm_proc_open_evt
 *
 * Description      process BTA_GATTC_OPEN_EVT in DM.
 *
 * Parameters:
 *
 ******************************************************************************/
void bta_dm_clear_event_filter(void) {
  VLOG(1) << "bta_dm_clear_event_filter in bta_dm_act";
  bluetooth::shim::BTM_ClearEventFilter();
}

/*******************************************************************************
 *
 * Function         bta_dm_gattc_callback
Loading