Merge "Camera: ANAPIC AIDL feedback" into main
diff --git a/audio/aidl/vts/EffectFactoryHelper.h b/audio/aidl/vts/EffectFactoryHelper.h
index ca36655..7100431 100644
--- a/audio/aidl/vts/EffectFactoryHelper.h
+++ b/audio/aidl/vts/EffectFactoryHelper.h
@@ -24,6 +24,7 @@
#include <aidl/Vintf.h>
#include <android/binder_auto_utils.h>
+#include "AudioHalBinderServiceUtil.h"
#include "TestUtils.h"
using namespace android;
diff --git a/audio/aidl/vts/EffectHelper.h b/audio/aidl/vts/EffectHelper.h
index 9fa7f9f..0be4e50 100644
--- a/audio/aidl/vts/EffectHelper.h
+++ b/audio/aidl/vts/EffectHelper.h
@@ -35,7 +35,6 @@
#include <system/audio_effects/aidl_effects_utils.h>
#include <system/audio_effects/effect_uuid.h>
-#include "AudioHalBinderServiceUtil.h"
#include "EffectFactoryHelper.h"
#include "TestUtils.h"
diff --git a/audio/aidl/vts/VtsHalAudioEffectFactoryTargetTest.cpp b/audio/aidl/vts/VtsHalAudioEffectFactoryTargetTest.cpp
index 523f20d..adf1da7 100644
--- a/audio/aidl/vts/VtsHalAudioEffectFactoryTargetTest.cpp
+++ b/audio/aidl/vts/VtsHalAudioEffectFactoryTargetTest.cpp
@@ -32,7 +32,6 @@
#include <aidl/android/hardware/audio/effect/IFactory.h>
-#include "AudioHalBinderServiceUtil.h"
#include "EffectFactoryHelper.h"
#include "TestUtils.h"
diff --git a/audio/aidl/vts/VtsHalAudioEffectTargetTest.cpp b/audio/aidl/vts/VtsHalAudioEffectTargetTest.cpp
index 01cdd81..1e6a49f 100644
--- a/audio/aidl/vts/VtsHalAudioEffectTargetTest.cpp
+++ b/audio/aidl/vts/VtsHalAudioEffectTargetTest.cpp
@@ -29,7 +29,6 @@
#include <android/binder_process.h>
#include <fmq/AidlMessageQueue.h>
-#include "AudioHalBinderServiceUtil.h"
#include "EffectFactoryHelper.h"
#include "EffectHelper.h"
#include "TestUtils.h"
diff --git a/audio/aidl/vts/VtsHalEqualizerTargetTest.cpp b/audio/aidl/vts/VtsHalEqualizerTargetTest.cpp
index 76838cef..d7dbe38 100644
--- a/audio/aidl/vts/VtsHalEqualizerTargetTest.cpp
+++ b/audio/aidl/vts/VtsHalEqualizerTargetTest.cpp
@@ -29,7 +29,6 @@
#include <android/binder_process.h>
#include <gtest/gtest.h>
-#include "AudioHalBinderServiceUtil.h"
#include "EffectHelper.h"
#include "TestUtils.h"
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/IBluetoothAudioProvider.aidl b/bluetooth/audio/aidl/aidl_api/android.hardware.bluetooth.audio/current/android/hardware/bluetooth/audio/IBluetoothAudioProvider.aidl
index 3a2dcef..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,7 +41,7 @@
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);
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);
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/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/IBluetoothAudioProvider.aidl b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/IBluetoothAudioProvider.aidl
index 1424431..33af8a4 100644
--- a/bluetooth/audio/aidl/android/hardware/bluetooth/audio/IBluetoothAudioProvider.aidl
+++ b/bluetooth/audio/aidl/android/hardware/bluetooth/audio/IBluetoothAudioProvider.aidl
@@ -133,7 +133,7 @@
* 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()`.
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/broadcastradio/aidl/default/test/DefaultBroadcastRadioHalTest.cpp b/broadcastradio/aidl/default/test/DefaultBroadcastRadioHalTest.cpp
index f0cc9a2..8e85a1b 100644
--- a/broadcastradio/aidl/default/test/DefaultBroadcastRadioHalTest.cpp
+++ b/broadcastradio/aidl/default/test/DefaultBroadcastRadioHalTest.cpp
@@ -72,6 +72,13 @@
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 {
@@ -88,6 +95,28 @@
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;
};
@@ -168,4 +197,53 @@
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/common/utilsaidl/test/BroadcastRadioUtilsTest.cpp b/broadcastradio/common/utilsaidl/test/BroadcastRadioUtilsTest.cpp
index 44f4d88..87223e8 100644
--- a/broadcastradio/common/utilsaidl/test/BroadcastRadioUtilsTest.cpp
+++ b/broadcastradio/common/utilsaidl/test/BroadcastRadioUtilsTest.cpp
@@ -66,6 +66,177 @@
.bandResult = utils::FrequencyBand::UNKNOWN}});
}
+struct IsValidIdentifierTestCase {
+ std::string name;
+ ProgramIdentifier id;
+ bool valid;
+};
+
+std::vector<IsValidIdentifierTestCase> getIsValidIdentifierTestCases() {
+ return std::vector<IsValidIdentifierTestCase>({
+ IsValidIdentifierTestCase{.name = "invalid_id_type",
+ .id = utils::makeIdentifier(IdentifierType::INVALID, 0),
+ .valid = false},
+ IsValidIdentifierTestCase{
+ .name = "invalid_dab_frequency_high",
+ .id = utils::makeIdentifier(IdentifierType::DAB_FREQUENCY_KHZ, 10000000u),
+ .valid = false},
+ IsValidIdentifierTestCase{
+ .name = "invalid_dab_frequency_low",
+ .id = utils::makeIdentifier(IdentifierType::DAB_FREQUENCY_KHZ, 100000u),
+ .valid = false},
+ IsValidIdentifierTestCase{
+ .name = "valid_dab_frequency",
+ .id = utils::makeIdentifier(IdentifierType::DAB_FREQUENCY_KHZ, 1000000u),
+ .valid = true},
+ IsValidIdentifierTestCase{
+ .name = "invalid_am_fm_frequency_high",
+ .id = utils::makeIdentifier(IdentifierType::AMFM_FREQUENCY_KHZ, 10000000u),
+ .valid = false},
+ IsValidIdentifierTestCase{
+ .name = "invalid_am_fm_frequency_low",
+ .id = utils::makeIdentifier(IdentifierType::AMFM_FREQUENCY_KHZ, 100u),
+ .valid = false},
+ IsValidIdentifierTestCase{.name = "valid_am_fm_frequency",
+ .id = utils::makeIdentifier(
+ IdentifierType::AMFM_FREQUENCY_KHZ, kFmFrequencyKHz),
+ .valid = true},
+ IsValidIdentifierTestCase{
+ .name = "drmo_frequency_high",
+ .id = utils::makeIdentifier(IdentifierType::DRMO_FREQUENCY_KHZ, 10000000u),
+ .valid = false},
+ IsValidIdentifierTestCase{
+ .name = "drmo_frequency_low",
+ .id = utils::makeIdentifier(IdentifierType::DRMO_FREQUENCY_KHZ, 100u),
+ .valid = false},
+ IsValidIdentifierTestCase{.name = "valid_drmo_frequency",
+ .id = utils::makeIdentifier(
+ IdentifierType::DRMO_FREQUENCY_KHZ, kFmFrequencyKHz),
+ .valid = true},
+ IsValidIdentifierTestCase{.name = "invalid_rds_low",
+ .id = utils::makeIdentifier(IdentifierType::RDS_PI, 0x0),
+ .valid = false},
+ IsValidIdentifierTestCase{.name = "invalid_rds_high",
+ .id = utils::makeIdentifier(IdentifierType::RDS_PI, 0x10000),
+ .valid = false},
+ IsValidIdentifierTestCase{.name = "valid_rds",
+ .id = utils::makeIdentifier(IdentifierType::RDS_PI, 0x1000),
+ .valid = true},
+ IsValidIdentifierTestCase{
+ .name = "invalid_hd_id_zero",
+ .id = utils::makeSelectorHd(/* stationId= */ 0u, kHdSubChannel, kHdFrequency)
+ .primaryId,
+ .valid = false},
+ IsValidIdentifierTestCase{
+ .name = "invalid_hd_suchannel",
+ .id = utils::makeSelectorHd(kHdStationId, /* subChannel= */ 8u, kHdFrequency)
+ .primaryId,
+ .valid = false},
+ IsValidIdentifierTestCase{
+ .name = "invalid_hd_frequency_low",
+ .id = utils::makeSelectorHd(kHdStationId, kHdSubChannel, /* frequency= */ 100u)
+ .primaryId,
+ .valid = false},
+ IsValidIdentifierTestCase{
+ .name = "valid_hd_id",
+ .id = utils::makeSelectorHd(kHdStationId, kHdSubChannel, kHdFrequency)
+ .primaryId,
+ .valid = true},
+ IsValidIdentifierTestCase{
+ .name = "invalid_hd_station_name",
+ .id = utils::makeIdentifier(IdentifierType::HD_STATION_NAME, 0x41422D464D),
+ .valid = false},
+ IsValidIdentifierTestCase{
+ .name = "valid_hd_station_name",
+ .id = utils::makeIdentifier(IdentifierType::HD_STATION_NAME, 0x414231464D),
+ .valid = true},
+ IsValidIdentifierTestCase{
+ .name = "invalid_dab_sid",
+ .id = utils::makeIdentifier(IdentifierType::DAB_SID_EXT, 0x0E100000000u),
+ .valid = false},
+ IsValidIdentifierTestCase{
+ .name = "invalid_dab_ecc_low",
+ .id = utils::makeIdentifier(IdentifierType::DAB_SID_EXT, 0x0F700000221u),
+ .valid = false},
+ IsValidIdentifierTestCase{
+ .name = "invalid_dab_ecc_high",
+ .id = utils::makeIdentifier(IdentifierType::DAB_SID_EXT, 0x09900000221u),
+ .valid = false},
+ IsValidIdentifierTestCase{
+ .name = "valid_dab_sid_ext",
+ .id = utils::makeIdentifier(IdentifierType::DAB_SID_EXT, kDabSidExt),
+ .valid = true},
+ IsValidIdentifierTestCase{
+ .name = "invalid_dab_ensemble_zero",
+ .id = utils::makeIdentifier(IdentifierType::DAB_ENSEMBLE, 0x0),
+ .valid = false},
+ IsValidIdentifierTestCase{
+ .name = "invalid_dab_ensemble_high",
+ .id = utils::makeIdentifier(IdentifierType::DAB_ENSEMBLE, 0x10000),
+ .valid = false},
+ IsValidIdentifierTestCase{
+ .name = "valid_dab_ensemble",
+ .id = utils::makeIdentifier(IdentifierType::DAB_ENSEMBLE, kDabEnsemble),
+ .valid = true},
+ IsValidIdentifierTestCase{.name = "invalid_dab_scid_low",
+ .id = utils::makeIdentifier(IdentifierType::DAB_SCID, 0xF),
+ .valid = false},
+ IsValidIdentifierTestCase{.name = "invalid_dab_scid_high",
+ .id = utils::makeIdentifier(IdentifierType::DAB_SCID, 0x1000),
+ .valid = false},
+ IsValidIdentifierTestCase{.name = "valid_dab_scid",
+ .id = utils::makeIdentifier(IdentifierType::DAB_SCID, 0x100),
+ .valid = true},
+ IsValidIdentifierTestCase{
+ .name = "invalid_drmo_id_zero",
+ .id = utils::makeIdentifier(IdentifierType::DRMO_SERVICE_ID, 0x0),
+ .valid = false},
+ IsValidIdentifierTestCase{
+ .name = "invalid_drmo_id_high",
+ .id = utils::makeIdentifier(IdentifierType::DRMO_SERVICE_ID, 0x1000000),
+ .valid = false},
+ IsValidIdentifierTestCase{
+ .name = "valid_drmo_id",
+ .id = utils::makeIdentifier(IdentifierType::DRMO_SERVICE_ID, 0x100000),
+ .valid = true},
+ });
+}
+
+struct IsValidSelectorTestCase {
+ std::string name;
+ ProgramSelector sel;
+ bool valid;
+};
+
+std::vector<IsValidSelectorTestCase> getIsValidSelectorTestCases() {
+ return std::vector<IsValidSelectorTestCase>({
+ IsValidSelectorTestCase{.name = "valid_am_fm_selector",
+ .sel = utils::makeSelectorAmfm(kFmFrequencyKHz),
+ .valid = true},
+ IsValidSelectorTestCase{
+ .name = "valid_hd_selector",
+ .sel = utils::makeSelectorHd(kHdStationId, kHdSubChannel, kHdFrequency),
+ .valid = true},
+ IsValidSelectorTestCase{
+ .name = "valid_dab_selector",
+ .sel = utils::makeSelectorDab(kDabSidExt, kDabEnsemble, kDabFrequencyKhz),
+ .valid = true},
+ IsValidSelectorTestCase{.name = "valid_rds_selector",
+ .sel = ProgramSelector{.primaryId = utils::makeIdentifier(
+ IdentifierType::RDS_PI, 0x1000)},
+ .valid = true},
+ IsValidSelectorTestCase{.name = "selector_with_invalid_id",
+ .sel = utils::makeSelectorHd(kHdStationId, kHdSubChannel,
+ /* frequency= */ 100u),
+ .valid = false},
+ IsValidSelectorTestCase{
+ .name = "selector_with_invalid_primary_id_type",
+ .sel = ProgramSelector{.primaryId = utils::makeIdentifier(
+ IdentifierType::DAB_ENSEMBLE, kDabEnsemble)},
+ .valid = false},
+ });
+}
+
struct IsValidMetadataTestCase {
std::string name;
Metadata metadata;
@@ -147,6 +318,34 @@
ASSERT_EQ(utils::isValidMetadata(testParam.metadata), testParam.valid);
}
+class IsValidIdentifierTest : public testing::TestWithParam<IsValidIdentifierTestCase> {};
+
+INSTANTIATE_TEST_SUITE_P(IsValidIdentifierTests, IsValidIdentifierTest,
+ testing::ValuesIn(getIsValidIdentifierTestCases()),
+ [](const testing::TestParamInfo<IsValidIdentifierTest::ParamType>& info) {
+ return info.param.name;
+ });
+
+TEST_P(IsValidIdentifierTest, IsValid) {
+ IsValidIdentifierTestCase testcase = GetParam();
+
+ ASSERT_EQ(utils::isValid(testcase.id), testcase.valid);
+}
+
+class IsValidSelectorTest : public testing::TestWithParam<IsValidSelectorTestCase> {};
+
+INSTANTIATE_TEST_SUITE_P(IsValidSelectorTests, IsValidSelectorTest,
+ testing::ValuesIn(getIsValidSelectorTestCases()),
+ [](const testing::TestParamInfo<IsValidSelectorTest::ParamType>& info) {
+ return info.param.name;
+ });
+
+TEST_P(IsValidSelectorTest, IsValid) {
+ IsValidSelectorTestCase testcase = GetParam();
+
+ ASSERT_EQ(utils::isValid(testcase.sel), testcase.valid);
+}
+
TEST(BroadcastRadioUtilsTest, IsSupportedWithSupportedSelector) {
ProgramSelector sel = utils::makeSelectorAmfm(kFmFrequencyKHz);
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/1.0/vts/functional/radio_hidl_hal_data.cpp b/radio/1.0/vts/functional/radio_hidl_hal_data.cpp
index 38cb33b..e89f4ee 100644
--- a/radio/1.0/vts/functional/radio_hidl_hal_data.cpp
+++ b/radio/1.0/vts/functional/radio_hidl_hal_data.cpp
@@ -16,6 +16,7 @@
#include <android-base/logging.h>
#include <android/hardware/radio/1.2/IRadio.h>
+#include <gtest/gtest.h>
#include <radio_hidl_hal_utils_v1_0.h>
using namespace ::android::hardware::radio::V1_0;
@@ -72,11 +73,16 @@
CellIdentityTdscdma cit = cellIdentities.cellIdentityTdscdma[0];
hidl_mcc = cit.mcc;
hidl_mnc = cit.mnc;
- } else {
+ } else if (cellInfoType == CellInfoType::CDMA) {
// CellIndentityCdma has no mcc and mnc.
EXPECT_EQ(CellInfoType::CDMA, cellInfoType);
EXPECT_EQ(1, cellIdentities.cellIdentityCdma.size());
checkMccMnc = false;
+ } else {
+ // This test can be skipped for newer networks if a new RAT (e.g. 5g) that was not
+ // supported in this version is added to the response from a modem that supports a new
+ // version of this interface.
+ GTEST_SKIP() << "Exempt from 1.0 test: camped on a new network:" << (int)cellInfoType;
}
// Check only one CellIdentity is size 1, and others must be 0.
diff --git a/radio/1.2/vts/functional/radio_hidl_hal_api.cpp b/radio/1.2/vts/functional/radio_hidl_hal_api.cpp
index 2bce2f9..51ca967 100644
--- a/radio/1.2/vts/functional/radio_hidl_hal_api.cpp
+++ b/radio/1.2/vts/functional/radio_hidl_hal_api.cpp
@@ -807,11 +807,16 @@
cellIdentities.cellIdentityTdscdma[0];
hidl_mcc = cit.base.mcc;
hidl_mnc = cit.base.mnc;
- } else {
+ } else if (cellInfoType == CellInfoType::CDMA) {
// CellIndentityCdma has no mcc and mnc.
EXPECT_EQ(CellInfoType::CDMA, cellInfoType);
EXPECT_EQ(1, cellIdentities.cellIdentityCdma.size());
checkMccMnc = false;
+ } else {
+ // This test can be skipped for newer networks if a new RAT (e.g. 5g) that was not
+ // supported in this version is added to the response from a modem that supports a new
+ // version of this interface.
+ GTEST_SKIP() << "Exempt from 1.2 test: camped on a new network:" << (int)cellInfoType;
}
// Check only one CellIdentity is size 1, and others must be 0.
diff --git a/security/keymint/aidl/vts/functional/KeyMintAidlTestBase.cpp b/security/keymint/aidl/vts/functional/KeyMintAidlTestBase.cpp
index d3f6ae3..087f763 100644
--- a/security/keymint/aidl/vts/functional/KeyMintAidlTestBase.cpp
+++ b/security/keymint/aidl/vts/functional/KeyMintAidlTestBase.cpp
@@ -64,6 +64,13 @@
namespace {
+// Possible values for the feature version. Assumes that future KeyMint versions
+// will continue with the 100 * AIDL_version numbering scheme.
+//
+// Must be kept in numerically increasing order.
+const int32_t kFeatureVersions[] = {10, 11, 20, 30, 40, 41, 100, 200,
+ 300, 400, 500, 600, 700, 800, 900};
+
// Invalid value for a patchlevel (which is of form YYYYMMDD).
const uint32_t kInvalidPatchlevel = 99998877;
@@ -2278,6 +2285,43 @@
return hasFeature;
}
+// Return the numeric value associated with a feature.
+std::optional<int32_t> keymint_feature_value(bool strongbox) {
+ std::string name = strongbox ? FEATURE_STRONGBOX_KEYSTORE : FEATURE_HARDWARE_KEYSTORE;
+ ::android::String16 name16(name.c_str());
+ ::android::sp<::android::IServiceManager> sm(::android::defaultServiceManager());
+ ::android::sp<::android::IBinder> binder(
+ sm->waitForService(::android::String16("package_native")));
+ if (binder == nullptr) {
+ GTEST_LOG_(ERROR) << "waitForService package_native failed";
+ return std::nullopt;
+ }
+ ::android::sp<::android::content::pm::IPackageManagerNative> packageMgr =
+ ::android::interface_cast<::android::content::pm::IPackageManagerNative>(binder);
+ if (packageMgr == nullptr) {
+ GTEST_LOG_(ERROR) << "Cannot find package manager";
+ return std::nullopt;
+ }
+
+ // Package manager has no mechanism to retrieve the version of a feature,
+ // only to indicate whether a certain version or above is present.
+ std::optional<int32_t> result = std::nullopt;
+ for (auto version : kFeatureVersions) {
+ bool hasFeature = false;
+ auto status = packageMgr->hasSystemFeature(name16, version, &hasFeature);
+ if (!status.isOk()) {
+ GTEST_LOG_(ERROR) << "hasSystemFeature('" << name << "', " << version
+ << ") failed: " << status;
+ return result;
+ } else if (hasFeature) {
+ result = version;
+ } else {
+ break;
+ }
+ }
+ return result;
+}
+
} // namespace test
} // namespace aidl::android::hardware::security::keymint
diff --git a/security/keymint/aidl/vts/functional/KeyMintAidlTestBase.h b/security/keymint/aidl/vts/functional/KeyMintAidlTestBase.h
index 4fb711c..4ed7698 100644
--- a/security/keymint/aidl/vts/functional/KeyMintAidlTestBase.h
+++ b/security/keymint/aidl/vts/functional/KeyMintAidlTestBase.h
@@ -56,6 +56,7 @@
const string FEATURE_KEYSTORE_APP_ATTEST_KEY = "android.hardware.keystore.app_attest_key";
const string FEATURE_STRONGBOX_KEYSTORE = "android.hardware.strongbox_keystore";
+const string FEATURE_HARDWARE_KEYSTORE = "android.hardware.hardware_keystore";
// RAII class to ensure that a keyblob is deleted regardless of how a test exits.
class KeyBlobDeleter {
@@ -444,6 +445,7 @@
void p256_pub_key(const vector<uint8_t>& coseKeyData, EVP_PKEY_Ptr* signingKey);
void device_id_attestation_check_acceptable_error(Tag tag, const ErrorCode& result);
bool check_feature(const std::string& name);
+std::optional<int32_t> keymint_feature_value(bool strongbox);
AuthorizationSet HwEnforcedAuthorizations(const vector<KeyCharacteristics>& key_characteristics);
AuthorizationSet SwEnforcedAuthorizations(const vector<KeyCharacteristics>& key_characteristics);
diff --git a/security/keymint/aidl/vts/functional/KeyMintTest.cpp b/security/keymint/aidl/vts/functional/KeyMintTest.cpp
index a2e20dc..e098aca 100644
--- a/security/keymint/aidl/vts/functional/KeyMintTest.cpp
+++ b/security/keymint/aidl/vts/functional/KeyMintTest.cpp
@@ -21,6 +21,7 @@
#include <algorithm>
#include <iostream>
+#include <map>
#include <openssl/curve25519.h>
#include <openssl/ec.h>
@@ -1027,9 +1028,9 @@
* The KeyMint V1 spec required that CERTIFICATE_NOT_{BEFORE,AFTER} be
* specified for asymmetric key generation. However, this was not
* checked at the time so we can only be strict about checking this for
- * implementations of KeyMint version 2 and above.
+ * implementations of KeyMint version 3 and above.
*/
- GTEST_SKIP() << "Validity strict since KeyMint v2";
+ GTEST_SKIP() << "Validity strict since KeyMint v3";
}
// Per RFC 5280 4.1.2.5, an undefined expiration (not-after) field should be set to
// GeneralizedTime 999912312359559, which is 253402300799000 ms from Jan 1, 1970.
@@ -8794,6 +8795,90 @@
INSTANTIATE_KEYMINT_AIDL_TEST(VsrRequirementTest);
+class InstanceTest : public testing::Test {
+ protected:
+ static void SetUpTestSuite() {
+ auto params = ::android::getAidlHalInstanceNames(IKeyMintDevice::descriptor);
+ for (auto& param : params) {
+ ASSERT_TRUE(AServiceManager_isDeclared(param.c_str()))
+ << "IKeyMintDevice instance " << param << " found but not declared.";
+ ::ndk::SpAIBinder binder(AServiceManager_waitForService(param.c_str()));
+ auto keymint = IKeyMintDevice::fromBinder(binder);
+ ASSERT_NE(keymint, nullptr) << "Failed to get IKeyMintDevice instance " << param;
+
+ KeyMintHardwareInfo info;
+ ASSERT_TRUE(keymint->getHardwareInfo(&info).isOk());
+ ASSERT_EQ(keymints_.count(info.securityLevel), 0)
+ << "There must be exactly one IKeyMintDevice with security level "
+ << info.securityLevel;
+
+ keymints_[info.securityLevel] = std::move(keymint);
+ }
+ }
+
+ int32_t AidlVersion(shared_ptr<IKeyMintDevice> keymint) {
+ int32_t version = 0;
+ auto status = keymint->getInterfaceVersion(&version);
+ if (!status.isOk()) {
+ ADD_FAILURE() << "Failed to determine interface version";
+ }
+ return version;
+ }
+
+ static std::map<SecurityLevel, shared_ptr<IKeyMintDevice>> keymints_;
+};
+
+std::map<SecurityLevel, shared_ptr<IKeyMintDevice>> InstanceTest::keymints_;
+
+// @VsrTest = VSR-3.10-017
+// Check that the AIDL version advertised by the HAL service matches
+// the value in the package manager feature version.
+TEST_F(InstanceTest, AidlVersionInFeature) {
+ if (is_gsi_image()) {
+ GTEST_SKIP() << "Versions not required to match under GSI";
+ }
+ if (keymints_.count(SecurityLevel::TRUSTED_ENVIRONMENT) == 1) {
+ auto tee = keymints_.find(SecurityLevel::TRUSTED_ENVIRONMENT)->second;
+ int32_t tee_aidl_version = AidlVersion(tee) * 100;
+ std::optional<int32_t> tee_feature_version = keymint_feature_value(/* strongbox */ false);
+ ASSERT_TRUE(tee_feature_version.has_value());
+ EXPECT_EQ(tee_aidl_version, tee_feature_version.value());
+ }
+ if (keymints_.count(SecurityLevel::STRONGBOX) == 1) {
+ auto sb = keymints_.find(SecurityLevel::STRONGBOX)->second;
+ int32_t sb_aidl_version = AidlVersion(sb) * 100;
+ std::optional<int32_t> sb_feature_version = keymint_feature_value(/* strongbox */ true);
+ ASSERT_TRUE(sb_feature_version.has_value());
+ EXPECT_EQ(sb_aidl_version, sb_feature_version.value());
+ }
+}
+
+// @VsrTest = VSR-3.10-017
+// Check that if package manager advertises support for KeyMint of a particular version, that
+// version is present as a HAL service.
+TEST_F(InstanceTest, FeatureVersionInAidl) {
+ if (is_gsi_image()) {
+ GTEST_SKIP() << "Versions not required to match under GSI";
+ }
+ std::optional<int32_t> tee_feature_version = keymint_feature_value(/* strongbox */ false);
+ if (tee_feature_version.has_value() && tee_feature_version.value() >= 100) {
+ // Feature flag advertises the existence of KeyMint; check it is present.
+ ASSERT_EQ(keymints_.count(SecurityLevel::TRUSTED_ENVIRONMENT), 1);
+ auto tee = keymints_.find(SecurityLevel::TRUSTED_ENVIRONMENT)->second;
+ int32_t tee_aidl_version = AidlVersion(tee) * 100;
+ EXPECT_EQ(tee_aidl_version, tee_feature_version.value());
+ }
+
+ std::optional<int32_t> sb_feature_version = keymint_feature_value(/* strongbox */ true);
+ if (sb_feature_version.has_value() && sb_feature_version.value() >= 100) {
+ // Feature flag advertises the existence of KeyMint; check it is present.
+ ASSERT_EQ(keymints_.count(SecurityLevel::STRONGBOX), 1);
+ auto sb = keymints_.find(SecurityLevel::STRONGBOX)->second;
+ int32_t sb_aidl_version = AidlVersion(sb) * 100;
+ EXPECT_EQ(sb_aidl_version, sb_feature_version.value());
+ }
+}
+
} // namespace aidl::android::hardware::security::keymint::test
using aidl::android::hardware::security::keymint::test::KeyMintAidlTestBase;
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.