Merge "Add tests for isValid methods bcradio HAL utils" into main
diff --git a/audio/aidl/default/Android.bp b/audio/aidl/default/Android.bp
index bfa2783..e65ee77 100644
--- a/audio/aidl/default/Android.bp
+++ b/audio/aidl/default/Android.bp
@@ -118,8 +118,6 @@
cc_binary {
name: "android.hardware.audio.service-aidl.example",
relative_install_path: "hw",
- init_rc: ["android.hardware.audio.service-aidl.example.rc"],
- vintf_fragments: ["android.hardware.audio.service-aidl.xml"],
defaults: [
"aidlaudioservice_defaults",
"latest_android_hardware_audio_core_sounddose_ndk_shared",
@@ -146,6 +144,7 @@
"-Wthread-safety",
"-DBACKEND_NDK",
],
+ installable: false, //installed in apex com.android.hardware.audio
}
cc_test {
@@ -239,10 +238,9 @@
cc_binary {
name: "android.hardware.audio.effect.service-aidl.example",
relative_install_path: "hw",
- init_rc: ["android.hardware.audio.effect.service-aidl.example.rc"],
- vintf_fragments: ["android.hardware.audio.effect.service-aidl.xml"],
defaults: ["aidlaudioeffectservice_defaults"],
shared_libs: [
+ "libapexsupport",
"libtinyxml2",
],
srcs: [
@@ -250,6 +248,7 @@
"EffectFactory.cpp",
"EffectMain.cpp",
],
+ installable: false, //installed in apex com.android.hardware.audio.effect
}
cc_library_headers {
@@ -258,3 +257,22 @@
vendor_available: true,
host_supported: true,
}
+
+prebuilt_etc {
+ name: "android.hardware.audio.service-aidl.example.rc",
+ src: "android.hardware.audio.service-aidl.example.rc",
+ installable: false,
+}
+
+prebuilt_etc {
+ name: "android.hardware.audio.service-aidl.xml",
+ src: "android.hardware.audio.service-aidl.xml",
+ sub_dir: "vintf",
+ installable: false,
+}
+
+prebuilt_etc {
+ name: "audio_effects_config.xml",
+ src: "audio_effects_config.xml",
+ installable: false,
+}
diff --git a/audio/aidl/default/EffectConfig.cpp b/audio/aidl/default/EffectConfig.cpp
index 4a12f8a..1cc4897 100644
--- a/audio/aidl/default/EffectConfig.cpp
+++ b/audio/aidl/default/EffectConfig.cpp
@@ -24,6 +24,10 @@
#include "effectFactory-impl/EffectConfig.h"
+#ifdef __ANDROID_APEX__
+#include <android/apexsupport.h>
+#endif
+
using aidl::android::media::audio::common::AudioSource;
using aidl::android::media::audio::common::AudioStreamType;
using aidl::android::media::audio::common::AudioUuid;
@@ -89,6 +93,24 @@
}
bool EffectConfig::resolveLibrary(const std::string& path, std::string* resolvedPath) {
+ if (__builtin_available(android AAPEXSUPPORT_API, *)) {
+ AApexInfo *apexInfo;
+ if (AApexInfo_create(&apexInfo) == AAPEXINFO_OK) {
+ std::string apexName(AApexInfo_getName(apexInfo));
+ AApexInfo_destroy(apexInfo);
+ std::string candidatePath("/apex/");
+ candidatePath.append(apexName).append(kEffectLibApexPath).append(path);
+ LOG(DEBUG) << __func__ << " effect lib path " << candidatePath;
+ if (access(candidatePath.c_str(), R_OK) == 0) {
+ *resolvedPath = std::move(candidatePath);
+ return true;
+ }
+ }
+ } else {
+ LOG(DEBUG) << __func__ << " libapexsupport is not supported";
+ }
+
+ // If audio effects libs are not in vendor apex, locate them in kEffectLibPath
for (auto* libraryDirectory : kEffectLibPath) {
std::string candidatePath = std::string(libraryDirectory) + '/' + path;
if (access(candidatePath.c_str(), R_OK) == 0) {
diff --git a/audio/aidl/default/EffectMain.cpp b/audio/aidl/default/EffectMain.cpp
index ca81204..ac178b6 100644
--- a/audio/aidl/default/EffectMain.cpp
+++ b/audio/aidl/default/EffectMain.cpp
@@ -21,15 +21,39 @@
#include <android/binder_process.h>
#include <system/audio_config.h>
+#ifdef __ANDROID_APEX__
+#include <android/apexsupport.h>
+#endif
+
/** Default name of effect configuration file. */
static const char* kDefaultConfigName = "audio_effects_config.xml";
+static inline std::string config_file_path() {
+ if (__builtin_available(android AAPEXSUPPORT_API, *)) {
+ AApexInfo *apexInfo;
+ if (AApexInfo_create(&apexInfo) == AAPEXINFO_OK) {
+ std::string apexName(AApexInfo_getName(apexInfo));
+ AApexInfo_destroy(apexInfo);
+ std::string candidatePath("/apex/");
+ candidatePath.append(apexName).append("/etc/").append(kDefaultConfigName);
+ LOG(DEBUG) << __func__ << " effect lib path " << candidatePath;
+ if (access(candidatePath.c_str(), R_OK) == 0) {
+ return std::move(candidatePath);
+ }
+ }
+ } else {
+ LOG(DEBUG) << __func__ << " libapexsupport is not supported";
+ }
+ LOG(DEBUG) << __func__ << ": Unable to resolve config file path in APEX";
+ return android::audio_find_readable_configuration_file(kDefaultConfigName);
+}
+
int main() {
// This is a debug implementation, always enable debug logging.
android::base::SetMinimumLogSeverity(::android::base::DEBUG);
ABinderProcess_setThreadPoolMaxThreadCount(0);
- auto configFile = android::audio_find_readable_configuration_file(kDefaultConfigName);
+ auto configFile = config_file_path();
if (configFile == "") {
LOG(ERROR) << __func__ << ": config file " << kDefaultConfigName << " not found!";
return EXIT_FAILURE;
diff --git a/audio/aidl/default/acousticEchoCanceler/Android.bp b/audio/aidl/default/acousticEchoCanceler/Android.bp
index 35d4a56..d0404cd 100644
--- a/audio/aidl/default/acousticEchoCanceler/Android.bp
+++ b/audio/aidl/default/acousticEchoCanceler/Android.bp
@@ -34,6 +34,6 @@
],
relative_install_path: "soundfx",
visibility: [
- "//hardware/interfaces/audio/aidl/default",
+ "//hardware/interfaces/audio/aidl/default:__subpackages__",
],
}
diff --git a/audio/aidl/default/android.hardware.audio.effect.service-aidl.example.rc b/audio/aidl/default/android.hardware.audio.effect.service-aidl.example.rc
deleted file mode 100644
index 5f859a1..0000000
--- a/audio/aidl/default/android.hardware.audio.effect.service-aidl.example.rc
+++ /dev/null
@@ -1,11 +0,0 @@
-service vendor.audio-effect-hal-aidl /vendor/bin/hw/android.hardware.audio.effect.service-aidl.example
- class hal
- user audioserver
- # media gid needed for /dev/fm (radio) and for /data/misc/media (tee)
- group audio media
- capabilities BLOCK_SUSPEND
- # setting RLIMIT_RTPRIO allows binder RT priority inheritance
- rlimit rtprio 10 10
- ioprio rt 4
- task_profiles ProcessCapacityHigh HighPerformance
- onrestart restart audioserver
diff --git a/audio/aidl/default/android.hardware.audio.effect.service-aidl.xml b/audio/aidl/default/android.hardware.audio.effect.service-aidl.xml
deleted file mode 100644
index 05a825d..0000000
--- a/audio/aidl/default/android.hardware.audio.effect.service-aidl.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-<manifest version="1.0" type="device">
- <hal format="aidl">
- <name>android.hardware.audio.effect</name>
- <version>2</version>
- <fqname>IFactory/default</fqname>
- </hal>
-</manifest>
diff --git a/audio/aidl/default/android.hardware.audio.service-aidl.example.rc b/audio/aidl/default/android.hardware.audio.service-aidl.example.rc
index 757976f..c3e19ba 100644
--- a/audio/aidl/default/android.hardware.audio.service-aidl.example.rc
+++ b/audio/aidl/default/android.hardware.audio.service-aidl.example.rc
@@ -1,4 +1,5 @@
-service vendor.audio-hal-aidl /vendor/bin/hw/android.hardware.audio.service-aidl.example
+
+service vendor.audio-hal-aidl /apex/com.android.hardware.audio/bin/hw/android.hardware.audio.service-aidl.example
class hal
user audioserver
# media gid needed for /dev/fm (radio) and for /data/misc/media (tee)
@@ -9,3 +10,15 @@
ioprio rt 4
task_profiles ProcessCapacityHigh HighPerformance
onrestart restart audioserver
+
+service vendor.audio-effect-hal-aidl /apex/com.android.hardware.audio/bin/hw/android.hardware.audio.effect.service-aidl.example
+ class hal
+ user audioserver
+ # media gid needed for /dev/fm (radio) and for /data/misc/media (tee)
+ group audio media
+ capabilities BLOCK_SUSPEND
+ # setting RLIMIT_RTPRIO allows binder RT priority inheritance
+ rlimit rtprio 10 10
+ ioprio rt 4
+ task_profiles ProcessCapacityHigh HighPerformance
+ onrestart restart audioserver
\ No newline at end of file
diff --git a/audio/aidl/default/android.hardware.audio.service-aidl.xml b/audio/aidl/default/android.hardware.audio.service-aidl.xml
index 2a51876..5278e4f 100644
--- a/audio/aidl/default/android.hardware.audio.service-aidl.xml
+++ b/audio/aidl/default/android.hardware.audio.service-aidl.xml
@@ -31,4 +31,9 @@
<fqname>IModule/usb</fqname>
</hal>
-->
+ <hal format="aidl">
+ <name>android.hardware.audio.effect</name>
+ <version>2</version>
+ <fqname>IFactory/default</fqname>
+ </hal>
</manifest>
diff --git a/audio/aidl/default/apex/com.android.hardware.audio/Android.bp b/audio/aidl/default/apex/com.android.hardware.audio/Android.bp
new file mode 100644
index 0000000..da84412
--- /dev/null
+++ b/audio/aidl/default/apex/com.android.hardware.audio/Android.bp
@@ -0,0 +1,49 @@
+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"],
+}
+
+apex {
+ name: "com.android.hardware.audio",
+ manifest: "manifest.json",
+ file_contexts: "file_contexts",
+ key: "com.android.hardware.key",
+ certificate: ":com.android.hardware.certificate",
+ updatable: false,
+ vendor: true,
+
+ binaries: [
+ "android.hardware.audio.service-aidl.example",
+ "android.hardware.audio.effect.service-aidl.example",
+ ],
+ native_shared_libs: [
+ "libaecsw",
+ "libagc1sw",
+ "libagc2sw",
+ "libbassboostsw",
+ "libbundleaidl",
+ "libdownmixaidl",
+ "libdynamicsprocessingaidl",
+ "libenvreverbsw",
+ "libequalizersw",
+ "libextensioneffect",
+ "libhapticgeneratoraidl",
+ "libloudnessenhanceraidl",
+ "libnssw",
+ "libpreprocessingaidl",
+ "libpresetreverbsw",
+ "libreverbaidl",
+ "libvirtualizersw",
+ "libvisualizeraidl",
+ "libvolumesw",
+ ],
+ prebuilts: [
+ "android.hardware.audio.service-aidl.example.rc",
+ "android.hardware.audio.service-aidl.xml",
+ "audio_effects_config.xml",
+ ],
+}
diff --git a/audio/aidl/default/apex/com.android.hardware.audio/file_contexts b/audio/aidl/default/apex/com.android.hardware.audio/file_contexts
new file mode 100644
index 0000000..41a6ada
--- /dev/null
+++ b/audio/aidl/default/apex/com.android.hardware.audio/file_contexts
@@ -0,0 +1,4 @@
+(/.*)? u:object_r:vendor_file:s0
+/etc(/.*)? u:object_r:vendor_configs_file:s0
+/bin/hw/android\.hardware\.audio\.service-aidl\.example u:object_r:hal_audio_default_exec:s0
+/bin/hw/android\.hardware\.audio\.effect\.service-aidl\.example u:object_r:hal_audio_default_exec:s0
\ No newline at end of file
diff --git a/audio/aidl/default/apex/com.android.hardware.audio/manifest.json b/audio/aidl/default/apex/com.android.hardware.audio/manifest.json
new file mode 100644
index 0000000..42a2368
--- /dev/null
+++ b/audio/aidl/default/apex/com.android.hardware.audio/manifest.json
@@ -0,0 +1,4 @@
+{
+ "name": "com.android.hardware.audio",
+ "version": 1
+}
diff --git a/audio/aidl/default/automaticGainControlV1/Android.bp b/audio/aidl/default/automaticGainControlV1/Android.bp
index 05c2c54..7b753eb 100644
--- a/audio/aidl/default/automaticGainControlV1/Android.bp
+++ b/audio/aidl/default/automaticGainControlV1/Android.bp
@@ -34,6 +34,6 @@
],
relative_install_path: "soundfx",
visibility: [
- "//hardware/interfaces/audio/aidl/default",
+ "//hardware/interfaces/audio/aidl/default:__subpackages__",
],
}
diff --git a/audio/aidl/default/automaticGainControlV2/Android.bp b/audio/aidl/default/automaticGainControlV2/Android.bp
index dedc555..ea05152 100644
--- a/audio/aidl/default/automaticGainControlV2/Android.bp
+++ b/audio/aidl/default/automaticGainControlV2/Android.bp
@@ -34,6 +34,6 @@
],
relative_install_path: "soundfx",
visibility: [
- "//hardware/interfaces/audio/aidl/default",
+ "//hardware/interfaces/audio/aidl/default:__subpackages__",
],
}
diff --git a/audio/aidl/default/bassboost/Android.bp b/audio/aidl/default/bassboost/Android.bp
index 9f47770..8f53eae 100644
--- a/audio/aidl/default/bassboost/Android.bp
+++ b/audio/aidl/default/bassboost/Android.bp
@@ -34,6 +34,6 @@
],
relative_install_path: "soundfx",
visibility: [
- "//hardware/interfaces/audio/aidl/default",
+ "//hardware/interfaces/audio/aidl/default:__subpackages__",
],
}
diff --git a/audio/aidl/default/envReverb/Android.bp b/audio/aidl/default/envReverb/Android.bp
index 2443c2a..23495f1 100644
--- a/audio/aidl/default/envReverb/Android.bp
+++ b/audio/aidl/default/envReverb/Android.bp
@@ -34,6 +34,6 @@
],
relative_install_path: "soundfx",
visibility: [
- "//hardware/interfaces/audio/aidl/default",
+ "//hardware/interfaces/audio/aidl/default:__subpackages__",
],
}
diff --git a/audio/aidl/default/equalizer/Android.bp b/audio/aidl/default/equalizer/Android.bp
index 42708d1..1d29d40 100644
--- a/audio/aidl/default/equalizer/Android.bp
+++ b/audio/aidl/default/equalizer/Android.bp
@@ -34,6 +34,6 @@
],
relative_install_path: "soundfx",
visibility: [
- "//hardware/interfaces/audio/aidl/default",
+ "//hardware/interfaces/audio/aidl/default:__subpackages__",
],
}
diff --git a/audio/aidl/default/extension/Android.bp b/audio/aidl/default/extension/Android.bp
index 5fee479..2b21e3e 100644
--- a/audio/aidl/default/extension/Android.bp
+++ b/audio/aidl/default/extension/Android.bp
@@ -34,6 +34,6 @@
],
relative_install_path: "soundfx",
visibility: [
- "//hardware/interfaces/audio/aidl/default",
+ "//hardware/interfaces/audio/aidl/default:__subpackages__",
],
}
diff --git a/audio/aidl/default/include/effectFactory-impl/EffectConfig.h b/audio/aidl/default/include/effectFactory-impl/EffectConfig.h
index 344846a..7456b99 100644
--- a/audio/aidl/default/include/effectFactory-impl/EffectConfig.h
+++ b/audio/aidl/default/include/effectFactory-impl/EffectConfig.h
@@ -64,12 +64,16 @@
const ProcessingLibrariesMap& getProcessingMap() const;
private:
- static constexpr const char* kEffectLibPath[] =
#ifdef __LP64__
- {"/odm/lib64/soundfx", "/vendor/lib64/soundfx", "/system/lib64/soundfx"};
+#define SOUND_FX_PATH "/lib64/soundfx/"
#else
- {"/odm/lib/soundfx", "/vendor/lib/soundfx", "/system/lib/soundfx"};
+#define SOUND_FX_PATH "/lib/soundfx/"
#endif
+ static constexpr const char* kEffectLibPath[] =
+ { "/odm" SOUND_FX_PATH, "/vendor" SOUND_FX_PATH, "/system" SOUND_FX_PATH };
+
+ static constexpr const char* kEffectLibApexPath = SOUND_FX_PATH;
+#undef SOUND_FX_PATH
int mSkippedElements;
/* Parsed Libraries result */
diff --git a/audio/aidl/default/noiseSuppression/Android.bp b/audio/aidl/default/noiseSuppression/Android.bp
index f24ded6..5729571 100644
--- a/audio/aidl/default/noiseSuppression/Android.bp
+++ b/audio/aidl/default/noiseSuppression/Android.bp
@@ -34,6 +34,6 @@
],
relative_install_path: "soundfx",
visibility: [
- "//hardware/interfaces/audio/aidl/default",
+ "//hardware/interfaces/audio/aidl/default:__subpackages__",
],
}
diff --git a/audio/aidl/default/presetReverb/Android.bp b/audio/aidl/default/presetReverb/Android.bp
index d600141..2a2ae75 100644
--- a/audio/aidl/default/presetReverb/Android.bp
+++ b/audio/aidl/default/presetReverb/Android.bp
@@ -34,6 +34,6 @@
],
relative_install_path: "soundfx",
visibility: [
- "//hardware/interfaces/audio/aidl/default",
+ "//hardware/interfaces/audio/aidl/default:__subpackages__",
],
}
diff --git a/audio/aidl/default/virtualizer/Android.bp b/audio/aidl/default/virtualizer/Android.bp
index 1c41bb5..5d59f7c 100644
--- a/audio/aidl/default/virtualizer/Android.bp
+++ b/audio/aidl/default/virtualizer/Android.bp
@@ -34,6 +34,6 @@
],
relative_install_path: "soundfx",
visibility: [
- "//hardware/interfaces/audio/aidl/default",
+ "//hardware/interfaces/audio/aidl/default:__subpackages__",
],
}
diff --git a/audio/aidl/default/volume/Android.bp b/audio/aidl/default/volume/Android.bp
index f1a051f..8d5401a 100644
--- a/audio/aidl/default/volume/Android.bp
+++ b/audio/aidl/default/volume/Android.bp
@@ -34,6 +34,6 @@
],
relative_install_path: "soundfx",
visibility: [
- "//hardware/interfaces/audio/aidl/default",
+ "//hardware/interfaces/audio/aidl/default:__subpackages__",
],
}
diff --git a/automotive/evs/1.1/vts/functional/VtsHalEvsV1_1TargetTest.cpp b/automotive/evs/1.1/vts/functional/VtsHalEvsV1_1TargetTest.cpp
index 03f256e..ff7f41c 100644
--- a/automotive/evs/1.1/vts/functional/VtsHalEvsV1_1TargetTest.cpp
+++ b/automotive/evs/1.1/vts/functional/VtsHalEvsV1_1TargetTest.cpp
@@ -2010,6 +2010,13 @@
// Test each reported camera
for (auto&& cam: cameraInfo) {
+ bool isLogicalCam = false;
+ getPhysicalCameraIds(cam.v1.cameraId, isLogicalCam);
+ if (isLogicalCam) {
+ LOG(INFO) << "Skip a logical device " << cam.v1.cameraId;
+ continue;
+ }
+
// Request exclusive access to the EVS display
sp<IEvsDisplay_1_0> pDisplay = pEnumerator->openDisplay();
ASSERT_NE(pDisplay, nullptr);
diff --git a/automotive/evs/aidl/impl/default/src/EvsVideoEmulatedCamera.cpp b/automotive/evs/aidl/impl/default/src/EvsVideoEmulatedCamera.cpp
index 8181e47..e3f7b5e 100644
--- a/automotive/evs/aidl/impl/default/src/EvsVideoEmulatedCamera.cpp
+++ b/automotive/evs/aidl/impl/default/src/EvsVideoEmulatedCamera.cpp
@@ -222,10 +222,9 @@
// Lock our output buffer for writing
uint8_t* pixels = nullptr;
- int32_t bytesPerStride = 0;
auto& mapper = ::android::GraphicBufferMapper::get();
mapper.lock(renderBufferHandle, GRALLOC_USAGE_SW_WRITE_OFTEN | GRALLOC_USAGE_SW_READ_NEVER,
- ::android::Rect(mWidth, mHeight), (void**)&pixels, nullptr, &bytesPerStride);
+ ::android::Rect(mWidth, mHeight), (void**)&pixels);
// If we failed to lock the pixel buffer, we're about to crash, but log it first
if (!pixels) {
@@ -247,13 +246,6 @@
*(pixels++) = *(v_head++);
}
- const auto status =
- AMediaCodec_releaseOutputBuffer(mVideoCodec.get(), index, /* render = */ false);
- if (status != AMEDIA_OK) {
- LOG(ERROR) << __func__
- << ": Received error in releasing output buffer. Error code: " << status;
- }
-
// Release our output buffer
mapper.unlock(renderBufferHandle);
@@ -306,6 +298,12 @@
return;
}
onCodecOutputAvailable(codecOutputputBufferIdx, info);
+ const auto release_status = AMediaCodec_releaseOutputBuffer(
+ mVideoCodec.get(), codecOutputputBufferIdx, /* render = */ false);
+ if (release_status != AMEDIA_OK) {
+ LOG(ERROR) << __func__
+ << ": Received error in releasing output buffer. Error code: " << release_status;
+ }
}
void EvsVideoEmulatedCamera::initializeParameters() {
diff --git a/automotive/vehicle/aidl/impl/vhal/vhal-default-service.xml b/automotive/vehicle/aidl/impl/vhal/vhal-default-service.xml
index 9834cdb..b0c6ae7 100644
--- a/automotive/vehicle/aidl/impl/vhal/vhal-default-service.xml
+++ b/automotive/vehicle/aidl/impl/vhal/vhal-default-service.xml
@@ -1,7 +1,7 @@
<manifest version="1.0" type="device">
<hal format="aidl">
<name>android.hardware.automotive.vehicle</name>
- <version>2</version>
+ <version>3</version>
<fqname>IVehicle/default</fqname>
</hal>
</manifest>
diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/CodecParameters.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/CodecParameters.aidl
index 60cf82a..ac63c28 100644
--- a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/CodecParameters.aidl
+++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/CodecParameters.aidl
@@ -39,7 +39,7 @@
int bitdepth;
int minBitrate;
int maxBitrate;
- boolean lowLatency;
- boolean lossless;
+ boolean lowLatency = false;
+ boolean lossless = false;
byte[] vendorSpecificParameters;
}
diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/CodecSpecificCapabilitiesLtv.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/CodecSpecificCapabilitiesLtv.aidl
index 1049d98..60c276b 100644
--- a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/CodecSpecificCapabilitiesLtv.aidl
+++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/CodecSpecificCapabilitiesLtv.aidl
@@ -74,8 +74,8 @@
const int EIGHT = 0x80;
}
parcelable SupportedOctetsPerCodecFrame {
- int minimum;
- int maximum;
+ int min;
+ int max;
}
parcelable SupportedMaxCodecFramesPerSDU {
int value;
diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/ConfigurationFlags.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/ConfigurationFlags.aidl
index baf0a4e..6b3cf72 100644
--- a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/ConfigurationFlags.aidl
+++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/ConfigurationFlags.aidl
@@ -38,8 +38,8 @@
const int NONE = 0x0000;
const int LOSSLESS = 0x0001;
const int LOW_LATENCY = 0x0002;
- const int ALLOW_ASYMMETRIC_CONFIGURATIONS = 0x0003;
- const int SPATIAL_AUDIO = 0x0004;
- const int PROVIDE_ASE_METADATA = 0x0005;
- const int MONO_MIC_CONFIGURATION = 0x0006;
+ const int ALLOW_ASYMMETRIC_CONFIGURATIONS = 0x0004;
+ const int SPATIAL_AUDIO = 0x0008;
+ const int PROVIDE_ASE_METADATA = 0x0010;
+ const int MONO_MIC_CONFIGURATION = 0x0020;
}
diff --git a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/IBluetoothAudioProvider.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/IBluetoothAudioProvider.aidl
index 87401ff..8d46c01 100644
--- a/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/IBluetoothAudioProvider.aidl
+++ b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/IBluetoothAudioProvider.aidl
@@ -41,15 +41,17 @@
void updateAudioConfiguration(in android.hardware.bluetooth.audio.AudioConfiguration audioConfig);
void setLowLatencyModeAllowed(in boolean allowed);
android.hardware.bluetooth.audio.A2dpStatus parseA2dpConfiguration(in android.hardware.bluetooth.audio.CodecId codecId, in byte[] configuration, out android.hardware.bluetooth.audio.CodecParameters codecParameters);
- @nullable android.hardware.bluetooth.audio.A2dpConfiguration getA2dpConfiguration(in List<android.hardware.bluetooth.audio.A2dpRemoteCapabilities> remoteA2dpCapabilities, in android.hardware.bluetooth.audio.A2dpConfigurationHint hint);
+ @nullable android.hardware.bluetooth.audio.A2dpConfiguration getA2dpConfiguration(in android.hardware.bluetooth.audio.A2dpRemoteCapabilities[] remoteA2dpCapabilities, in android.hardware.bluetooth.audio.A2dpConfigurationHint hint);
void setCodecPriority(in android.hardware.bluetooth.audio.CodecId codecId, int priority);
- List<android.hardware.bluetooth.audio.IBluetoothAudioProvider.LeAudioAseConfigurationSetting> getLeAudioAseConfiguration(in @nullable List<android.hardware.bluetooth.audio.IBluetoothAudioProvider.LeAudioDeviceCapabilities> remoteSinkAudioCapabilities, in @nullable List<android.hardware.bluetooth.audio.IBluetoothAudioProvider.LeAudioDeviceCapabilities> remoteSourceAudioCapabilities, in List<android.hardware.bluetooth.audio.IBluetoothAudioProvider.LeAudioConfigurationRequirement> requirements);
+ android.hardware.bluetooth.audio.IBluetoothAudioProvider.LeAudioAseConfigurationSetting[] getLeAudioAseConfiguration(in @nullable android.hardware.bluetooth.audio.IBluetoothAudioProvider.LeAudioDeviceCapabilities[] remoteSinkAudioCapabilities, in @nullable android.hardware.bluetooth.audio.IBluetoothAudioProvider.LeAudioDeviceCapabilities[] remoteSourceAudioCapabilities, in android.hardware.bluetooth.audio.IBluetoothAudioProvider.LeAudioConfigurationRequirement[] requirements);
android.hardware.bluetooth.audio.IBluetoothAudioProvider.LeAudioAseQosConfigurationPair getLeAudioAseQosConfiguration(in android.hardware.bluetooth.audio.IBluetoothAudioProvider.LeAudioAseQosConfigurationRequirement qosRequirement);
android.hardware.bluetooth.audio.IBluetoothAudioProvider.LeAudioDataPathConfigurationPair getLeAudioAseDatapathConfiguration(in @nullable android.hardware.bluetooth.audio.IBluetoothAudioProvider.StreamConfig sinkConfig, in @nullable android.hardware.bluetooth.audio.IBluetoothAudioProvider.StreamConfig sourceConfig);
void onSinkAseMetadataChanged(in android.hardware.bluetooth.audio.IBluetoothAudioProvider.AseState state, int cigId, int cisId, in @nullable android.hardware.bluetooth.audio.MetadataLtv[] metadata);
void onSourceAseMetadataChanged(in android.hardware.bluetooth.audio.IBluetoothAudioProvider.AseState state, int cigId, int cisId, in @nullable android.hardware.bluetooth.audio.MetadataLtv[] metadata);
- android.hardware.bluetooth.audio.IBluetoothAudioProvider.LeAudioBroadcastConfigurationSetting getLeAudioBroadcastConfiguration(in @nullable List<android.hardware.bluetooth.audio.IBluetoothAudioProvider.LeAudioDeviceCapabilities> remoteSinkAudioCapabilities, in android.hardware.bluetooth.audio.IBluetoothAudioProvider.LeAudioBroadcastConfigurationRequirement requirement);
- android.hardware.bluetooth.audio.IBluetoothAudioProvider.LeAudioDataPathConfiguration getLeAudioBroadcastDatapathConfiguration(in android.hardware.bluetooth.audio.AudioContext context, in android.hardware.bluetooth.audio.LeAudioBroadcastConfiguration.BroadcastStreamMap[] streamMap);
+ android.hardware.bluetooth.audio.IBluetoothAudioProvider.LeAudioBroadcastConfigurationSetting getLeAudioBroadcastConfiguration(in @nullable android.hardware.bluetooth.audio.IBluetoothAudioProvider.LeAudioDeviceCapabilities[] remoteSinkAudioCapabilities, in android.hardware.bluetooth.audio.IBluetoothAudioProvider.LeAudioBroadcastConfigurationRequirement requirement);
+ android.hardware.bluetooth.audio.IBluetoothAudioProvider.LeAudioDataPathConfiguration getLeAudioBroadcastDatapathConfiguration(in android.hardware.bluetooth.audio.AudioContext audioContext, in android.hardware.bluetooth.audio.LeAudioBroadcastConfiguration.BroadcastStreamMap[] streamMap);
+ const int CODEC_PRIORITY_DISABLED = (-1) /* -1 */;
+ const int CODEC_PRIORITY_NONE = 0;
@VintfStability
parcelable LeAudioDeviceCapabilities {
android.hardware.bluetooth.audio.CodecId codecId;
@@ -97,8 +99,8 @@
parcelable LeAudioAseConfigurationSetting {
android.hardware.bluetooth.audio.AudioContext audioContext;
android.hardware.bluetooth.audio.IBluetoothAudioProvider.Packing packing;
- @nullable List<android.hardware.bluetooth.audio.IBluetoothAudioProvider.LeAudioAseConfigurationSetting.AseDirectionConfiguration> sinkAseConfiguration;
- @nullable List<android.hardware.bluetooth.audio.IBluetoothAudioProvider.LeAudioAseConfigurationSetting.AseDirectionConfiguration> sourceAseConfiguration;
+ @nullable android.hardware.bluetooth.audio.IBluetoothAudioProvider.LeAudioAseConfigurationSetting.AseDirectionConfiguration[] sinkAseConfiguration;
+ @nullable android.hardware.bluetooth.audio.IBluetoothAudioProvider.LeAudioAseConfigurationSetting.AseDirectionConfiguration[] sourceAseConfiguration;
@nullable android.hardware.bluetooth.audio.ConfigurationFlags flags;
@VintfStability
parcelable AseDirectionConfiguration {
@@ -110,8 +112,8 @@
@VintfStability
parcelable LeAudioConfigurationRequirement {
android.hardware.bluetooth.audio.AudioContext audioContext;
- @nullable List<android.hardware.bluetooth.audio.IBluetoothAudioProvider.LeAudioConfigurationRequirement.AseDirectionRequirement> sinkAseRequirement;
- @nullable List<android.hardware.bluetooth.audio.IBluetoothAudioProvider.LeAudioConfigurationRequirement.AseDirectionRequirement> sourceAseRequirement;
+ @nullable android.hardware.bluetooth.audio.IBluetoothAudioProvider.LeAudioConfigurationRequirement.AseDirectionRequirement[] sinkAseRequirement;
+ @nullable android.hardware.bluetooth.audio.IBluetoothAudioProvider.LeAudioConfigurationRequirement.AseDirectionRequirement[] sourceAseRequirement;
@nullable android.hardware.bluetooth.audio.ConfigurationFlags flags;
@VintfStability
parcelable AseDirectionRequirement {
@@ -120,7 +122,7 @@
}
@VintfStability
parcelable LeAudioAseQosConfigurationRequirement {
- android.hardware.bluetooth.audio.AudioContext contextType;
+ android.hardware.bluetooth.audio.AudioContext audioContext;
@nullable android.hardware.bluetooth.audio.IBluetoothAudioProvider.LeAudioAseQosConfigurationRequirement.AseQosDirectionRequirement sinkAseQosRequirement;
@nullable android.hardware.bluetooth.audio.IBluetoothAudioProvider.LeAudioAseQosConfigurationRequirement.AseQosDirectionRequirement sourceAseQosRequirement;
@nullable android.hardware.bluetooth.audio.ConfigurationFlags flags;
@@ -147,7 +149,7 @@
@nullable android.hardware.bluetooth.audio.IBluetoothAudioProvider.LeAudioDataPathConfiguration outputConfig;
}
parcelable StreamConfig {
- android.hardware.bluetooth.audio.AudioContext context;
+ android.hardware.bluetooth.audio.AudioContext audioContext;
android.hardware.bluetooth.audio.LeAudioConfiguration.StreamMap[] streamMap;
}
@Backing(type="byte") @VintfStability
@@ -163,13 +165,13 @@
}
@VintfStability
parcelable LeAudioBroadcastSubgroupConfigurationRequirement {
- android.hardware.bluetooth.audio.AudioContext context;
+ android.hardware.bluetooth.audio.AudioContext audioContext;
android.hardware.bluetooth.audio.IBluetoothAudioProvider.BroadcastQuality quality;
int bisNumPerSubgroup;
}
@VintfStability
parcelable LeAudioBroadcastConfigurationRequirement {
- List<android.hardware.bluetooth.audio.IBluetoothAudioProvider.LeAudioBroadcastSubgroupConfigurationRequirement> subgroupConfigurationRequirements;
+ android.hardware.bluetooth.audio.IBluetoothAudioProvider.LeAudioBroadcastSubgroupConfigurationRequirement[] subgroupConfigurationRequirements;
}
@VintfStability
parcelable LeAudioSubgroupBisConfiguration {
@@ -178,7 +180,7 @@
}
@VintfStability
parcelable LeAudioBroadcastSubgroupConfiguration {
- List<android.hardware.bluetooth.audio.IBluetoothAudioProvider.LeAudioSubgroupBisConfiguration> bisConfigurations;
+ android.hardware.bluetooth.audio.IBluetoothAudioProvider.LeAudioSubgroupBisConfiguration[] bisConfigurations;
@nullable byte[] vendorCodecConfiguration;
}
@VintfStability
@@ -192,6 +194,6 @@
android.hardware.bluetooth.audio.IBluetoothAudioProvider.Packing packing;
android.hardware.bluetooth.audio.IBluetoothAudioProvider.Framing framing;
@nullable android.hardware.bluetooth.audio.IBluetoothAudioProvider.LeAudioDataPathConfiguration dataPathConfiguration;
- List<android.hardware.bluetooth.audio.IBluetoothAudioProvider.LeAudioBroadcastSubgroupConfiguration> subgroupsConfigurations;
+ android.hardware.bluetooth.audio.IBluetoothAudioProvider.LeAudioBroadcastSubgroupConfiguration[] subgroupsConfigurations;
}
}
diff --git a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/A2dpConfiguration.aidl b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/A2dpConfiguration.aidl
index a7fd9ff..db5212f 100644
--- a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/A2dpConfiguration.aidl
+++ b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/A2dpConfiguration.aidl
@@ -26,6 +26,7 @@
parcelable A2dpConfiguration {
/**
* Remote Stream Endpoint Identifier
+ * This matches `A2dpRemoteCapabilities.seid` given by the framework.
*/
int remoteSeid;
@@ -35,7 +36,7 @@
* `configuration`. Using `id.a2dp`, the format is given by the `Codec
* Specific Information Elements` [A2DP - 4.3-6.2], and using `id.vendor`,
* by `Vendor Specific Value` [A2DP - 4.7.2].
- * In any case, this byte array is limited by the framework to 128 Bytes.
+ * In any case, this byte array must be limited to 128 bytes.
*/
CodecId id;
CodecParameters parameters;
diff --git a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/A2dpRemoteCapabilities.aidl b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/A2dpRemoteCapabilities.aidl
index 87277f1..224bb60 100644
--- a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/A2dpRemoteCapabilities.aidl
+++ b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/A2dpRemoteCapabilities.aidl
@@ -25,6 +25,8 @@
parcelable A2dpRemoteCapabilities {
/**
* Remote Stream Endpoint identifier
+ * Allocated by the remote device to identify a specific codec and capabilities,
+ * in the meaning of the AVDTP standard.
*/
int seid;
diff --git a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/A2dpStreamConfiguration.aidl b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/A2dpStreamConfiguration.aidl
index 2a0c4d8..b8521f4 100644
--- a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/A2dpStreamConfiguration.aidl
+++ b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/A2dpStreamConfiguration.aidl
@@ -21,7 +21,9 @@
@VintfStability
parcelable A2dpStreamConfiguration {
/**
- * Peer MTU (16 bits)
+ * Peer Maximum Transfer Unit (MTU), 16 bits value [Core - 3.A.5.1]
+ * It's the remote device indication of the maximum amount of data that
+ * can be received on the AVDTP Stream Channel.
*/
int peerMtu;
@@ -29,6 +31,7 @@
* Optional SCMS-T Content Protection header
* that precedes audio content when enabled [A2DP - 3.2.1-2].
* The content protection byte is defined by [Assigned Number - 6.3.2].
+ * When the content protection is not enabled, this field should be left `null`.
*/
@nullable byte[1] cpHeaderScmst;
diff --git a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/CodecId.aidl b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/CodecId.aidl
index 896a712..2243957 100644
--- a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/CodecId.aidl
+++ b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/CodecId.aidl
@@ -32,7 +32,7 @@
/**
* Vendor Codec:
- * id 16 bits - Assigned by BT Sig
+ * id 16 bits - Vendor identifier, assigned by BT Sig [Assigned Numbers - 7.1]
* codecId 16 bits - Assigned by the vendor
*/
parcelable Vendor {
diff --git a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/CodecInfo.aidl b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/CodecInfo.aidl
index 33f0c04..b60d70f 100644
--- a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/CodecInfo.aidl
+++ b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/CodecInfo.aidl
@@ -26,9 +26,12 @@
@VintfStability
parcelable CodecInfo {
/**
- * Codec identifier and human readable name
+ * Codec identifier
*/
CodecId id;
+ /**
+ * Human readable name used to present codec to the user and for debug logs
+ */
String name;
/**
@@ -92,17 +95,18 @@
*/
parcelable LeAudio {
/**
- * Channel configuration: Mono, Dual-Mono or Stereo
+ * List of independently supported channel modes: Mono, Dual-Mono, or
+ * Stereo.
*/
ChannelMode[] channelMode;
/**
- * Supported sampling frequencies, in Hz.
+ * List of supported sampling frequencies, in Hz.
*/
int[] samplingFrequencyHz;
- /*
- * FrameDuration in microseconds.
+ /**
+ * List of supported FrameDurations in microseconds.
*/
int[] frameDurationUs;
diff --git a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/CodecParameters.aidl b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/CodecParameters.aidl
index b6f8a94..37f8942 100644
--- a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/CodecParameters.aidl
+++ b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/CodecParameters.aidl
@@ -35,24 +35,29 @@
int bitdepth;
/**
- * Encoding parameters:
- *
- * - Bitrate limits on a frame basis, defined in bits per second.
- * The encoder bitrate mode can be encoded following this rule:
- * . minBitrate equals to maxBitrate for constant bitrate
- * . minBitrate set to 0, for VBR with peak bitrate at maxBitratre value.
- * . minBitrate greater than 0, for ABR, the bitrate of the stream varies
- * between minBitrate to maxBitrate according to link quality.
- * The 0 value for both means "undefined" or "don't care".
- *
- * - Low-latency configuration privileged
- * - Lossless effort indication. The 'False' value can be used as "don't care"
+ * Bitrate limits on a frame basis, defined in bits per second.
+ * The encoder bitrate mode can be encoded following this rule:
+ * . minBitrate equals to maxBitrate for constant bitrate
+ * . minBitrate set to 0, for VBR with peak bitrate at maxBitratre value.
+ * . minBitrate greater than 0, for ABR, the bitrate of the stream varies
+ * between minBitrate to maxBitrate according to link quality.
+ * The 0 value for both means "undefined" or "don't care".
*/
int minBitrate;
int maxBitrate;
- boolean lowLatency;
- boolean lossless;
+ /**
+ * Low-latency configuration. The interpretation is vendor specific.
+ * When returned to the client, the assessment of the low latency configuration is left
+ * to the vendor's discretion. When set by the client, it indicates that we are entering
+ * a low-latency context (e.g. gaming), and such a configuration should be privileged.
+ */
+ boolean lowLatency = false;
+
+ /**
+ * Lossless effort indication. The 'False' value can be used as "don't care"
+ */
+ boolean lossless = false;
/**
* Vendor specific parameters, inserted in the Vendor Specific HCI Command
diff --git a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/CodecSpecificCapabilitiesLtv.aidl b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/CodecSpecificCapabilitiesLtv.aidl
index ceb90ba..fa302e3 100644
--- a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/CodecSpecificCapabilitiesLtv.aidl
+++ b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/CodecSpecificCapabilitiesLtv.aidl
@@ -23,6 +23,9 @@
*/
@VintfStability
union CodecSpecificCapabilitiesLtv {
+ /**
+ * Supported sampling frequencies in Hertz
+ */
parcelable SupportedSamplingFrequencies {
const int HZ8000 = 0x0001;
const int HZ11025 = 0x0002;
@@ -41,10 +44,13 @@
/* 16 bits wide bit mask */
int bitmask;
}
+ /**
+ * Supported frame durations in microseconds
+ */
parcelable SupportedFrameDurations {
const int US7500 = 0x01;
const int US10000 = 0x02;
- // Bits 2-3 are RFU
+ /* Bits 2-3 are RFU */
const int US7500PREFERRED = 0x10;
const int US10000PREFERRED = 0x20;
@@ -65,8 +71,8 @@
int bitmask;
}
parcelable SupportedOctetsPerCodecFrame {
- int minimum;
- int maximum;
+ int min;
+ int max;
}
parcelable SupportedMaxCodecFramesPerSDU {
int value;
diff --git a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/ConfigurationFlags.aidl b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/ConfigurationFlags.aidl
index 57c8be5..a12af49 100644
--- a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/ConfigurationFlags.aidl
+++ b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/ConfigurationFlags.aidl
@@ -22,33 +22,33 @@
@VintfStability
parcelable ConfigurationFlags {
const int NONE = 0x0000;
- /*
+ /**
* Set for the lossless configurations
*/
const int LOSSLESS = 0x0001;
- /*
+ /**
* Set for the low latency configurations
*/
const int LOW_LATENCY = 0x0002;
- /*
+ /**
* When set, asymmetric configuration for SINK and SOURCE can be used.
* e.g. in GAMING mode stream for 32kHz and back channel for 16 kHz
*/
- const int ALLOW_ASYMMETRIC_CONFIGURATIONS = 0x0003;
- /*
+ const int ALLOW_ASYMMETRIC_CONFIGURATIONS = 0x0004;
+ /**
* Set for the spatial audio configurations
*/
- const int SPATIAL_AUDIO = 0x0004;
- /*
+ const int SPATIAL_AUDIO = 0x0008;
+ /**
* When set, BluetoothAudioProvider requests to receive ASE metadata.
* In such case onSinkAseMetadataChanged() and onSourceAseMetadataChanged
* will be called.
*/
- const int PROVIDE_ASE_METADATA = 0x0005;
- /*
+ const int PROVIDE_ASE_METADATA = 0x0010;
+ /**
* Set for mono microphone configurations
*/
- const int MONO_MIC_CONFIGURATION = 0x0006;
+ const int MONO_MIC_CONFIGURATION = 0x0020;
int bitmask;
}
diff --git a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/IBluetoothAudioProvider.aidl b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/IBluetoothAudioProvider.aidl
index 8c6fe69..33af8a4 100644
--- a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/IBluetoothAudioProvider.aidl
+++ b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/IBluetoothAudioProvider.aidl
@@ -133,17 +133,34 @@
* when no suitable configuration has been found.
*/
@nullable A2dpConfiguration getA2dpConfiguration(
- in List<A2dpRemoteCapabilities> remoteA2dpCapabilities, in A2dpConfigurationHint hint);
+ in A2dpRemoteCapabilities[] remoteA2dpCapabilities, in A2dpConfigurationHint hint);
+
+ /**
+ * Predefined values for the codec priority, used by `setCodecPriority()`.
+ * Besides these special values, the codec priority can be set to 1 for
+ * the highest possible priority, or to any other 4 bytes wide integer N,
+ * where N has the higher priority than N + 1.
+ */
+ const int CODEC_PRIORITY_DISABLED = -1;
+ const int CODEC_PRIORITY_NONE = 0;
/**
* Set specific codec priority
*
* It should be assumed that the external module will start with all its
- * integrated codecs priority 0 by default.
+ * integrated codecs priority set to `CODEC_PRIORITY_NONE` by default.
+ *
+ * Note: If the BT stack sets a particular codec priority to
+ * CODEC_PRIORITY_DISABLED, the configuration provider shal not return
+ * a particular codec when asked for the configuration. Other priority
+ * levels and the prioritization mechanism details are not specified
+ * and the vendor can implement them as desired.
*
* @param codecId: codecId
- * @param priority: 0 for no priority, -1 for codec disabled,
- * from 1 to N, where 1 is highest.
+ * @param priority: `CODEC_PRIORITY_NONE` for no priority,
+ * `CODEC_PRIORITY_DISABLED` for the disabled codec, or priority
+ * level from 1 to N, where the priority of N + 1 is lower than N,
+ * and N equal to 1 is the highest possible codec priority.
*/
void setCodecPriority(in CodecId codecId, int priority);
@@ -240,7 +257,8 @@
IsoDataPathConfiguration isoDataPathConfiguration;
}
- /* All the LeAudioAseQosConfiguration parameters are defined by the
+ /**
+ * All the LeAudioAseQosConfiguration parameters are defined by the
* Bluetooth Audio Stream Control Service specification v.1.0, Sec. 5: "ASE
* Control Operations".
*/
@@ -330,11 +348,11 @@
/**
* Sink ASEs configuration
*/
- @nullable List<AseDirectionConfiguration> sinkAseConfiguration;
+ @nullable AseDirectionConfiguration[] sinkAseConfiguration;
/**
* Source ASEs configuration
*/
- @nullable List<AseDirectionConfiguration> sourceAseConfiguration;
+ @nullable AseDirectionConfiguration[] sourceAseConfiguration;
/**
* Additional flags, used for configurations with special features
*/
@@ -371,11 +389,11 @@
/**
* Sink ASEs configuration setting
*/
- @nullable List<AseDirectionRequirement> sinkAseRequirement;
+ @nullable AseDirectionRequirement[] sinkAseRequirement;
/**
* Source ASEs configuration setting
*/
- @nullable List<AseDirectionRequirement> sourceAseRequirement;
+ @nullable AseDirectionRequirement[] sourceAseRequirement;
/**
* Additional flags, used to request configurations with special
* features
@@ -395,25 +413,57 @@
* BluetoothStack expects to get configuration list for SINK and SOURCE
* on either _ENCODING or _DECODING session.
*
- * @param remoteSinkAudioCapabilities List of remote sink capabilities
+ * Note: When the requirements are not met, either for one or both
+ * directions, the corresponding returned AseDirectionConfiguration
+ * can be set to null. Otherwise it shall contain an ASE configuration
+ * array with the number of configurations equal to the number of ASEs
+ * which should be configured by the BT stack for this particular
+ * direction.
+ * The provider shall match all the requirements set by the Bluetooth
+ * stack or return a null configuration for the direction when these
+ * requirements are not met. In response, the BT Stack may decide to
+ * reduce the requirements to the minimum, which is the `audioContext`
+ * and the `LeAudioAseConfiguration.codecConfiguration` with the
+ * mandatory `CodecSpecificConfigurationLtv.SamplingFrequency` and
+ * `CodecSpecificConfigurationLtv.AudioChannelAllocation` fields set.
+ * When these minimum requirements are not met as well, the Bt stack
+ * may set either `sinkAseRequirement` or `sourceAseRequirement`, or
+ * both to null. In such case the provider has the freedom of
+ * providing a configuration for the null-ed direction requirements or
+ * not for the particular audio context. However returning neither of
+ * the direction configurations (both nulled) is considered as an
+ * invalid behavior.
+ * If the returned configurations are not complete (either
+ * `qosConfiguration` or `dataPathConfiguration` are null), the BT
+ * stack will ask for these dynamically during the stream
+ * establishment, using the corresponding
+ * `getLeAudioAseQosConfiguration()` and
+ * `getLeAudioAseDatapathConfiguration()` API calls. This behavior
+ * is not desired as it slows down the stream establishment, and
+ * should be implemented only if really needed (e.g. when the provider
+ * needs to monitor the remote device ASE states, using the
+ * `onSinkAseMetadataChanged()` and `onSourceAseMetadataChanged()`
+ * callbacks to derive the valid QoS and/or data path configuration).
+ *
+ * @param remoteSinkAudioCapabilities Array of remote sink capabilities
* supported by an active group devices.
- * @param remoteSourceAudioCapabilities List of remote source capabilities
+ * @param remoteSourceAudioCapabilities Array of remote source capabilities
* supported by an active group devices.
* @param requirements ASE configuration requirements
*
- * @return List<LeAudioAseConfigurationSetting>
+ * @return LeAudioAseConfigurationSetting[]
*/
- List<LeAudioAseConfigurationSetting> getLeAudioAseConfiguration(
- in @nullable List<LeAudioDeviceCapabilities> remoteSinkAudioCapabilities,
- in @nullable List<LeAudioDeviceCapabilities> remoteSourceAudioCapabilities,
- in List<LeAudioConfigurationRequirement> requirements);
+ LeAudioAseConfigurationSetting[] getLeAudioAseConfiguration(
+ in @nullable LeAudioDeviceCapabilities[] remoteSinkAudioCapabilities,
+ in @nullable LeAudioDeviceCapabilities[] remoteSourceAudioCapabilities,
+ in LeAudioConfigurationRequirement[] requirements);
@VintfStability
parcelable LeAudioAseQosConfigurationRequirement {
/**
* Audio Contect Type that this requirements apply to
*/
- AudioContext contextType;
+ AudioContext audioContext;
/**
* QoS preferences received in Codec Configured ASE state. As defined in
@@ -501,6 +551,18 @@
* parameters are not within the boundaries received from the remote device
* after configuring the ASEs.
*
+ * Note: When the requirements are not met, either for one or both
+ * directions, the corresponding configurations in the returned
+ * LeAudioAseQosConfigurationPair can be set to null. The minimum
+ * requirement can have only the `audioContext` field set and just a
+ * single (either sink or source) AseQosDirectionRequirement, where
+ * only the preferred parameter fields are not specified. The
+ * configuration provider should always be able to satisfy such
+ * requirement for all the audio contexts specified by Bluetooth SIG.
+ * The Bluetooth stack can reduce the requirements to the minimum,
+ * when more precisely specified requirements are not met by the
+ * configuration provider.
+ *
* @param qosRequirement ASE QoS configurations requirements
*
* @return LeAudioAseQosConfigurationPair
@@ -527,7 +589,7 @@
* This can serve as a hint for selecting the proper configuration by
* the offloader.
*/
- AudioContext context;
+ AudioContext audioContext;
/**
* Stream configuration, including connection handles and audio channel
* allocations.
@@ -545,13 +607,25 @@
* @param sinkConfig - remote sink device stream configuration
* @param sourceConfig - remote source device stream configuration
*
+ * Note: The provider shall provide a data path configuration for each
+ * of the non-null configurations passed to this function if these
+ * configurations are supported by the configuration provider.
+ * The Bluetooth stack can set either only sink or source
+ * configuration if it expects just a single direction data path
+ * configuration. Not providing a valid data path configuration for
+ * the stream configured with the codec parameters provided by the
+ * configuration provider will be considered an invalid behavior.
+ * The BT stack can pass asymmetric sink and source configurations
+ * if `ALLOW_ASYMMETRIC_CONFIGURATIONS` flag was set by the provider
+ * in the `CodecInfo` information for the particular codec.
+ *
* @return LeAudioDataPathConfigurationPair
*/
LeAudioDataPathConfigurationPair getLeAudioAseDatapathConfiguration(
in @nullable StreamConfig sinkConfig,
in @nullable StreamConfig sourceConfig);
- /*
+ /**
* Audio Stream Endpoint state used to report Metadata changes on the remote
* device audio endpoints.
*/
@@ -564,14 +638,32 @@
}
/**
- * Used to report metadata changes to the provider. This allows for a
- * pseudo communication channel between the remote device and the provider,
- * using the vendor specific metadata of the changing ASE state.
- * It is used only when ASE is using configurations marked with the
- * `PROVIDE_ASE_METADATA` flag.
+ * Used to report sink endpoint metadata changes to the provider. This
+ * allows for a pseudo communication channel between the remote device and
+ * the provider, using the vendor specific metadata of the changing ASE
+ * state. It is used only when Audio Stream Endpoint (ASE) is using
+ * configurations marked with the `PROVIDE_ASE_METADATA` flag.
+ *
+ * @param state - current Audio Stream Endpoint state of the remote device
+ * @param cigId - Coordinate Isochronous Group identifier
+ * @param cisId - Coordinate Isochronous Stream identifier
+ * @param metadata - remote sink device metadata for the given ASE
*/
void onSinkAseMetadataChanged(
in AseState state, int cigId, int cisId, in @nullable MetadataLtv[] metadata);
+
+ /**
+ * Used to report source endpoint metadata changes to the provider. This
+ * allows for a pseudo communication channel between the remote device and
+ * the provider, using the vendor specific metadata of the changing ASE
+ * state. It is used only when Audio Stream Endpoint (ASE) is using
+ * configurations marked with the `PROVIDE_ASE_METADATA` flag.
+ *
+ * @param state - current Audio Stream Endpoint state of the remote device
+ * @param cigId - Coordinate Isochronous Group identifier
+ * @param cisId - Coordinate Isochronous Stream identifier
+ * @param metadata - remote source device metadata for the given ASE
+ */
void onSourceAseMetadataChanged(
in AseState state, int cigId, int cisId, in @nullable MetadataLtv[] metadata);
@@ -595,7 +687,7 @@
* This can serve as a hint for selecting the proper configuration by
* the offloader.
*/
- AudioContext context;
+ AudioContext audioContext;
/**
* Streaming Broadcast Audio Quality
*/
@@ -614,7 +706,7 @@
*/
@VintfStability
parcelable LeAudioBroadcastConfigurationRequirement {
- List<LeAudioBroadcastSubgroupConfigurationRequirement> subgroupConfigurationRequirements;
+ LeAudioBroadcastSubgroupConfigurationRequirement[] subgroupConfigurationRequirements;
}
/**
@@ -635,11 +727,10 @@
/**
* Subgroup configuration with a list of BIS configurations
- *
*/
@VintfStability
parcelable LeAudioBroadcastSubgroupConfiguration {
- List<LeAudioSubgroupBisConfiguration> bisConfigurations;
+ LeAudioSubgroupBisConfiguration[] bisConfigurations;
/**
* Vendor specific codec configuration for all the BISes inside this
@@ -659,7 +750,6 @@
* LeAudioBroadcastConfigurationSetting is a result of
* getLeAudioBroadcastConfiguration. It is used in HCI_LE_Create_BIG command
* and for creating the Broadcast Announcements.
- *
*/
@VintfStability
parcelable LeAudioBroadcastConfigurationSetting {
@@ -705,18 +795,23 @@
@nullable LeAudioDataPathConfiguration dataPathConfiguration;
/**
- * A list of subgroup configurations in the broadcast.
+ * An array of subgroup configurations in the broadcast.
*/
- List<LeAudioBroadcastSubgroupConfiguration> subgroupsConfigurations;
+ LeAudioBroadcastSubgroupConfiguration[] subgroupsConfigurations;
}
/**
* Get Broadcast configuration. Output of this function will be used
* in HCI_LE_Create_BIG (0x0068) command and also to create BIG INFO
*
+ * @param remoteSinkAudioCapabilities - remote device sink endpoint
+ * capabilities
+ * @param requirement - requested configuration requirements
+ *
+ * @return the whole broadcast audio stream configuration
*/
LeAudioBroadcastConfigurationSetting getLeAudioBroadcastConfiguration(
- in @nullable List<LeAudioDeviceCapabilities> remoteSinkAudioCapabilities,
+ in @nullable LeAudioDeviceCapabilities[] remoteSinkAudioCapabilities,
in LeAudioBroadcastConfigurationRequirement requirement);
/**
@@ -725,7 +820,12 @@
* not provided in LeAudioBroadcastConfigurationSetting. Calling this during
* the broadcast audio stream establishment might slightly delay the stream
* start.
+ *
+ * @param audioContext - audio stream context for the given stream map
+ * @param streamMap - channel map with BIS configurations
+ *
+ * @return broadcast audio stream data path configuration
*/
LeAudioDataPathConfiguration getLeAudioBroadcastDatapathConfiguration(
- in AudioContext context, in BroadcastStreamMap[] streamMap);
+ in AudioContext audioContext, in BroadcastStreamMap[] streamMap);
}
diff --git a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/MetadataLtv.aidl b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/MetadataLtv.aidl
index b0befc1..afe76ce 100644
--- a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/MetadataLtv.aidl
+++ b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/MetadataLtv.aidl
@@ -30,8 +30,9 @@
parcelable StreamingAudioContexts {
AudioContext values;
}
- /* This is an opaque container for passing metadata between the provider and
- * the remote device. It must not be interpreted by the BT stack.
+ /**
+ * This is an opaque container for passing metadata between the provider and
+ * the remote device. It shall not be inspected by the BT stack.
*/
parcelable VendorSpecific {
int companyId;
diff --git a/bluetooth/audio/aidl/default/A2dpOffloadAudioProvider.cpp b/bluetooth/audio/aidl/default/A2dpOffloadAudioProvider.cpp
index ba7a89d..c7761c5 100644
--- a/bluetooth/audio/aidl/default/A2dpOffloadAudioProvider.cpp
+++ b/bluetooth/audio/aidl/default/A2dpOffloadAudioProvider.cpp
@@ -23,7 +23,6 @@
#include <android-base/logging.h>
#include "A2dpOffloadCodecAac.h"
-#include "A2dpOffloadCodecFactory.h"
#include "A2dpOffloadCodecSbc.h"
namespace aidl {
@@ -32,17 +31,21 @@
namespace bluetooth {
namespace audio {
-A2dpOffloadEncodingAudioProvider::A2dpOffloadEncodingAudioProvider()
- : A2dpOffloadAudioProvider() {
+A2dpOffloadEncodingAudioProvider::A2dpOffloadEncodingAudioProvider(
+ const A2dpOffloadCodecFactory& codec_factory)
+ : A2dpOffloadAudioProvider(codec_factory) {
session_type_ = SessionType::A2DP_HARDWARE_OFFLOAD_ENCODING_DATAPATH;
}
-A2dpOffloadDecodingAudioProvider::A2dpOffloadDecodingAudioProvider()
- : A2dpOffloadAudioProvider() {
+A2dpOffloadDecodingAudioProvider::A2dpOffloadDecodingAudioProvider(
+ const A2dpOffloadCodecFactory& codec_factory)
+ : A2dpOffloadAudioProvider(codec_factory) {
session_type_ = SessionType::A2DP_HARDWARE_OFFLOAD_DECODING_DATAPATH;
}
-A2dpOffloadAudioProvider::A2dpOffloadAudioProvider() {}
+A2dpOffloadAudioProvider::A2dpOffloadAudioProvider(
+ const A2dpOffloadCodecFactory& codec_factory)
+ : codec_factory_(codec_factory) {}
bool A2dpOffloadAudioProvider::isValid(const SessionType& session_type) {
return (session_type == session_type_);
@@ -56,17 +59,29 @@
auto a2dp_config = audio_config.get<AudioConfiguration::Tag::a2dp>();
A2dpStatus a2dp_status = A2dpStatus::NOT_SUPPORTED_CODEC_TYPE;
- if (a2dp_config.codecId ==
- A2dpOffloadCodecSbc::GetInstance()->GetCodecId()) {
- SbcParameters sbc_parameters;
- a2dp_status = A2dpOffloadCodecSbc::GetInstance()->ParseConfiguration(
- a2dp_config.configuration, &sbc_parameters);
+ auto codec = codec_factory_.GetCodec(a2dp_config.codecId);
+ if (!codec) {
+ LOG(INFO) << __func__ << " - SessionType=" << toString(session_type_)
+ << " - CodecId=" << a2dp_config.codecId.toString()
+ << " is not found";
+ return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT);
+ }
- } else if (a2dp_config.codecId ==
- A2dpOffloadCodecAac::GetInstance()->GetCodecId()) {
+ if (codec->info.id == CodecId(CodecId::A2dp::SBC)) {
+ SbcParameters sbc_parameters;
+
+ auto codec_sbc =
+ std::static_pointer_cast<const A2dpOffloadCodecSbc>(codec);
+ a2dp_status = codec_sbc->ParseConfiguration(a2dp_config.configuration,
+ &sbc_parameters);
+
+ } else if (codec->info.id == CodecId(CodecId::A2dp::AAC)) {
AacParameters aac_parameters;
- a2dp_status = A2dpOffloadCodecAac::GetInstance()->ParseConfiguration(
- a2dp_config.configuration, &aac_parameters);
+
+ auto codec_aac =
+ std::static_pointer_cast<const A2dpOffloadCodecAac>(codec);
+ a2dp_status = codec_aac->ParseConfiguration(a2dp_config.configuration,
+ &aac_parameters);
}
if (a2dp_status != A2dpStatus::OK) {
LOG(WARNING) << __func__ << " - Invalid Audio Configuration="
@@ -105,7 +120,7 @@
ndk::ScopedAStatus A2dpOffloadAudioProvider::parseA2dpConfiguration(
const CodecId& codec_id, const std::vector<uint8_t>& configuration,
CodecParameters* codec_parameters, A2dpStatus* _aidl_return) {
- auto codec = A2dpOffloadCodecFactory::GetInstance()->GetCodec(codec_id);
+ auto codec = codec_factory_.GetCodec(codec_id);
if (!codec) {
LOG(INFO) << __func__ << " - SessionType=" << toString(session_type_)
<< " - CodecId=" << codec_id.toString() << " is not found";
@@ -124,8 +139,8 @@
*_aidl_return = std::nullopt;
A2dpConfiguration avdtp_configuration;
- if (A2dpOffloadCodecFactory::GetInstance()->GetConfiguration(
- remote_a2dp_capabilities, hint, &avdtp_configuration))
+ if (codec_factory_.GetConfiguration(remote_a2dp_capabilities, hint,
+ &avdtp_configuration))
*_aidl_return =
std::make_optional<A2dpConfiguration>(std::move(avdtp_configuration));
diff --git a/bluetooth/audio/aidl/default/A2dpOffloadAudioProvider.h b/bluetooth/audio/aidl/default/A2dpOffloadAudioProvider.h
index 7cc6dee..a2d03fe 100644
--- a/bluetooth/audio/aidl/default/A2dpOffloadAudioProvider.h
+++ b/bluetooth/audio/aidl/default/A2dpOffloadAudioProvider.h
@@ -16,6 +16,7 @@
#pragma once
+#include "A2dpOffloadCodecFactory.h"
#include "BluetoothAudioProvider.h"
namespace aidl {
@@ -26,8 +27,6 @@
class A2dpOffloadAudioProvider : public BluetoothAudioProvider {
public:
- A2dpOffloadAudioProvider();
-
bool isValid(const SessionType& session_type) override;
ndk::ScopedAStatus startSession(
@@ -45,18 +44,23 @@
const A2dpConfigurationHint& hint,
std::optional<audio::A2dpConfiguration>* _aidl_return) override;
+ protected:
+ A2dpOffloadAudioProvider(const A2dpOffloadCodecFactory&);
+
private:
+ const A2dpOffloadCodecFactory& codec_factory_;
+
ndk::ScopedAStatus onSessionReady(DataMQDesc* _aidl_return) override;
};
class A2dpOffloadEncodingAudioProvider : public A2dpOffloadAudioProvider {
public:
- A2dpOffloadEncodingAudioProvider();
+ A2dpOffloadEncodingAudioProvider(const A2dpOffloadCodecFactory&);
};
class A2dpOffloadDecodingAudioProvider : public A2dpOffloadAudioProvider {
public:
- A2dpOffloadDecodingAudioProvider();
+ A2dpOffloadDecodingAudioProvider(const A2dpOffloadCodecFactory&);
};
} // namespace audio
diff --git a/bluetooth/audio/aidl/default/A2dpOffloadCodec.h b/bluetooth/audio/aidl/default/A2dpOffloadCodec.h
index 7ed5872..2f51c73 100644
--- a/bluetooth/audio/aidl/default/A2dpOffloadCodec.h
+++ b/bluetooth/audio/aidl/default/A2dpOffloadCodec.h
@@ -18,10 +18,9 @@
#include <aidl/android/hardware/bluetooth/audio/A2dpStatus.h>
#include <aidl/android/hardware/bluetooth/audio/ChannelMode.h>
+#include <aidl/android/hardware/bluetooth/audio/CodecInfo.h>
#include <aidl/android/hardware/bluetooth/audio/CodecParameters.h>
-#include "BluetoothAudioProviderFactory.h"
-
namespace aidl::android::hardware::bluetooth::audio {
class A2dpOffloadCodec {
diff --git a/bluetooth/audio/aidl/default/A2dpOffloadCodecAac.cpp b/bluetooth/audio/aidl/default/A2dpOffloadCodecAac.cpp
index 0f5533a..1570cd8 100644
--- a/bluetooth/audio/aidl/default/A2dpOffloadCodecAac.cpp
+++ b/bluetooth/audio/aidl/default/A2dpOffloadCodecAac.cpp
@@ -194,11 +194,6 @@
* AAC Class implementation
*/
-const A2dpOffloadCodecAac* A2dpOffloadCodecAac::GetInstance() {
- static A2dpOffloadCodecAac instance;
- return &instance;
-}
-
A2dpOffloadCodecAac::A2dpOffloadCodecAac()
: A2dpOffloadCodec(info_),
info_({.id = CodecId(CodecId::A2dp::AAC), .name = "AAC"}) {
diff --git a/bluetooth/audio/aidl/default/A2dpOffloadCodecAac.h b/bluetooth/audio/aidl/default/A2dpOffloadCodecAac.h
index eefa89b..65e927d 100644
--- a/bluetooth/audio/aidl/default/A2dpOffloadCodecAac.h
+++ b/bluetooth/audio/aidl/default/A2dpOffloadCodecAac.h
@@ -29,14 +29,12 @@
class A2dpOffloadCodecAac : public A2dpOffloadCodec {
CodecInfo info_;
- A2dpOffloadCodecAac();
-
A2dpStatus ParseConfiguration(const std::vector<uint8_t>& configuration,
CodecParameters* codec_parameters,
AacParameters* aac_parameters) const;
public:
- static const A2dpOffloadCodecAac* GetInstance();
+ A2dpOffloadCodecAac();
A2dpStatus ParseConfiguration(
const std::vector<uint8_t>& configuration,
diff --git a/bluetooth/audio/aidl/default/A2dpOffloadCodecFactory.cpp b/bluetooth/audio/aidl/default/A2dpOffloadCodecFactory.cpp
index 73d8fb1..658073c 100644
--- a/bluetooth/audio/aidl/default/A2dpOffloadCodecFactory.cpp
+++ b/bluetooth/audio/aidl/default/A2dpOffloadCodecFactory.cpp
@@ -37,20 +37,18 @@
* Class implementation
*/
-const A2dpOffloadCodecFactory* A2dpOffloadCodecFactory::GetInstance() {
- static A2dpOffloadCodecFactory instance;
- return &instance;
-}
-
A2dpOffloadCodecFactory::A2dpOffloadCodecFactory()
: name("Offload"), codecs(ranked_codecs_) {
ranked_codecs_.reserve(kEnableAac + kEnableSbc);
- if (kEnableAac) ranked_codecs_.push_back(A2dpOffloadCodecAac::GetInstance());
- if (kEnableSbc) ranked_codecs_.push_back(A2dpOffloadCodecSbc::GetInstance());
+ if (kEnableAac)
+ ranked_codecs_.push_back(std::make_shared<A2dpOffloadCodecAac>());
+ if (kEnableSbc)
+ ranked_codecs_.push_back(std::make_shared<A2dpOffloadCodecSbc>());
}
-const A2dpOffloadCodec* A2dpOffloadCodecFactory::GetCodec(CodecId id) const {
+std::shared_ptr<const A2dpOffloadCodec> A2dpOffloadCodecFactory::GetCodec(
+ CodecId id) const {
auto codec = std::find_if(begin(ranked_codecs_), end(ranked_codecs_),
[&](auto c) { return id == c->info.id; });
diff --git a/bluetooth/audio/aidl/default/A2dpOffloadCodecFactory.h b/bluetooth/audio/aidl/default/A2dpOffloadCodecFactory.h
index 3fb5b1d..1546cc4 100644
--- a/bluetooth/audio/aidl/default/A2dpOffloadCodecFactory.h
+++ b/bluetooth/audio/aidl/default/A2dpOffloadCodecFactory.h
@@ -16,22 +16,26 @@
#pragma once
+#include <aidl/android/hardware/bluetooth/audio/A2dpConfiguration.h>
+#include <aidl/android/hardware/bluetooth/audio/A2dpConfigurationHint.h>
+#include <aidl/android/hardware/bluetooth/audio/A2dpRemoteCapabilities.h>
+
+#include <memory>
+
#include "A2dpOffloadCodec.h"
namespace aidl::android::hardware::bluetooth::audio {
class A2dpOffloadCodecFactory {
- std::vector<const A2dpOffloadCodec*> ranked_codecs_;
-
- A2dpOffloadCodecFactory();
+ std::vector<std::shared_ptr<const A2dpOffloadCodec>> ranked_codecs_;
public:
const std::string name;
- const std::vector<const A2dpOffloadCodec*>& codecs;
+ const std::vector<std::shared_ptr<const A2dpOffloadCodec>>& codecs;
- static const A2dpOffloadCodecFactory* GetInstance();
+ A2dpOffloadCodecFactory();
- const A2dpOffloadCodec* GetCodec(CodecId id) const;
+ std::shared_ptr<const A2dpOffloadCodec> GetCodec(CodecId id) const;
bool GetConfiguration(const std::vector<A2dpRemoteCapabilities>&,
const A2dpConfigurationHint& hint,
diff --git a/bluetooth/audio/aidl/default/A2dpOffloadCodecSbc.cpp b/bluetooth/audio/aidl/default/A2dpOffloadCodecSbc.cpp
index 36d8f72..6b9046c 100644
--- a/bluetooth/audio/aidl/default/A2dpOffloadCodecSbc.cpp
+++ b/bluetooth/audio/aidl/default/A2dpOffloadCodecSbc.cpp
@@ -257,11 +257,6 @@
* SBC Class implementation
*/
-const A2dpOffloadCodecSbc* A2dpOffloadCodecSbc::GetInstance() {
- static A2dpOffloadCodecSbc instance;
- return &instance;
-}
-
A2dpOffloadCodecSbc::A2dpOffloadCodecSbc()
: A2dpOffloadCodec(info_),
info_({.id = CodecId(CodecId::A2dp::SBC), .name = "SBC"}) {
diff --git a/bluetooth/audio/aidl/default/A2dpOffloadCodecSbc.h b/bluetooth/audio/aidl/default/A2dpOffloadCodecSbc.h
index c380850..a39d779 100644
--- a/bluetooth/audio/aidl/default/A2dpOffloadCodecSbc.h
+++ b/bluetooth/audio/aidl/default/A2dpOffloadCodecSbc.h
@@ -33,14 +33,12 @@
class A2dpOffloadCodecSbc : public A2dpOffloadCodec {
CodecInfo info_;
- A2dpOffloadCodecSbc();
-
A2dpStatus ParseConfiguration(const std::vector<uint8_t>& configuration,
CodecParameters* codec_parameters,
SbcParameters* sbc_parameters) const;
public:
- static const A2dpOffloadCodecSbc* GetInstance();
+ A2dpOffloadCodecSbc();
A2dpStatus ParseConfiguration(
const std::vector<uint8_t>& configuration,
diff --git a/bluetooth/audio/aidl/default/BluetoothAudioProviderFactory.cpp b/bluetooth/audio/aidl/default/BluetoothAudioProviderFactory.cpp
index e55a434..c7c6e6d 100644
--- a/bluetooth/audio/aidl/default/BluetoothAudioProviderFactory.cpp
+++ b/bluetooth/audio/aidl/default/BluetoothAudioProviderFactory.cpp
@@ -22,7 +22,6 @@
#include <android-base/logging.h>
#include "A2dpOffloadAudioProvider.h"
-#include "A2dpOffloadCodecFactory.h"
#include "A2dpSoftwareAudioProvider.h"
#include "BluetoothAudioProvider.h"
#include "HearingAidAudioProvider.h"
@@ -53,7 +52,8 @@
provider = ndk::SharedRefBase::make<A2dpSoftwareEncodingAudioProvider>();
break;
case SessionType::A2DP_HARDWARE_OFFLOAD_ENCODING_DATAPATH:
- provider = ndk::SharedRefBase::make<A2dpOffloadEncodingAudioProvider>();
+ provider = ndk::SharedRefBase::make<A2dpOffloadEncodingAudioProvider>(
+ a2dp_offload_codec_factory_);
break;
case SessionType::HEARING_AID_SOFTWARE_ENCODING_DATAPATH:
provider = ndk::SharedRefBase::make<HearingAidAudioProvider>();
@@ -82,7 +82,8 @@
provider = ndk::SharedRefBase::make<A2dpSoftwareDecodingAudioProvider>();
break;
case SessionType::A2DP_HARDWARE_OFFLOAD_DECODING_DATAPATH:
- provider = ndk::SharedRefBase::make<A2dpOffloadDecodingAudioProvider>();
+ provider = ndk::SharedRefBase::make<A2dpOffloadDecodingAudioProvider>(
+ a2dp_offload_codec_factory_);
break;
case SessionType::HFP_SOFTWARE_ENCODING_DATAPATH:
provider = ndk::SharedRefBase::make<HfpSoftwareOutputAudioProvider>();
@@ -160,8 +161,8 @@
session_type == SessionType::A2DP_HARDWARE_OFFLOAD_DECODING_DATAPATH) {
auto& provider_info = _aidl_return->emplace();
- provider_info.name = A2dpOffloadCodecFactory::GetInstance()->name;
- for (auto codec : A2dpOffloadCodecFactory::GetInstance()->codecs)
+ provider_info.name = a2dp_offload_codec_factory_.name;
+ for (auto codec : a2dp_offload_codec_factory_.codecs)
provider_info.codecInfos.push_back(codec->info);
}
diff --git a/bluetooth/audio/aidl/default/BluetoothAudioProviderFactory.h b/bluetooth/audio/aidl/default/BluetoothAudioProviderFactory.h
index 1afae64..6931884 100644
--- a/bluetooth/audio/aidl/default/BluetoothAudioProviderFactory.h
+++ b/bluetooth/audio/aidl/default/BluetoothAudioProviderFactory.h
@@ -18,6 +18,8 @@
#include <aidl/android/hardware/bluetooth/audio/BnBluetoothAudioProviderFactory.h>
+#include "A2dpOffloadCodecFactory.h"
+
namespace aidl {
namespace android {
namespace hardware {
@@ -25,6 +27,8 @@
namespace audio {
class BluetoothAudioProviderFactory : public BnBluetoothAudioProviderFactory {
+ const A2dpOffloadCodecFactory a2dp_offload_codec_factory_;
+
public:
BluetoothAudioProviderFactory();
diff --git a/bluetooth/audio/aidl/default/LeAudioOffloadAudioProvider.cpp b/bluetooth/audio/aidl/default/LeAudioOffloadAudioProvider.cpp
index cff3b25..a692d84 100644
--- a/bluetooth/audio/aidl/default/LeAudioOffloadAudioProvider.cpp
+++ b/bluetooth/audio/aidl/default/LeAudioOffloadAudioProvider.cpp
@@ -157,8 +157,11 @@
bool LeAudioOffloadAudioProvider::isMatchedValidCodec(CodecId cfg_codec,
CodecId req_codec) {
auto priority = codec_priority_map_.find(cfg_codec);
- if (priority != codec_priority_map_.end() && priority->second == -1)
+ if (priority != codec_priority_map_.end() &&
+ priority->second ==
+ LeAudioOffloadAudioProvider::CODEC_PRIORITY_DISABLED) {
return false;
+ }
return cfg_codec == req_codec;
}
@@ -222,8 +225,8 @@
CodecSpecificConfigurationLtv::OctetsPerCodecFrame& cfg_octets,
CodecSpecificCapabilitiesLtv::SupportedOctetsPerCodecFrame&
capability_octets) {
- return cfg_octets.value >= capability_octets.minimum &&
- cfg_octets.value <= capability_octets.maximum;
+ return cfg_octets.value >= capability_octets.min &&
+ cfg_octets.value <= capability_octets.max;
}
bool LeAudioOffloadAudioProvider::isCapabilitiesMatchedCodecConfiguration(
@@ -568,7 +571,7 @@
for (auto& setting : ase_configuration_settings) {
// Context matching
- if (setting.audioContext != in_qosRequirement.contextType) continue;
+ if (setting.audioContext != in_qosRequirement.audioContext) continue;
// Match configuration flags
// Currently configuration flags are not populated, ignore.
diff --git a/bluetooth/audio/aidl/vts/VtsHalBluetoothAudioTargetTest.cpp b/bluetooth/audio/aidl/vts/VtsHalBluetoothAudioTargetTest.cpp
index 85bc48a..7b98634 100644
--- a/bluetooth/audio/aidl/vts/VtsHalBluetoothAudioTargetTest.cpp
+++ b/bluetooth/audio/aidl/vts/VtsHalBluetoothAudioTargetTest.cpp
@@ -2302,8 +2302,8 @@
frame_duration.bitmask =
CodecSpecificCapabilitiesLtv::SupportedFrameDurations::US7500;
auto octets = CodecSpecificCapabilitiesLtv::SupportedOctetsPerCodecFrame();
- octets.minimum = 0;
- octets.maximum = 60;
+ octets.min = 0;
+ octets.max = 60;
auto frames = CodecSpecificCapabilitiesLtv::SupportedMaxCodecFramesPerSDU();
frames.value = 2;
capability.codecSpecificCapabilities = {sampling_rate, frame_duration,
@@ -2567,7 +2567,7 @@
std::vector<IBluetoothAudioProvider::LeAudioAseQosConfiguration>
QoSConfigurations;
for (auto bitmask : all_context_bitmasks) {
- requirement.contextType = GetAudioContext(bitmask);
+ requirement.audioContext = GetAudioContext(bitmask);
IBluetoothAudioProvider::LeAudioAseQosConfigurationPair result;
auto aidl_retval =
audio_provider_->getLeAudioAseQosConfiguration(requirement, &result);
@@ -2590,8 +2590,8 @@
bool is_supported = false;
for (auto bitmask : all_context_bitmasks) {
- sink_requirement.context = GetAudioContext(bitmask);
- source_requirement.context = GetAudioContext(bitmask);
+ sink_requirement.audioContext = GetAudioContext(bitmask);
+ source_requirement.audioContext = GetAudioContext(bitmask);
IBluetoothAudioProvider::LeAudioDataPathConfigurationPair result;
auto aidl_retval = audio_provider_->getLeAudioAseDatapathConfiguration(
sink_requirement, source_requirement, &result);
diff --git a/broadcastradio/aidl/default/test/DefaultBroadcastRadioHalTest.cpp b/broadcastradio/aidl/default/test/DefaultBroadcastRadioHalTest.cpp
index a370436..8e85a1b 100644
--- a/broadcastradio/aidl/default/test/DefaultBroadcastRadioHalTest.cpp
+++ b/broadcastradio/aidl/default/test/DefaultBroadcastRadioHalTest.cpp
@@ -14,10 +14,13 @@
* limitations under the License.
*/
+#include "MockBroadcastRadioCallback.h"
+
#include <BroadcastRadio.h>
#include <VirtualRadio.h>
#include <broadcastradio-utils-aidl/Utils.h>
+#include <android-base/logging.h>
#include <gtest/gtest.h>
namespace aidl::android::hardware::broadcastradio {
@@ -69,15 +72,53 @@
return amFmRadioMockTestRadio;
}
+int getSignalAcquisitionFlags(const ProgramInfo& info) {
+ return (info.infoFlags &
+ (ProgramInfo::FLAG_SIGNAL_ACQUISITION | ProgramInfo::FLAG_HD_SIS_ACQUISITION |
+ ProgramInfo::FLAG_HD_AUDIO_ACQUISITION)) >>
+ 6;
+}
+
} // namespace
class DefaultBroadcastRadioHalTest : public testing::Test {
public:
void SetUp() override {
+ ::android::base::SetDefaultTag("BcRadioAidlDef.test");
const VirtualRadio& amFmRadioMockTest = getAmFmMockTestRadio();
mBroadcastRadioHal = ::ndk::SharedRefBase::make<BroadcastRadio>(amFmRadioMockTest);
+ mTunerCallback = ndk::SharedRefBase::make<MockBroadcastRadioCallback>();
}
+
+ void TearDown() override {
+ mBroadcastRadioHal->unsetTunerCallback();
+ EXPECT_FALSE(mTunerCallback->isTunerFailed());
+ }
+
+ void verifyUpdatedProgramInfo(const ProgramSelector& sel) {
+ ASSERT_TRUE(mTunerCallback->waitOnCurrentProgramInfoChangedCallback());
+ ProgramInfo infoCb1 = mTunerCallback->getCurrentProgramInfo();
+ mTunerCallback->reset();
+ if (sel.primaryId.type == IdentifierType::HD_STATION_ID_EXT) {
+ EXPECT_TRUE(mTunerCallback->waitOnCurrentProgramInfoChangedCallback());
+ ProgramInfo infoCb2 = mTunerCallback->getCurrentProgramInfo();
+ mTunerCallback->reset();
+ EXPECT_TRUE(mTunerCallback->waitOnCurrentProgramInfoChangedCallback());
+ ProgramInfo infoCb3 = mTunerCallback->getCurrentProgramInfo();
+ mTunerCallback->reset();
+ EXPECT_EQ(infoCb1.selector, sel);
+ EXPECT_EQ(getSignalAcquisitionFlags(infoCb1), 0b001);
+ EXPECT_EQ(infoCb2.selector, sel);
+ EXPECT_EQ(getSignalAcquisitionFlags(infoCb2), 0b011);
+ EXPECT_EQ(infoCb3.selector, sel);
+ EXPECT_EQ(getSignalAcquisitionFlags(infoCb3), 0b111);
+ } else {
+ EXPECT_EQ(infoCb1.selector, sel);
+ }
+ }
+
std::shared_ptr<BroadcastRadio> mBroadcastRadioHal;
+ std::shared_ptr<MockBroadcastRadioCallback> mTunerCallback;
};
TEST_F(DefaultBroadcastRadioHalTest, GetAmFmRegionConfig) {
@@ -136,4 +177,73 @@
}
}
+TEST_F(DefaultBroadcastRadioHalTest, SetTunerCallback) {
+ auto halResult = mBroadcastRadioHal->setTunerCallback(mTunerCallback);
+
+ ASSERT_TRUE(halResult.isOk());
+}
+
+TEST_F(DefaultBroadcastRadioHalTest, SetTunerCallbackWithNull) {
+ auto halResult = mBroadcastRadioHal->setTunerCallback(nullptr);
+
+ ASSERT_EQ(halResult.getServiceSpecificError(), utils::resultToInt(Result::INVALID_ARGUMENTS));
+}
+
+TEST_F(DefaultBroadcastRadioHalTest, UnsetTunerCallbackWithNull) {
+ ASSERT_TRUE(mBroadcastRadioHal->setTunerCallback(mTunerCallback).isOk());
+
+ auto halResult = mBroadcastRadioHal->unsetTunerCallback();
+
+ ASSERT_TRUE(halResult.isOk());
+}
+
+TEST_F(DefaultBroadcastRadioHalTest, TuneWithAmFmSelectorInProgramList) {
+ ASSERT_TRUE(mBroadcastRadioHal->setTunerCallback(mTunerCallback).isOk());
+ mTunerCallback->reset();
+
+ auto halResult = mBroadcastRadioHal->tune(kFmSel1);
+
+ ASSERT_TRUE(halResult.isOk());
+ ASSERT_TRUE(mTunerCallback->waitOnCurrentProgramInfoChangedCallback());
+ ProgramInfo infoCb = mTunerCallback->getCurrentProgramInfo();
+ EXPECT_EQ(infoCb.selector, kFmSel1);
+}
+
+TEST_F(DefaultBroadcastRadioHalTest, TuneWithHdSelectorInProgramList) {
+ ASSERT_TRUE(mBroadcastRadioHal->setTunerCallback(mTunerCallback).isOk());
+ mTunerCallback->reset();
+
+ auto halResult = mBroadcastRadioHal->tune(kFmHdFreq1Sel2);
+
+ ASSERT_TRUE(halResult.isOk());
+ verifyUpdatedProgramInfo(kFmHdFreq1Sel2);
+}
+
+TEST_F(DefaultBroadcastRadioHalTest, TuneWitFrequencyOfHdProgramInProgramList) {
+ ASSERT_TRUE(mBroadcastRadioHal->setTunerCallback(mTunerCallback).isOk());
+ mTunerCallback->reset();
+
+ auto halResult = mBroadcastRadioHal->tune(
+ utils::makeSelectorAmfm(utils::getHdFrequency(kFmHdFreq1Sel1)));
+
+ ASSERT_TRUE(halResult.isOk());
+ verifyUpdatedProgramInfo(kFmHdFreq1Sel1);
+}
+
+TEST_F(DefaultBroadcastRadioHalTest, TuneWithInvalidSelector) {
+ ASSERT_TRUE(mBroadcastRadioHal->setTunerCallback(mTunerCallback).isOk());
+ ProgramSelector invalidSelector = {utils::makeIdentifier(IdentifierType::AMFM_FREQUENCY_KHZ, 0),
+ {}};
+
+ auto halResult = mBroadcastRadioHal->tune(invalidSelector);
+
+ ASSERT_EQ(halResult.getServiceSpecificError(), utils::resultToInt(Result::INVALID_ARGUMENTS));
+}
+
+TEST_F(DefaultBroadcastRadioHalTest, TuneWithoutTunerCallback) {
+ auto halResult = mBroadcastRadioHal->tune(kFmSel1);
+
+ ASSERT_EQ(halResult.getServiceSpecificError(), utils::resultToInt(Result::INVALID_STATE));
+}
+
} // namespace aidl::android::hardware::broadcastradio
diff --git a/broadcastradio/aidl/default/test/MockBroadcastRadioCallback.cpp b/broadcastradio/aidl/default/test/MockBroadcastRadioCallback.cpp
new file mode 100644
index 0000000..48f65fc
--- /dev/null
+++ b/broadcastradio/aidl/default/test/MockBroadcastRadioCallback.cpp
@@ -0,0 +1,93 @@
+/*
+ * Copyright (C) 2024 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 "MockBroadcastRadioCallback.h"
+
+#include <android-base/logging.h>
+
+namespace aidl::android::hardware::broadcastradio {
+
+namespace {
+using std::vector;
+}
+
+MockBroadcastRadioCallback::MockBroadcastRadioCallback() {
+ mAntennaConnectionState = true;
+}
+
+ScopedAStatus MockBroadcastRadioCallback::onTuneFailed(Result result,
+ const ProgramSelector& selector) {
+ LOG(DEBUG) << "onTuneFailed with result with " << selector.toString().c_str();
+ if (result != Result::CANCELED) {
+ std::lock_guard<std::mutex> lk(mLock);
+ tunerFailed = true;
+ }
+ return ndk::ScopedAStatus::ok();
+}
+
+ScopedAStatus MockBroadcastRadioCallback::onCurrentProgramInfoChanged(const ProgramInfo& info) {
+ LOG(DEBUG) << "onCurrentProgramInfoChanged with " << info.toString().c_str();
+ {
+ std::lock_guard<std::mutex> lk(mLock);
+ mCurrentProgramInfo = info;
+ }
+
+ mOnCurrentProgramInfoChangedFlag.notify();
+ return ndk::ScopedAStatus::ok();
+}
+
+ScopedAStatus MockBroadcastRadioCallback::onProgramListUpdated(
+ [[maybe_unused]] const ProgramListChunk& chunk) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ScopedAStatus MockBroadcastRadioCallback::onParametersUpdated(
+ [[maybe_unused]] const vector<VendorKeyValue>& parameters) {
+ return ndk::ScopedAStatus::ok();
+}
+
+ScopedAStatus MockBroadcastRadioCallback::onAntennaStateChange(bool connected) {
+ if (!connected) {
+ std::lock_guard<std::mutex> lk(mLock);
+ mAntennaConnectionState = false;
+ }
+ return ndk::ScopedAStatus::ok();
+}
+
+ScopedAStatus MockBroadcastRadioCallback::onConfigFlagUpdated([[maybe_unused]] ConfigFlag in_flag,
+ [[maybe_unused]] bool in_value) {
+ return ndk::ScopedAStatus::ok();
+}
+
+bool MockBroadcastRadioCallback::waitOnCurrentProgramInfoChangedCallback() {
+ return mOnCurrentProgramInfoChangedFlag.wait();
+}
+
+void MockBroadcastRadioCallback::reset() {
+ mOnCurrentProgramInfoChangedFlag.reset();
+}
+
+bool MockBroadcastRadioCallback::isTunerFailed() {
+ std::lock_guard<std::mutex> lk(mLock);
+ return tunerFailed;
+}
+
+ProgramInfo MockBroadcastRadioCallback::getCurrentProgramInfo() {
+ std::lock_guard<std::mutex> lk(mLock);
+ return mCurrentProgramInfo;
+}
+
+} // namespace aidl::android::hardware::broadcastradio
diff --git a/broadcastradio/aidl/default/test/MockBroadcastRadioCallback.h b/broadcastradio/aidl/default/test/MockBroadcastRadioCallback.h
new file mode 100644
index 0000000..2ae03e3
--- /dev/null
+++ b/broadcastradio/aidl/default/test/MockBroadcastRadioCallback.h
@@ -0,0 +1,103 @@
+/*
+ * Copyright (C) 2024 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.
+ */
+
+#pragma once
+
+#include <aidl/android/hardware/broadcastradio/BnTunerCallback.h>
+#include <aidl/android/hardware/broadcastradio/ConfigFlag.h>
+#include <aidl/android/hardware/broadcastradio/IBroadcastRadio.h>
+#include <aidl/android/hardware/broadcastradio/ProgramInfo.h>
+#include <aidl/android/hardware/broadcastradio/ProgramListChunk.h>
+#include <aidl/android/hardware/broadcastradio/ProgramSelector.h>
+#include <aidl/android/hardware/broadcastradio/Result.h>
+#include <aidl/android/hardware/broadcastradio/VendorKeyValue.h>
+
+#include <android-base/thread_annotations.h>
+
+#include <broadcastradio-utils-aidl/Utils.h>
+
+#include <condition_variable>
+
+namespace aidl::android::hardware::broadcastradio {
+
+namespace {
+using ::ndk::ScopedAStatus;
+
+} // namespace
+
+class MockBroadcastRadioCallback final : public BnTunerCallback {
+ public:
+ explicit MockBroadcastRadioCallback();
+ ScopedAStatus onTuneFailed(Result result, const ProgramSelector& selector) override;
+ ScopedAStatus onCurrentProgramInfoChanged(const ProgramInfo& info) override;
+ ScopedAStatus onProgramListUpdated(const ProgramListChunk& chunk) override;
+ ScopedAStatus onParametersUpdated(const std::vector<VendorKeyValue>& parameters) override;
+ ScopedAStatus onAntennaStateChange(bool connected) override;
+ ScopedAStatus onConfigFlagUpdated(ConfigFlag in_flag, bool in_value) override;
+
+ bool waitOnCurrentProgramInfoChangedCallback();
+ bool isTunerFailed();
+ void reset();
+
+ ProgramInfo getCurrentProgramInfo();
+
+ private:
+ class CallbackFlag final {
+ public:
+ CallbackFlag(int timeoutMs) { mTimeoutMs = timeoutMs; }
+ /**
+ * Notify that the callback is called.
+ */
+ void notify() {
+ std::unique_lock<std::mutex> lock(mMutex);
+ mCalled = true;
+ lock.unlock();
+ mCv.notify_all();
+ };
+
+ /**
+ * Wait for the timeout passed into the constructor.
+ */
+ bool wait() {
+ std::unique_lock<std::mutex> lock(mMutex);
+ return mCv.wait_for(lock, std::chrono::milliseconds(mTimeoutMs),
+ [this] { return mCalled; });
+ };
+
+ /**
+ * Reset the callback to not called.
+ */
+ void reset() {
+ std::unique_lock<std::mutex> lock(mMutex);
+ mCalled = false;
+ }
+
+ private:
+ std::mutex mMutex;
+ bool mCalled GUARDED_BY(mMutex) = false;
+ std::condition_variable mCv;
+ int mTimeoutMs;
+ };
+
+ std::mutex mLock;
+ bool mAntennaConnectionState GUARDED_BY(mLock);
+ bool tunerFailed GUARDED_BY(mLock) = false;
+ ProgramInfo mCurrentProgramInfo GUARDED_BY(mLock);
+ utils::ProgramInfoSet mProgramList GUARDED_BY(mLock);
+ CallbackFlag mOnCurrentProgramInfoChangedFlag = CallbackFlag(IBroadcastRadio::TUNER_TIMEOUT_MS);
+};
+
+} // namespace aidl::android::hardware::broadcastradio
diff --git a/camera/device/default/ExternalCameraDeviceSession.cpp b/camera/device/default/ExternalCameraDeviceSession.cpp
index a6ec4c7..a16dd7f 100644
--- a/camera/device/default/ExternalCameraDeviceSession.cpp
+++ b/camera/device/default/ExternalCameraDeviceSession.cpp
@@ -789,8 +789,10 @@
outputBuffer.bufferId = buffer.bufferId;
outputBuffer.status = BufferStatus::ERROR;
if (buffer.acquireFence >= 0) {
- outputBuffer.releaseFence.fds.resize(1);
- outputBuffer.releaseFence.fds.at(0).set(buffer.acquireFence);
+ native_handle_t* handle = native_handle_create(/*numFds*/ 1, /*numInts*/ 0);
+ handle->data[0] = buffer.acquireFence;
+ outputBuffer.releaseFence = android::dupToAidl(handle);
+ native_handle_delete(handle);
}
} else {
offlineBuffers.push_back(buffer);
@@ -1389,12 +1391,14 @@
// All buffers are imported. Now validate output buffer acquire fences
for (size_t i = 0; i < numOutputBufs; i++) {
- if (!sHandleImporter.importFence(
- ::android::makeFromAidl(request.outputBuffers[i].acquireFence), allFences[i])) {
+ native_handle_t* h = ::android::makeFromAidl(request.outputBuffers[i].acquireFence);
+ if (!sHandleImporter.importFence(h, allFences[i])) {
ALOGE("%s: output buffer %zu acquire fence is invalid", __FUNCTION__, i);
cleanupInflightFences(allFences, i);
+ native_handle_delete(h);
return Status::INTERNAL_ERROR;
}
+ native_handle_delete(h);
}
return Status::OK;
}
@@ -1768,8 +1772,10 @@
result.outputBuffers[i].bufferId = req->buffers[i].bufferId;
result.outputBuffers[i].status = BufferStatus::ERROR;
if (req->buffers[i].acquireFence >= 0) {
- result.outputBuffers[i].releaseFence.fds.resize(1);
- result.outputBuffers[i].releaseFence.fds.at(0).set(req->buffers[i].acquireFence);
+ native_handle_t* handle = native_handle_create(/*numFds*/ 1, /*numInts*/ 0);
+ handle->data[0] = req->buffers[i].acquireFence;
+ result.outputBuffers[i].releaseFence = android::dupToAidl(handle);
+ native_handle_delete(handle);
}
}
@@ -1813,16 +1819,20 @@
if (req->buffers[i].fenceTimeout) {
result.outputBuffers[i].status = BufferStatus::ERROR;
if (req->buffers[i].acquireFence >= 0) {
- result.outputBuffers[i].releaseFence.fds.resize(1);
- result.outputBuffers[i].releaseFence.fds.at(0).set(req->buffers[i].acquireFence);
+ native_handle_t* handle = native_handle_create(/*numFds*/ 1, /*numInts*/ 0);
+ handle->data[0] = req->buffers[i].acquireFence;
+ result.outputBuffers[i].releaseFence = android::dupToAidl(handle);
+ native_handle_delete(handle);
}
notifyError(req->frameNumber, req->buffers[i].streamId, ErrorCode::ERROR_BUFFER);
} else {
result.outputBuffers[i].status = BufferStatus::OK;
// TODO: refactor
if (req->buffers[i].acquireFence >= 0) {
- result.outputBuffers[i].releaseFence.fds.resize(1);
- result.outputBuffers[i].releaseFence.fds.at(0).set(req->buffers[i].acquireFence);
+ native_handle_t* handle = native_handle_create(/*numFds*/ 1, /*numInts*/ 0);
+ handle->data[0] = req->buffers[i].acquireFence;
+ result.outputBuffers[i].releaseFence = android::dupToAidl(handle);
+ native_handle_delete(handle);
}
}
}
@@ -2086,9 +2096,10 @@
// TODO: create a batch import API so we don't need to lock/unlock mCbsLock
// repeatedly?
lk.unlock();
- Status s =
- parent->importBuffer(streamId, hBuf.bufferId, makeFromAidl(hBuf.buffer),
- /*out*/ &mBufferReqs[i].bufPtr);
+ native_handle_t* h = makeFromAidl(hBuf.buffer);
+ Status s = parent->importBuffer(streamId, hBuf.bufferId, h,
+ /*out*/ &mBufferReqs[i].bufPtr);
+ native_handle_delete(h);
lk.lock();
if (s != Status::OK) {
@@ -2096,12 +2107,14 @@
cleanupInflightFences(importedFences, i - 1);
return false;
}
- if (!sHandleImporter.importFence(makeFromAidl(hBuf.acquireFence),
- mBufferReqs[i].acquireFence)) {
+ h = makeFromAidl(hBuf.acquireFence);
+ if (!sHandleImporter.importFence(h, mBufferReqs[i].acquireFence)) {
ALOGE("%s: stream %d import fence failed!", __FUNCTION__, streamId);
cleanupInflightFences(importedFences, i - 1);
+ native_handle_delete(h);
return false;
}
+ native_handle_delete(h);
importedFences[i] = mBufferReqs[i].acquireFence;
} break;
default:
diff --git a/camera/device/default/ExternalCameraOfflineSession.cpp b/camera/device/default/ExternalCameraOfflineSession.cpp
index 53bd44f..2d4e2e0 100644
--- a/camera/device/default/ExternalCameraOfflineSession.cpp
+++ b/camera/device/default/ExternalCameraOfflineSession.cpp
@@ -110,7 +110,8 @@
if (req->buffers[i].acquireFence >= 0) {
native_handle_t* handle = native_handle_create(/*numFds*/ 1, /*numInts*/ 0);
handle->data[0] = req->buffers[i].acquireFence;
- result.outputBuffers[i].releaseFence = android::makeToAidl(handle);
+ result.outputBuffers[i].releaseFence = android::dupToAidl(handle);
+ native_handle_delete(handle);
}
notifyError(req->frameNumber, req->buffers[i].streamId, ErrorCode::ERROR_BUFFER);
} else {
@@ -119,7 +120,8 @@
if (req->buffers[i].acquireFence >= 0) {
native_handle_t* handle = native_handle_create(/*numFds*/ 1, /*numInts*/ 0);
handle->data[0] = req->buffers[i].acquireFence;
- outputBuffer.releaseFence = android::makeToAidl(handle);
+ outputBuffer.releaseFence = android::dupToAidl(handle);
+ native_handle_delete(handle);
}
}
}
@@ -247,7 +249,8 @@
if (req->buffers[i].acquireFence >= 0) {
native_handle_t* handle = native_handle_create(/*numFds*/ 1, /*numInts*/ 0);
handle->data[0] = req->buffers[i].acquireFence;
- outputBuffer.releaseFence = makeToAidl(handle);
+ outputBuffer.releaseFence = dupToAidl(handle);
+ native_handle_delete(handle);
}
}
diff --git a/camera/device/default/ExternalCameraUtils.cpp b/camera/device/default/ExternalCameraUtils.cpp
index 30c216f..2dc3c77 100644
--- a/camera/device/default/ExternalCameraUtils.cpp
+++ b/camera/device/default/ExternalCameraUtils.cpp
@@ -750,18 +750,12 @@
void freeReleaseFences(std::vector<CaptureResult>& results) {
for (auto& result : results) {
- native_handle_t* inputReleaseFence =
- ::android::makeFromAidl(result.inputBuffer.releaseFence);
- if (inputReleaseFence != nullptr) {
- native_handle_close(inputReleaseFence);
- native_handle_delete(inputReleaseFence);
- }
+ // NativeHandles free fd's on desctruction. Simply delete the objects!
+ result.inputBuffer.releaseFence.fds.clear(); // Implicitly closes fds
+ result.inputBuffer.releaseFence.ints.clear();
for (auto& buf : result.outputBuffers) {
- native_handle_t* outReleaseFence = ::android::makeFromAidl(buf.releaseFence);
- if (outReleaseFence != nullptr) {
- native_handle_close(outReleaseFence);
- native_handle_delete(outReleaseFence);
- }
+ buf.releaseFence.fds.clear(); // Implicitly closes fds
+ buf.releaseFence.ints.clear();
}
}
}
diff --git a/camera/provider/aidl/vts/camera_aidl_test.cpp b/camera/provider/aidl/vts/camera_aidl_test.cpp
index 4fc01bf..7958da9 100644
--- a/camera/provider/aidl/vts/camera_aidl_test.cpp
+++ b/camera/provider/aidl/vts/camera_aidl_test.cpp
@@ -316,14 +316,11 @@
void CameraAidlTest::verifyStreamUseCaseCharacteristics(const camera_metadata_t* metadata) {
camera_metadata_ro_entry entry;
- // Check capabilities
- int retcode =
- find_camera_metadata_ro_entry(metadata, ANDROID_REQUEST_AVAILABLE_CAPABILITIES, &entry);
bool hasStreamUseCaseCap = supportsStreamUseCaseCap(metadata);
bool supportMandatoryUseCases = false;
- retcode = find_camera_metadata_ro_entry(metadata, ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES,
- &entry);
+ int retcode = find_camera_metadata_ro_entry(metadata, ANDROID_SCALER_AVAILABLE_STREAM_USE_CASES,
+ &entry);
if ((0 == retcode) && (entry.count > 0)) {
supportMandatoryUseCases = true;
for (size_t i = 0; i < kMandatoryUseCases.size(); i++) {
diff --git a/health/OWNERS b/health/OWNERS
index 1d4d086..e540d55 100644
--- a/health/OWNERS
+++ b/health/OWNERS
@@ -1,6 +1,6 @@
# Bug component: 30545
apelosi@google.com
-elsk@google.com
+dvander@google.com
smoreland@google.com
wjack@google.com
diff --git a/health/aidl/default/Health.cpp b/health/aidl/default/Health.cpp
index 6df623a..8174bc8 100644
--- a/health/aidl/default/Health.cpp
+++ b/health/aidl/default/Health.cpp
@@ -254,15 +254,6 @@
return healthd_config_->screen_on(&props);
}
-namespace {
-bool IsDeadObjectLogged(const ndk::ScopedAStatus& ret) {
- if (ret.isOk()) return false;
- if (ret.getStatus() == ::STATUS_DEAD_OBJECT) return true;
- LOG(ERROR) << "Cannot call healthInfoChanged on callback: " << ret.getDescription();
- return false;
-}
-} // namespace
-
//
// Subclass helpers / overrides
//
@@ -306,8 +297,10 @@
return ndk::ScopedAStatus::ok();
}
- if (auto res = callback->healthInfoChanged(health_info); IsDeadObjectLogged(res)) {
- (void)unregisterCallback(callback);
+ auto res = callback->healthInfoChanged(health_info);
+ if (!res.isOk()) {
+ LOG(DEBUG) << "Cannot call healthInfoChanged:" << res.getDescription()
+ << ". Do nothing here if callback is dead as it will be cleaned up later.";
}
return ndk::ScopedAStatus::ok();
}
@@ -354,13 +347,13 @@
void Health::OnHealthInfoChanged(const HealthInfo& health_info) {
// Notify all callbacks
std::unique_lock<decltype(callbacks_lock_)> lock(callbacks_lock_);
- // is_dead notifies a callback and return true if it is dead.
- auto is_dead = [&](const auto& linked) {
+ for (const auto& linked : callbacks_) {
auto res = linked->callback()->healthInfoChanged(health_info);
- return IsDeadObjectLogged(res);
- };
- auto it = std::remove_if(callbacks_.begin(), callbacks_.end(), is_dead);
- callbacks_.erase(it, callbacks_.end()); // calls unlinkToDeath on deleted callbacks.
+ if (!res.isOk()) {
+ LOG(DEBUG) << "Cannot call healthInfoChanged:" << res.getDescription()
+ << ". Do nothing here if callback is dead as it will be cleaned up later.";
+ }
+ }
lock.unlock();
// Let HalHealthLoop::OnHealthInfoChanged() adjusts uevent / wakealarm periods
diff --git a/media/bufferpool/aidl/aidl_api/android.hardware.media.bufferpool2/current/android/hardware/media/bufferpool2/IClientManager.aidl b/media/bufferpool/aidl/aidl_api/android.hardware.media.bufferpool2/current/android/hardware/media/bufferpool2/IClientManager.aidl
index 5899a40..298cb13 100644
--- a/media/bufferpool/aidl/aidl_api/android.hardware.media.bufferpool2/current/android/hardware/media/bufferpool2/IClientManager.aidl
+++ b/media/bufferpool/aidl/aidl_api/android.hardware.media.bufferpool2/current/android/hardware/media/bufferpool2/IClientManager.aidl
@@ -35,6 +35,7 @@
@VintfStability
interface IClientManager {
android.hardware.media.bufferpool2.IClientManager.Registration registerSender(in android.hardware.media.bufferpool2.IAccessor bufferPool);
+ android.hardware.media.bufferpool2.IClientManager.Registration registerPassiveSender(in android.hardware.media.bufferpool2.IAccessor bufferPool);
@VintfStability
parcelable Registration {
long connectionId;
diff --git a/media/bufferpool/aidl/android/hardware/media/bufferpool2/IClientManager.aidl b/media/bufferpool/aidl/android/hardware/media/bufferpool2/IClientManager.aidl
index a3054cb..2bc77bc 100644
--- a/media/bufferpool/aidl/android/hardware/media/bufferpool2/IClientManager.aidl
+++ b/media/bufferpool/aidl/android/hardware/media/bufferpool2/IClientManager.aidl
@@ -40,7 +40,8 @@
/**
* Sets up a buffer receiving communication node for the specified
* buffer pool. A manager must create a IConnection to the buffer
- * pool if it does not already have a connection.
+ * pool if it does not already have a connection. To transfer buffers
+ * using the interface, the sender must initiates transfer.
*
* @param bufferPool a buffer pool which is specified with the IAccessor.
* The specified buffer pool is the owner of received buffers.
@@ -52,4 +53,21 @@
* ResultStatus::CRITICAL_ERROR - Other errors.
*/
Registration registerSender(in IAccessor bufferPool);
+
+ /**
+ * Sets up a buffer receiving communication node for the specified
+ * buffer pool. A manager must create a IConnection to the buffer
+ * pool if it does not already have a connection. To transfer buffers
+ * using the interface, the receiver must initiates transfer(on demand).
+ *
+ * @param bufferPool a buffer pool which is specified with the IAccessor.
+ * The specified buffer pool is the owner of received buffers.
+ * @return the Id of the communication node to the buffer pool.
+ * This id is used in FMQ to notify IAccessor that a buffer has been
+ * sent to that connection during transfers.
+ * @throws ServiceSpecificException with one of the following values:
+ * ResultStatus::NO_MEMORY - Memory allocation failure occurred.
+ * ResultStatus::CRITICAL_ERROR - Other errors.
+ */
+ Registration registerPassiveSender(in IAccessor bufferPool);
}
diff --git a/media/bufferpool/aidl/default/ClientManager.cpp b/media/bufferpool/aidl/default/ClientManager.cpp
index de1db50..138790d 100644
--- a/media/bufferpool/aidl/default/ClientManager.cpp
+++ b/media/bufferpool/aidl/default/ClientManager.cpp
@@ -422,6 +422,14 @@
return ::ndk::ScopedAStatus::ok();
}
+::ndk::ScopedAStatus ClientManager::registerPassiveSender(
+ const std::shared_ptr<IAccessor>& in_bufferPool, Registration* _aidl_return) {
+ // TODO
+ (void) in_bufferPool;
+ (void) _aidl_return;
+ return ::ndk::ScopedAStatus::fromServiceSpecificError(ResultStatus::NOT_FOUND);
+}
+
// Methods for local use.
std::shared_ptr<ClientManager> ClientManager::sInstance;
std::mutex ClientManager::sInstanceLock;
diff --git a/media/bufferpool/aidl/default/include/bufferpool2/ClientManager.h b/media/bufferpool/aidl/default/include/bufferpool2/ClientManager.h
index bff75ba..4b0916f 100644
--- a/media/bufferpool/aidl/default/include/bufferpool2/ClientManager.h
+++ b/media/bufferpool/aidl/default/include/bufferpool2/ClientManager.h
@@ -34,6 +34,11 @@
::aidl::android::hardware::media::bufferpool2::IClientManager::Registration* _aidl_return)
override;
+ ::ndk::ScopedAStatus registerPassiveSender(
+ const std::shared_ptr<IAccessor>& in_bufferPool,
+ ::aidl::android::hardware::media::bufferpool2::IClientManager::Registration* _aidl_return)
+ override;
+
/** Gets an instance. */
static std::shared_ptr<ClientManager> getInstance();
diff --git a/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/IComponent.aidl b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/IComponent.aidl
index 4439bc5..0a7e3c4 100644
--- a/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/IComponent.aidl
+++ b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/IComponent.aidl
@@ -51,12 +51,18 @@
long blockPoolId;
android.hardware.media.c2.IConfigurable configurable;
}
- parcelable C2AidlGbAllocator {
- android.hardware.media.c2.IGraphicBufferAllocator igba;
+ parcelable GbAllocator {
ParcelFileDescriptor waitableFd;
+ android.hardware.media.c2.IGraphicBufferAllocator igba;
}
- union BlockPoolAllocator {
+ parcelable PooledGbAllocator {
+ ParcelFileDescriptor waitableFd;
+ long receiverId;
+ android.hardware.media.c2.IPooledGraphicBufferAllocator ipgba;
+ }
+ parcelable BlockPoolAllocator {
int allocatorId;
- android.hardware.media.c2.IComponent.C2AidlGbAllocator allocator;
+ @nullable android.hardware.media.c2.IComponent.GbAllocator gbAllocator;
+ @nullable android.hardware.media.c2.IComponent.PooledGbAllocator pooledGbAllocator;
}
}
diff --git a/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/IPooledGraphicBufferAllocator.aidl b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/IPooledGraphicBufferAllocator.aidl
new file mode 100644
index 0000000..1a8c66d
--- /dev/null
+++ b/media/c2/aidl/aidl_api/android.hardware.media.c2/current/android/hardware/media/c2/IPooledGraphicBufferAllocator.aidl
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2024 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.media.c2;
+@VintfStability
+interface IPooledGraphicBufferAllocator {
+ android.hardware.media.c2.IPooledGraphicBufferAllocator.Allocation allocate(in android.hardware.media.c2.IPooledGraphicBufferAllocator.Description desc);
+ boolean deallocate(in int id);
+ parcelable Allocation {
+ int bufferId;
+ @nullable ParcelFileDescriptor fence;
+ }
+ parcelable Description {
+ int widthPixels;
+ int heightPixels;
+ int format;
+ long usage;
+ }
+}
diff --git a/media/c2/aidl/android/hardware/media/c2/IComponent.aidl b/media/c2/aidl/android/hardware/media/c2/IComponent.aidl
index ed2eaf4..387d70a 100644
--- a/media/c2/aidl/android/hardware/media/c2/IComponent.aidl
+++ b/media/c2/aidl/android/hardware/media/c2/IComponent.aidl
@@ -24,6 +24,7 @@
import android.hardware.media.c2.IInputSink;
import android.hardware.media.c2.IInputSurface;
import android.hardware.media.c2.IInputSurfaceConnection;
+import android.hardware.media.c2.IPooledGraphicBufferAllocator;
import android.hardware.media.c2.WorkBundle;
import android.os.ParcelFileDescriptor;
@@ -57,20 +58,36 @@
* graphic blocks. the waitable fd is used to create a specific type of
* C2Fence which can be used for waiting until to allocate is not blocked.
*/
- parcelable C2AidlGbAllocator {
- IGraphicBufferAllocator igba;
+ parcelable GbAllocator {
ParcelFileDescriptor waitableFd;
+ IGraphicBufferAllocator igba;
}
/**
+ * C2AIDL allocator interface based on media.bufferpool2 along with a waitable fd.
+ *
+ * The interface is used from a specific type of C2BlockPool to allocate
+ * graphic blocks. the waitable fd is used to create a specific type of
+ * C2Fence which can be used for waiting until to allocate is not blocked.
+ * receiverId is id of receiver IConnection of media.bufferpool2.
+ */
+ parcelable PooledGbAllocator {
+ ParcelFileDescriptor waitableFd;
+ long receiverId;
+ IPooledGraphicBufferAllocator ipgba;
+ }
+
+
+ /**
* Allocator for C2BlockPool.
*
* C2BlockPool will use a C2Allocator which is specified by an id.
- * or C2AIDL allocator interface directly.
+ * Based on allocator id, allocator is specified.
*/
- union BlockPoolAllocator {
+ parcelable BlockPoolAllocator {
int allocatorId;
- C2AidlGbAllocator allocator;
+ @nullable GbAllocator gbAllocator;
+ @nullable PooledGbAllocator pooledGbAllocator;
}
/**
diff --git a/media/c2/aidl/android/hardware/media/c2/IPooledGraphicBufferAllocator.aidl b/media/c2/aidl/android/hardware/media/c2/IPooledGraphicBufferAllocator.aidl
new file mode 100644
index 0000000..b599d52
--- /dev/null
+++ b/media/c2/aidl/android/hardware/media/c2/IPooledGraphicBufferAllocator.aidl
@@ -0,0 +1,77 @@
+/*
+ * Copyright (C) 2024 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.media.c2;
+
+import android.os.ParcelFileDescriptor;
+
+/**
+ * Interface for decoder output buffer allocator for HAL process
+ *
+ * A graphic buffer for decoder output is allocated by the interface.
+ */
+@VintfStability
+interface IPooledGraphicBufferAllocator {
+ /**
+ * A graphic buffer allocation.
+ *
+ * bufferId is id of buffer from a media.bufferpool2. The buffer is
+ * android.hardware.HardwareBuffer.
+ * fence is provided in order to signal readiness of the buffer I/O inside
+ * underlying Graphics subsystem. This is called a sync fence throughout Android framework.
+ */
+ parcelable Allocation {
+ int bufferId;
+ @nullable ParcelFileDescriptor fence;
+ }
+
+ /**
+ * Parameters for a graphic buffer allocation.
+ *
+ * Refer to AHardwareBuffer_Desc(libnativewindow) for details.
+ */
+ parcelable Description {
+ int widthPixels;
+ int heightPixels;
+ int format; // AHardwareBuffer_Format
+ long usage; // AHardwareBuffer_UsageFlags
+ }
+
+ /**
+ * Allocate a graphic buffer.
+ * deallocate() must be called after the allocated buffer is no longer needed.
+ *
+ * @param desc Allocation parameters.
+ * @return an id of a buffer, the id is created from media.bufferpool2 in order for
+ * caching and recycling,
+ * If underlying allocator is blocked, c2::Status::Blocked will be returned.
+ * Waitable fd must be obtained using the ndk object locally. The waitable fd must
+ * be passed to the receiver during BlockPool creation request via AIDL.
+ * @throws ServiceSpecificException with one of the following values:
+ * - `c2::Status::BAD_STATE` - The client is not in running states.
+ * - `c2::Status::BLOCKED` - Underlying graphics system is blocked.
+ * - `c2::Status::CORRUPTED` - Some unknown error occurred.
+ */
+ Allocation allocate(in Description desc);
+
+ /**
+ * De-allocate a graphic buffer by graphic buffer's unique id.
+ *
+ * @param id buffer id.
+ * @return {@code true} when de-allocate happened, {@code false} otherwise.
+ */
+ boolean deallocate(in int id);
+}
diff --git a/media/omx/1.0/vts/functional/video/VtsHalMediaOmxV1_0TargetVideoEncTest.cpp b/media/omx/1.0/vts/functional/video/VtsHalMediaOmxV1_0TargetVideoEncTest.cpp
index f24c6d1..9a75e6e 100644
--- a/media/omx/1.0/vts/functional/video/VtsHalMediaOmxV1_0TargetVideoEncTest.cpp
+++ b/media/omx/1.0/vts/functional/video/VtsHalMediaOmxV1_0TargetVideoEncTest.cpp
@@ -630,10 +630,7 @@
if (error != android::NO_ERROR) return 1;
} else {
void* data;
- int32_t outBytesPerPixel;
- int32_t outBytesPerStride;
- error = gbmapper.lock(buff, buffer->omxBuffer.attr.anwBuffer.usage, rect, &data,
- &outBytesPerPixel, &outBytesPerStride);
+ error = gbmapper.lock(buff, buffer->omxBuffer.attr.anwBuffer.usage, rect, &data);
EXPECT_EQ(error, android::NO_ERROR);
if (error != android::NO_ERROR) return 1;
diff --git a/power/aidl/aidl_api/android.hardware.power/current/android/hardware/power/ChannelMessage.aidl b/power/aidl/aidl_api/android.hardware.power/current/android/hardware/power/ChannelMessage.aidl
index 25f01c0..ab38fcc 100644
--- a/power/aidl/aidl_api/android.hardware.power/current/android/hardware/power/ChannelMessage.aidl
+++ b/power/aidl/aidl_api/android.hardware.power/current/android/hardware/power/ChannelMessage.aidl
@@ -35,10 +35,11 @@
@FixedSize @VintfStability
parcelable ChannelMessage {
int sessionID;
+ long timeStampNanos;
android.hardware.power.ChannelMessage.ChannelMessageContents data;
@FixedSize @VintfStability
union ChannelMessageContents {
- int[20] tids = {(-1) /* -1 */, (-1) /* -1 */, (-1) /* -1 */, (-1) /* -1 */, (-1) /* -1 */, (-1) /* -1 */, (-1) /* -1 */, (-1) /* -1 */, (-1) /* -1 */, (-1) /* -1 */, (-1) /* -1 */, (-1) /* -1 */, (-1) /* -1 */, (-1) /* -1 */, (-1) /* -1 */, (-1) /* -1 */, (-1) /* -1 */, (-1) /* -1 */, (-1) /* -1 */, (-1) /* -1 */};
+ long[16] reserved = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
long targetDuration;
android.hardware.power.SessionHint hint;
android.hardware.power.ChannelMessage.ChannelMessageContents.SessionModeSetter mode;
diff --git a/power/aidl/aidl_api/android.hardware.power/current/android/hardware/power/WorkDurationFixedV1.aidl b/power/aidl/aidl_api/android.hardware.power/current/android/hardware/power/WorkDurationFixedV1.aidl
index 8cd246d..45310b8 100644
--- a/power/aidl/aidl_api/android.hardware.power/current/android/hardware/power/WorkDurationFixedV1.aidl
+++ b/power/aidl/aidl_api/android.hardware.power/current/android/hardware/power/WorkDurationFixedV1.aidl
@@ -34,7 +34,6 @@
package android.hardware.power;
@FixedSize @VintfStability
parcelable WorkDurationFixedV1 {
- long timeStampNanos;
long durationNanos;
long workPeriodStartTimestampNanos;
long cpuDurationNanos;
diff --git a/power/aidl/android/hardware/power/ChannelMessage.aidl b/power/aidl/android/hardware/power/ChannelMessage.aidl
index 4747d90..fa16911 100644
--- a/power/aidl/android/hardware/power/ChannelMessage.aidl
+++ b/power/aidl/android/hardware/power/ChannelMessage.aidl
@@ -38,6 +38,12 @@
int sessionID;
/**
+ * Timestamp in nanoseconds based on CLOCK_MONOTONIC when the message was sent,
+ * used to ensure all messages can be processed in a coherent order.
+ */
+ long timeStampNanos;
+
+ /**
* A union defining the different messages that can be passed through the
* channel. Each type corresponds to a different call in IPowerHintSession.
*/
@@ -47,12 +53,9 @@
@VintfStability
union ChannelMessageContents {
/**
- * List of TIDs for this session to change to. Can be used in cases
- * where HintManagerService is not needed to validate the TIDs, such as
- * when all TIDs directly belong to the process that owns the session.
+ * Reserves the maximum fixed size for the ChannelMessage.
*/
- int[20] tids = {
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1};
+ long[16] reserved = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
/**
* Setting this field will update the session’s target duration, equivalent
diff --git a/power/aidl/android/hardware/power/WorkDurationFixedV1.aidl b/power/aidl/android/hardware/power/WorkDurationFixedV1.aidl
index 2d202ff..ef5c755 100644
--- a/power/aidl/android/hardware/power/WorkDurationFixedV1.aidl
+++ b/power/aidl/android/hardware/power/WorkDurationFixedV1.aidl
@@ -20,12 +20,6 @@
@VintfStability
parcelable WorkDurationFixedV1 {
/**
- * Timestamp in nanoseconds based on CLOCK_MONOTONIC when the duration
- * sample was measured.
- */
- long timeStampNanos;
-
- /**
* Total work duration in nanoseconds.
*/
long durationNanos;
diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/ConnectionEvent.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/ConnectionEvent.aidl
index eedb8ed..1529512 100644
--- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/ConnectionEvent.aidl
+++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/ConnectionEvent.aidl
@@ -42,9 +42,13 @@
NAS_SIGNALLING_LTE = 4,
AS_SIGNALLING_LTE = 5,
VOLTE_SIP = 6,
- VOLTE_RTP = 7,
- NAS_SIGNALLING_5G = 8,
- AS_SIGNALLING_5G = 9,
- VONR_SIP = 10,
- VONR_RTP = 11,
+ VOLTE_SIP_SOS = 7,
+ VOLTE_RTP = 8,
+ VOLTE_RTP_SOS = 9,
+ NAS_SIGNALLING_5G = 10,
+ AS_SIGNALLING_5G = 11,
+ VONR_SIP = 12,
+ VONR_SIP_SOS = 13,
+ VONR_RTP = 14,
+ VONR_RTP_SOS = 15,
}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/SecurityAlgorithm.aidl b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/SecurityAlgorithm.aidl
index c590d2b..c3333bf 100644
--- a/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/SecurityAlgorithm.aidl
+++ b/radio/aidl/aidl_api/android.hardware.radio.network/current/android/hardware/radio/network/SecurityAlgorithm.aidl
@@ -57,6 +57,7 @@
NEA1 = 56,
NEA2 = 57,
NEA3 = 58,
+ SIP_NO_IPSEC_CONFIG = 66,
IMS_NULL = 67,
SIP_NULL = 68,
AES_GCM = 69,
@@ -66,6 +67,7 @@
AES_EDE3_CBC = 73,
HMAC_SHA1_96 = 74,
HMAC_MD5_96 = 75,
+ RTP = 85,
SRTP_NULL = 86,
SRTP_AES_COUNTER = 87,
SRTP_AES_F8 = 88,
diff --git a/radio/aidl/android/hardware/radio/network/ConnectionEvent.aidl b/radio/aidl/android/hardware/radio/network/ConnectionEvent.aidl
index 2e39ebf..d5f367f 100644
--- a/radio/aidl/android/hardware/radio/network/ConnectionEvent.aidl
+++ b/radio/aidl/android/hardware/radio/network/ConnectionEvent.aidl
@@ -42,14 +42,20 @@
AS_SIGNALLING_LTE = 5,
// VoLTE
+ // Note: emergency calls could use either normal or SOS (emergency) PDN in practice
VOLTE_SIP = 6,
- VOLTE_RTP = 7,
+ VOLTE_SIP_SOS = 7,
+ VOLTE_RTP = 8,
+ VOLTE_RTP_SOS = 9,
// 5G packet services
- NAS_SIGNALLING_5G = 8,
- AS_SIGNALLING_5G = 9,
+ NAS_SIGNALLING_5G = 10,
+ AS_SIGNALLING_5G = 11,
// VoNR
- VONR_SIP = 10,
- VONR_RTP = 11,
+ // Note: emergency calls could use either normal or SOS (emergency) PDN in practice
+ VONR_SIP = 12,
+ VONR_SIP_SOS = 13,
+ VONR_RTP = 14,
+ VONR_RTP_SOS = 15
}
diff --git a/radio/aidl/android/hardware/radio/network/SecurityAlgorithm.aidl b/radio/aidl/android/hardware/radio/network/SecurityAlgorithm.aidl
index 19feeef..01f7327 100644
--- a/radio/aidl/android/hardware/radio/network/SecurityAlgorithm.aidl
+++ b/radio/aidl/android/hardware/radio/network/SecurityAlgorithm.aidl
@@ -60,7 +60,11 @@
NEA3 = 58,
// IMS and SIP layer security (See 3GPP TS 33.203)
+ // No IPsec config
+ SIP_NO_IPSEC_CONFIG = 66,
IMS_NULL = 67,
+
+ // Has IPsec config
SIP_NULL = 68,
AES_GCM = 69,
AES_GMAC = 70,
@@ -70,7 +74,10 @@
HMAC_SHA1_96 = 74,
HMAC_MD5_96 = 75,
- // RTP (see 3GPP TS 33.328)
+ // RTP and SRTP (see 3GPP TS 33.328)
+ // When SRTP is not being used
+ RTP = 85,
+ // When SRTP is available and used
SRTP_NULL = 86,
SRTP_AES_COUNTER = 87,
SRTP_AES_F8 = 88,
diff --git a/radio/aidl/vts/radio_network_test.cpp b/radio/aidl/vts/radio_network_test.cpp
index 2e218c0..867be04 100644
--- a/radio/aidl/vts/radio_network_test.cpp
+++ b/radio/aidl/vts/radio_network_test.cpp
@@ -883,7 +883,7 @@
ALOGI("setLinkCapacityReportingCriteria_invalidHysteresisDlKbps, rspInfo.error = %s\n",
toString(radioRsp_network->rspInfo.error).c_str());
- ASSERT_TRUE(CheckAnyOfErrors(radioRsp_network->rspInfo.error, {RadioError::INVALID_ARGUMENTS}));
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_network->rspInfo.error, {RadioError::INVALID_ARGUMENTS, RadioError::REQUEST_NOT_SUPPORTED}));
}
/*
@@ -909,7 +909,7 @@
ALOGI("setLinkCapacityReportingCriteria_invalidHysteresisUlKbps, rspInfo.error = %s\n",
toString(radioRsp_network->rspInfo.error).c_str());
- ASSERT_TRUE(CheckAnyOfErrors(radioRsp_network->rspInfo.error, {RadioError::INVALID_ARGUMENTS}));
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_network->rspInfo.error, {RadioError::INVALID_ARGUMENTS, RadioError::REQUEST_NOT_SUPPORTED}));
}
/*
@@ -934,7 +934,7 @@
ALOGI("setLinkCapacityReportingCriteria_emptyParams, rspInfo.error = %s\n",
toString(radioRsp_network->rspInfo.error).c_str());
- ASSERT_TRUE(CheckAnyOfErrors(radioRsp_network->rspInfo.error, {RadioError::NONE}));
+ ASSERT_TRUE(CheckAnyOfErrors(radioRsp_network->rspInfo.error, {RadioError::NONE, RadioError::REQUEST_NOT_SUPPORTED}));
}
/*
diff --git a/radio/aidl/vts/radio_network_utils.h b/radio/aidl/vts/radio_network_utils.h
index 470ee73..ad530eb 100644
--- a/radio/aidl/vts/radio_network_utils.h
+++ b/radio/aidl/vts/radio_network_utils.h
@@ -38,16 +38,16 @@
RadioResponseInfo rspInfo;
std::vector<RadioBandMode> radioBandModes;
std::vector<OperatorInfo> networkInfos;
- bool isNrDualConnectivityEnabled;
- int networkTypeBitmapResponse;
+ bool isNrDualConnectivityEnabled = false;
+ int networkTypeBitmapResponse = 0;
RegStateResult voiceRegResp;
RegStateResult dataRegResp;
CellIdentity barringCellIdentity;
std::vector<BarringInfo> barringInfoList;
UsageSetting usageSetting;
std::vector<RadioAccessSpecifier> specifiers;
- bool isCellularIdentifierTransparencyEnabled;
- bool isSecurityAlgorithmsUpdatedEnabled;
+ bool isCellularIdentifierTransparencyEnabled = false;
+ bool isSecurityAlgorithmsUpdatedEnabled = false;
virtual ndk::ScopedAStatus acknowledgeRequest(int32_t serial) override;
diff --git a/wifi/aidl/vts/functional/wifi_sta_iface_aidl_test.cpp b/wifi/aidl/vts/functional/wifi_sta_iface_aidl_test.cpp
index f09a26b..fa7149f 100644
--- a/wifi/aidl/vts/functional/wifi_sta_iface_aidl_test.cpp
+++ b/wifi/aidl/vts/functional/wifi_sta_iface_aidl_test.cpp
@@ -71,7 +71,7 @@
// Checks if the mDNS Offload is supported by any NIC.
bool isMdnsOffloadPresentInNIC() {
- return testing::deviceSupportsFeature("android.hardware.mdns_offload");
+ return testing::deviceSupportsFeature("com.google.android.tv.mdns_offload");
}
// Detected panel TV device by using ro.oem.key1 property.