mirror of
https://github.com/Evolution-X/hardware_interfaces
synced 2026-02-01 11:36:00 +00:00
Merge "Remove Bluetooth.a2dp@1 HIDL HAL" into main am: 1eb0f93535
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/3148896 Change-Id: Ia214f77a0d3cc53fa47c8d29692ea40ec16f27d3 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -1,28 +0,0 @@
|
||||
// This file is autogenerated by hidl-gen -Landroidbp.
|
||||
|
||||
package {
|
||||
// See: http://go/android-license-faq
|
||||
// A large-scale-change added 'default_applicable_licenses' to import
|
||||
// all of the 'license_kinds' from "hardware_interfaces_license"
|
||||
// to get the below license kinds:
|
||||
// SPDX-license-identifier-Apache-2.0
|
||||
default_applicable_licenses: ["hardware_interfaces_license"],
|
||||
}
|
||||
|
||||
hidl_interface {
|
||||
name: "android.hardware.bluetooth.a2dp@1.0",
|
||||
root: "android.hardware",
|
||||
srcs: [
|
||||
"types.hal",
|
||||
"IBluetoothAudioHost.hal",
|
||||
"IBluetoothAudioOffload.hal",
|
||||
],
|
||||
interfaces: [
|
||||
"android.hidl.base@1.0",
|
||||
],
|
||||
gen_java: false,
|
||||
apex_available: [
|
||||
"//apex_available:platform",
|
||||
"com.android.btservices",
|
||||
],
|
||||
}
|
||||
@@ -1,61 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2018 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.
|
||||
*/
|
||||
|
||||
package android.hardware.bluetooth.a2dp@1.0;
|
||||
|
||||
/**
|
||||
* HAL interface for Bluetooth A2DP Offload functionality where
|
||||
* the encoding of the A2DP data packets is offloaded to platform
|
||||
* specific encoders. The A2DP control path is maintained in the
|
||||
* Bluetooth stack.
|
||||
*
|
||||
* This interface is from HAL server to HAL client.
|
||||
*
|
||||
* The HAL server must call into the IBluetoothAudioHost to initiate
|
||||
* the start, suspend and stop of the streaming operation. These
|
||||
* calls return immediately and the results, if any, are send over
|
||||
* the IBluetoothAudioOffload interface.
|
||||
*/
|
||||
|
||||
interface IBluetoothAudioHost {
|
||||
/**
|
||||
* Invoked when the start stream is requested from HAL server
|
||||
* to HAL client. This indicates that the HAL server
|
||||
* has initialized the platform for streaming use case, and the
|
||||
* HAL client can proceed with the streaming procedure. The
|
||||
* result of the operation must be provided by the HAL
|
||||
* client using the IBluetoothAudioOffload interface.
|
||||
*/
|
||||
oneway startStream();
|
||||
|
||||
/**
|
||||
* Invoked when the suspend stream is requested from HAL server
|
||||
* to HAL client. This indicates that the HAL server
|
||||
* wants to suspend the streaming procedure. The result of the
|
||||
* operation must be provided by the HAL client using the
|
||||
* IBluetoothAudioOffload interface.
|
||||
*/
|
||||
oneway suspendStream();
|
||||
|
||||
/**
|
||||
* Invoked when the stop stream is requested from HAL server
|
||||
* to HAL client. This indicates that the HAL server wants to
|
||||
* stop and reset the streaming procedure. There is no result
|
||||
* provided by the HAL client for this call.
|
||||
*/
|
||||
oneway stopStream();
|
||||
|
||||
};
|
||||
@@ -1,85 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2018 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.
|
||||
*/
|
||||
|
||||
package android.hardware.bluetooth.a2dp@1.0;
|
||||
|
||||
import IBluetoothAudioHost;
|
||||
|
||||
/**
|
||||
* HAL interface for Bluetooth A2DP Offload functionality where
|
||||
* the encoding of the A2DP data packets is offloaded to platform
|
||||
* specific encoders. The A2DP control path is maintained in the
|
||||
* Bluetooth stack.
|
||||
*
|
||||
* This interface is from HAL client to HAL server.
|
||||
*
|
||||
* The HAL client must provide the handle of IBluetoothAudioHost as well
|
||||
* as codec configuration to the HAL server, when its connected to an
|
||||
* active A2DP Sink device. HAL Server, based on the feedback from the Audio
|
||||
* framework must call into the commands provided by the IBluetoothAudioHost.
|
||||
* HAL client must call into IBluetoothAudioOffload to provide the status of
|
||||
* these commands. Once the device becomes inactive, the HAL client must
|
||||
* call the endSession to terminate the session with the HAL server.
|
||||
*/
|
||||
interface IBluetoothAudioOffload {
|
||||
|
||||
/**
|
||||
* Indicates that the HAL client is connected to an A2DP Sink device
|
||||
* and is ready to stream audio. This function is also used to register
|
||||
* the BluetoothAudioHost interface and the provide the current negotiated
|
||||
* codec.
|
||||
*
|
||||
* |endSession| must be called to unregister the interface.
|
||||
*
|
||||
* @param hostIf interface used to request stream control
|
||||
* @param codecConfig Codec configuration as negotiated with the A2DP Sink
|
||||
* device
|
||||
* @return status one of the following
|
||||
* SUCCESS if HAL server successfully initializes the platform with the
|
||||
* given codec configuration
|
||||
* UNSUPPORTED_CODEC_CONFIGURATION if HAL server cannot initialize the
|
||||
* platform with the given codec configuration
|
||||
* FAILURE if HAL server cannot initialize the platform for any other
|
||||
* reason
|
||||
*/
|
||||
startSession(IBluetoothAudioHost hostIf, CodecConfiguration codecConfig) generates (Status status);
|
||||
|
||||
/**
|
||||
* Updates status for start stream request. The HAL client may need
|
||||
* to communicate to Bluetooth Controller and remote Sink device, in which
|
||||
* case it must update with PENDING status. Once the operation is
|
||||
* completed, it must return with either SUCCESS or FAILURE.
|
||||
*
|
||||
* @param status SUCCESS, FAILURE or PENDING
|
||||
*/
|
||||
oneway streamStarted(Status status);
|
||||
|
||||
/**
|
||||
* Updates status for suspend stream request. The HAL client may need
|
||||
* to communicate to Bluetooth Controller and remote device, in which case
|
||||
* it must update with PENDING status. Once the operation is completed, it
|
||||
* must return with either SUCCESS or FAILURE.
|
||||
*
|
||||
* @param status SUCCESS, FAILURE or PENDING
|
||||
*/
|
||||
oneway streamSuspended(Status status);
|
||||
|
||||
/**
|
||||
* Ends the current A2DP offload session and unregisters the
|
||||
* BluetoothAudioHost interface.
|
||||
*/
|
||||
oneway endSession();
|
||||
};
|
||||
@@ -1,22 +0,0 @@
|
||||
package {
|
||||
// See: http://go/android-license-faq
|
||||
// A large-scale-change added 'default_applicable_licenses' to import
|
||||
// all of the 'license_kinds' from "hardware_interfaces_license"
|
||||
// to get the below license kinds:
|
||||
// SPDX-license-identifier-Apache-2.0
|
||||
default_applicable_licenses: ["hardware_interfaces_license"],
|
||||
}
|
||||
|
||||
cc_library_shared {
|
||||
name: "android.hardware.bluetooth.a2dp@1.0-impl.mock",
|
||||
relative_install_path: "hw",
|
||||
vendor: true,
|
||||
srcs: [
|
||||
"BluetoothAudioOffload.cpp",
|
||||
],
|
||||
shared_libs: [
|
||||
"libhidlbase",
|
||||
"libutils",
|
||||
"android.hardware.bluetooth.a2dp@1.0",
|
||||
],
|
||||
}
|
||||
@@ -1,79 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2018 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.
|
||||
*/
|
||||
|
||||
#include "BluetoothAudioOffload.h"
|
||||
|
||||
namespace android {
|
||||
namespace hardware {
|
||||
namespace bluetooth {
|
||||
namespace a2dp {
|
||||
namespace V1_0 {
|
||||
namespace implementation {
|
||||
|
||||
IBluetoothAudioOffload* HIDL_FETCH_IBluetoothAudioOffload(
|
||||
const char* /* name */) {
|
||||
return new BluetoothAudioOffload();
|
||||
}
|
||||
|
||||
// Methods from
|
||||
// ::android::hardware::bluetooth::a2dp::V1_0::IBluetoothAudioOffload follow.
|
||||
Return<::android::hardware::bluetooth::a2dp::V1_0::Status>
|
||||
BluetoothAudioOffload::startSession(
|
||||
const sp<::android::hardware::bluetooth::a2dp::V1_0::IBluetoothAudioHost>&
|
||||
hostIf __unused,
|
||||
const ::android::hardware::bluetooth::a2dp::V1_0::CodecConfiguration&
|
||||
codecConfig __unused) {
|
||||
/**
|
||||
* Initialize the audio platform if codecConfiguration is supported.
|
||||
* Save the the IBluetoothAudioHost interface, so that it can be used
|
||||
* later to send stream control commands to the HAL client, based on
|
||||
* interaction with Audio framework.
|
||||
*/
|
||||
return ::android::hardware::bluetooth::a2dp::V1_0::Status::FAILURE;
|
||||
}
|
||||
|
||||
Return<void> BluetoothAudioOffload::streamStarted(
|
||||
::android::hardware::bluetooth::a2dp::V1_0::Status status __unused) {
|
||||
/**
|
||||
* Streaming on control path has started,
|
||||
* HAL server should start the streaming on data path.
|
||||
*/
|
||||
return Void();
|
||||
}
|
||||
|
||||
Return<void> BluetoothAudioOffload::streamSuspended(
|
||||
::android::hardware::bluetooth::a2dp::V1_0::Status status __unused) {
|
||||
/**
|
||||
* Streaming on control path has suspend,
|
||||
* HAL server should suspend the streaming on data path.
|
||||
*/
|
||||
return Void();
|
||||
}
|
||||
|
||||
Return<void> BluetoothAudioOffload::endSession() {
|
||||
/**
|
||||
* Cleanup the audio platform as remote A2DP Sink device is no
|
||||
* longer active
|
||||
*/
|
||||
return Void();
|
||||
}
|
||||
|
||||
} // namespace implementation
|
||||
} // namespace V1_0
|
||||
} // namespace a2dp
|
||||
} // namespace bluetooth
|
||||
} // namespace hardware
|
||||
} // namespace android
|
||||
@@ -1,65 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2018 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.
|
||||
*/
|
||||
|
||||
#ifndef ANDROID_HARDWARE_BLUETOOTH_A2DP_V1_0_BLUETOOTHAUDIOOFFLOAD_H
|
||||
#define ANDROID_HARDWARE_BLUETOOTH_A2DP_V1_0_BLUETOOTHAUDIOOFFLOAD_H
|
||||
|
||||
#include <android/hardware/bluetooth/a2dp/1.0/IBluetoothAudioOffload.h>
|
||||
#include <hidl/MQDescriptor.h>
|
||||
#include <hidl/Status.h>
|
||||
|
||||
namespace android {
|
||||
namespace hardware {
|
||||
namespace bluetooth {
|
||||
namespace a2dp {
|
||||
namespace V1_0 {
|
||||
namespace implementation {
|
||||
|
||||
using ::android::sp;
|
||||
using ::android::hardware::hidl_array;
|
||||
using ::android::hardware::hidl_memory;
|
||||
using ::android::hardware::hidl_string;
|
||||
using ::android::hardware::hidl_vec;
|
||||
using ::android::hardware::Return;
|
||||
using ::android::hardware::Void;
|
||||
|
||||
struct BluetoothAudioOffload : public IBluetoothAudioOffload {
|
||||
BluetoothAudioOffload() {}
|
||||
// Methods from
|
||||
// ::android::hardware::bluetooth::a2dp::V1_0::IBluetoothAudioOffload follow.
|
||||
Return<::android::hardware::bluetooth::a2dp::V1_0::Status> startSession(
|
||||
const sp<::android::hardware::bluetooth::a2dp::V1_0::IBluetoothAudioHost>&
|
||||
hostIf,
|
||||
const ::android::hardware::bluetooth::a2dp::V1_0::CodecConfiguration&
|
||||
codecConfig) override;
|
||||
Return<void> streamStarted(
|
||||
::android::hardware::bluetooth::a2dp::V1_0::Status status) override;
|
||||
Return<void> streamSuspended(
|
||||
::android::hardware::bluetooth::a2dp::V1_0::Status status) override;
|
||||
Return<void> endSession() override;
|
||||
};
|
||||
|
||||
extern "C" IBluetoothAudioOffload* HIDL_FETCH_IBluetoothAudioOffload(
|
||||
const char* name);
|
||||
|
||||
} // namespace implementation
|
||||
} // namespace V1_0
|
||||
} // namespace a2dp
|
||||
} // namespace bluetooth
|
||||
} // namespace hardware
|
||||
} // namespace android
|
||||
|
||||
#endif // ANDROID_HARDWARE_BLUETOOTH_A2DP_V1_0_BLUETOOTHAUDIOOFFLOAD_H
|
||||
@@ -1,99 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2018 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.
|
||||
*/
|
||||
|
||||
package android.hardware.bluetooth.a2dp@1.0;
|
||||
|
||||
enum Status : uint8_t {
|
||||
SUCCESS,
|
||||
FAILURE,
|
||||
/** codec configuration not supported by the audio platform */
|
||||
UNSUPPORTED_CODEC_CONFIGURATION ,
|
||||
/** operation is pending */
|
||||
PENDING,
|
||||
};
|
||||
|
||||
enum CodecType : uint32_t {
|
||||
UNKNOWN = 0x00,
|
||||
SBC = 0x01,
|
||||
AAC = 0x02,
|
||||
APTX = 0x04,
|
||||
APTX_HD = 0x08,
|
||||
LDAC = 0x10,
|
||||
};
|
||||
enum SampleRate : uint32_t {
|
||||
RATE_UNKNOWN = 0x00,
|
||||
RATE_44100 = 0x01,
|
||||
RATE_48000 = 0x02,
|
||||
RATE_88200 = 0x04,
|
||||
RATE_96000 = 0x08,
|
||||
RATE_176400 = 0x10,
|
||||
RATE_192000 = 0x20,
|
||||
};
|
||||
enum BitsPerSample : uint8_t {
|
||||
BITS_UNKNOWN = 0x00,
|
||||
BITS_16 = 0x01,
|
||||
BITS_24 = 0x02,
|
||||
BITS_32 = 0x04,
|
||||
};
|
||||
enum ChannelMode : uint8_t {
|
||||
UNKNOWN = 0x00,
|
||||
MONO = 0x01,
|
||||
STEREO = 0x02,
|
||||
};
|
||||
struct CodecConfiguration {
|
||||
/** Bluetooth A2DP codec */
|
||||
CodecType codecType;
|
||||
/** Sampling rate for encoder */
|
||||
SampleRate sampleRate;
|
||||
/** Bits per sample for encoder */
|
||||
BitsPerSample bitsPerSample;
|
||||
/** Channel mode for encoder */
|
||||
ChannelMode channelMode;
|
||||
/**
|
||||
* The encoded audio bitrate in bits / second.
|
||||
* 0x00000000 - The audio bitrate is not specified / unused
|
||||
* 0x00000001 - 0x00FFFFFF - Encoded audio bitrate in bits/second
|
||||
* 0x01000000 - 0xFFFFFFFF - Reserved
|
||||
*/
|
||||
uint32_t encodedAudioBitrate;
|
||||
/** Peer MTU (in octets) */
|
||||
uint16_t peerMtu;
|
||||
union CodecSpecific {
|
||||
/**
|
||||
* SBC Codec specific information
|
||||
* Refer to SBC Codec specific information elements in A2DP v1.3
|
||||
* Profile Specification.
|
||||
*/
|
||||
struct SbcData {
|
||||
/** Block length: 4 bits | Subbands: 2 bits | Allocation Method: 2 bits */
|
||||
uint8_t codecParameters;
|
||||
/** Minimum bitpool value */
|
||||
uint8_t minBitpool;
|
||||
/** Maximum bitpool value */
|
||||
uint8_t maxBitpool;
|
||||
} sbcData;
|
||||
struct LdacData {
|
||||
/**
|
||||
* LDAC bitrate index value:
|
||||
* 0x00 - High
|
||||
* 0x01 - Mid
|
||||
* 0x02 - Low
|
||||
* 0x7F - ABR (Adaptive Bit Rate)
|
||||
*/
|
||||
uint8_t bitrateIndex;
|
||||
} ldacData;
|
||||
} codecSpecific;
|
||||
};
|
||||
@@ -1,4 +0,0 @@
|
||||
# Bug component: 27441
|
||||
include platform/packages/modules/Bluetooth:/OWNERS
|
||||
|
||||
cheneyni@google.com
|
||||
@@ -1,36 +0,0 @@
|
||||
//
|
||||
// Copyright (C) 2018 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.
|
||||
//
|
||||
|
||||
package {
|
||||
// See: http://go/android-license-faq
|
||||
// A large-scale-change added 'default_applicable_licenses' to import
|
||||
// all of the 'license_kinds' from "hardware_interfaces_license"
|
||||
// to get the below license kinds:
|
||||
// SPDX-license-identifier-Apache-2.0
|
||||
default_applicable_licenses: ["hardware_interfaces_license"],
|
||||
}
|
||||
|
||||
cc_test {
|
||||
name: "VtsHalBluetoothA2dpV1_0TargetTest",
|
||||
defaults: ["VtsHalTargetTestDefaults"],
|
||||
srcs: ["VtsHalBluetoothA2dpV1_0TargetTest.cpp"],
|
||||
static_libs: [
|
||||
"android.hardware.bluetooth@1.0",
|
||||
"android.hardware.bluetooth.a2dp@1.0",
|
||||
"libbluetooth-types",
|
||||
],
|
||||
test_suites: ["general-tests", "vts"],
|
||||
}
|
||||
@@ -1,112 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2018 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.
|
||||
*/
|
||||
|
||||
#define LOG_TAG "bluetooth_a2dp_hidl_hal_test"
|
||||
|
||||
#include <android-base/logging.h>
|
||||
#include <android/hardware/bluetooth/a2dp/1.0/IBluetoothAudioHost.h>
|
||||
#include <android/hardware/bluetooth/a2dp/1.0/IBluetoothAudioOffload.h>
|
||||
#include <gtest/gtest.h>
|
||||
#include <hardware/bluetooth.h>
|
||||
#include <hidl/GtestPrinter.h>
|
||||
#include <hidl/MQDescriptor.h>
|
||||
#include <hidl/ServiceManagement.h>
|
||||
#include <utils/Log.h>
|
||||
|
||||
#include <VtsHalHidlTargetCallbackBase.h>
|
||||
|
||||
using ::android::sp;
|
||||
using ::android::hardware::Return;
|
||||
using ::android::hardware::Void;
|
||||
using ::android::hardware::bluetooth::a2dp::V1_0::BitsPerSample;
|
||||
using ::android::hardware::bluetooth::a2dp::V1_0::ChannelMode;
|
||||
using ::android::hardware::bluetooth::a2dp::V1_0::CodecConfiguration;
|
||||
using ::android::hardware::bluetooth::a2dp::V1_0::CodecType;
|
||||
using ::android::hardware::bluetooth::a2dp::V1_0::IBluetoothAudioHost;
|
||||
using ::android::hardware::bluetooth::a2dp::V1_0::IBluetoothAudioOffload;
|
||||
using ::android::hardware::bluetooth::a2dp::V1_0::SampleRate;
|
||||
using ::android::hardware::bluetooth::a2dp::V1_0::Status;
|
||||
|
||||
// The main test class for Bluetooth A2DP HIDL HAL.
|
||||
class BluetoothA2dpHidlTest : public ::testing::TestWithParam<std::string> {
|
||||
public:
|
||||
virtual void SetUp() override {
|
||||
// currently test passthrough mode only
|
||||
audio_offload = IBluetoothAudioOffload::getService(GetParam());
|
||||
ASSERT_NE(audio_offload, nullptr);
|
||||
|
||||
audio_host = new BluetoothAudioHost(*this);
|
||||
ASSERT_NE(audio_host, nullptr);
|
||||
|
||||
codec.codecType = CodecType::AAC;
|
||||
codec.sampleRate = SampleRate::RATE_44100;
|
||||
codec.bitsPerSample = BitsPerSample::BITS_16;
|
||||
codec.channelMode = ChannelMode::STEREO;
|
||||
codec.encodedAudioBitrate = 320000;
|
||||
codec.peerMtu = 1000;
|
||||
}
|
||||
|
||||
virtual void TearDown() override {}
|
||||
|
||||
// A simple test implementation of IBluetoothAudioHost.
|
||||
class BluetoothAudioHost
|
||||
: public ::testing::VtsHalHidlTargetCallbackBase<BluetoothA2dpHidlTest>,
|
||||
public IBluetoothAudioHost {
|
||||
BluetoothA2dpHidlTest& parent_;
|
||||
|
||||
public:
|
||||
BluetoothAudioHost(BluetoothA2dpHidlTest& parent) : parent_(parent){};
|
||||
virtual ~BluetoothAudioHost() = default;
|
||||
|
||||
Return<void> startStream() override {
|
||||
parent_.audio_offload->streamStarted(Status::SUCCESS);
|
||||
return Void();
|
||||
};
|
||||
|
||||
Return<void> suspendStream() override {
|
||||
parent_.audio_offload->streamSuspended(Status::SUCCESS);
|
||||
return Void();
|
||||
};
|
||||
|
||||
Return<void> stopStream() override { return Void(); };
|
||||
};
|
||||
|
||||
// audio_host is for the Audio HAL to send stream start/suspend/stop commands
|
||||
// to Bluetooth
|
||||
sp<IBluetoothAudioHost> audio_host;
|
||||
// audio_offload is for the Bluetooth HAL to report session started/ended and
|
||||
// handled audio stream started/suspended
|
||||
sp<IBluetoothAudioOffload> audio_offload;
|
||||
// codec is the currently used codec
|
||||
CodecConfiguration codec;
|
||||
};
|
||||
|
||||
// Empty test: Initialize()/Close() are called in SetUp()/TearDown().
|
||||
TEST_P(BluetoothA2dpHidlTest, InitializeAndClose) {}
|
||||
|
||||
// Test start and end session
|
||||
TEST_P(BluetoothA2dpHidlTest, StartAndEndSession) {
|
||||
EXPECT_EQ(Status::SUCCESS, audio_offload->startSession(audio_host, codec));
|
||||
audio_offload->endSession();
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
PerInstance, BluetoothA2dpHidlTest,
|
||||
testing::ValuesIn(android::hardware::getAllHalInstanceNames(
|
||||
IBluetoothAudioOffload::descriptor)),
|
||||
android::hardware::PrintInstanceNameToString);
|
||||
|
||||
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(BluetoothA2dpHidlTest);
|
||||
Reference in New Issue
Block a user