Merge "[Sensor][Bugfix]: Remove redundant assignment operations"
diff --git a/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/IBluetoothLe.aidl b/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/IBluetoothLe.aidl
index f29e1fd..2068daf 100644
--- a/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/IBluetoothLe.aidl
+++ b/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/IBluetoothLe.aidl
@@ -36,4 +36,6 @@
interface IBluetoothLe {
boolean isEnabled();
void setEnabled(boolean enabled);
+ boolean supportsOffloadReconfiguration();
+ void reconfigureOffload(in android.hardware.audio.core.VendorParameter[] parameters);
}
diff --git a/audio/aidl/android/hardware/audio/core/IBluetoothA2dp.aidl b/audio/aidl/android/hardware/audio/core/IBluetoothA2dp.aidl
index c4dd738..a690ca4 100644
--- a/audio/aidl/android/hardware/audio/core/IBluetoothA2dp.aidl
+++ b/audio/aidl/android/hardware/audio/core/IBluetoothA2dp.aidl
@@ -55,7 +55,7 @@
/**
* Indicates whether the module supports reconfiguration of offloaded codecs.
*
- * Offloaded coded implementations may need to be reconfigured when the
+ * Offloaded codec implementations may need to be reconfigured when the
* active A2DP device changes. This method indicates whether the HAL module
* supports the reconfiguration event. The result returned from this method
* must not change over time.
@@ -67,11 +67,11 @@
/**
* Instructs the HAL module to reconfigure offloaded codec.
*
- * Offloaded coded implementations may need to be reconfigured when the
+ * Offloaded codec implementations may need to be reconfigured when the
* active A2DP device changes. This method is a notification for the HAL
* module to commence reconfiguration.
*
- * Note that 'EX_UNSUPPORTED_OPERATION' may only be thrown when
+ * Note that 'EX_UNSUPPORTED_OPERATION' must be thrown if and only if
* 'supportsOffloadReconfiguration' returns 'false'.
*
* @param parameter Optional vendor-specific parameters, can be left empty.
diff --git a/audio/aidl/android/hardware/audio/core/IBluetoothLe.aidl b/audio/aidl/android/hardware/audio/core/IBluetoothLe.aidl
index 272f862..444ff68 100644
--- a/audio/aidl/android/hardware/audio/core/IBluetoothLe.aidl
+++ b/audio/aidl/android/hardware/audio/core/IBluetoothLe.aidl
@@ -16,6 +16,8 @@
package android.hardware.audio.core;
+import android.hardware.audio.core.VendorParameter;
+
/**
* An instance of IBluetoothLe manages settings for the LE (Low Energy)
* profiles. This interface is optional to implement by the vendor. It needs to
@@ -48,4 +50,33 @@
* @throws EX_ILLEGAL_STATE If there was an error performing the operation.
*/
void setEnabled(boolean enabled);
+
+ /**
+ * Indicates whether the module supports reconfiguration of offloaded codecs.
+ *
+ * Offloaded codec implementations may need to be reconfigured when the
+ * active LE device changes. This method indicates whether the HAL module
+ * supports the reconfiguration event. The result returned from this method
+ * must not change over time.
+ *
+ * @return Whether reconfiguration offload of offloaded codecs is supported.
+ */
+ boolean supportsOffloadReconfiguration();
+
+ /**
+ * Instructs the HAL module to reconfigure offloaded codec.
+ *
+ * Offloaded codec implementations may need to be reconfigured when the
+ * active LE device changes. This method is a notification for the HAL
+ * module to commence reconfiguration.
+ *
+ * Note that 'EX_UNSUPPORTED_OPERATION' must be thrown if and only if
+ * 'supportsOffloadReconfiguration' returns 'false'.
+ *
+ * @param parameter Optional vendor-specific parameters, can be left empty.
+ * @throws EX_ILLEGAL_STATE If there was an error performing the operation,
+ * or the operation can not be commenced in the current state.
+ * @throws EX_UNSUPPORTED_OPERATION If the module does not support codec reconfiguration.
+ */
+ void reconfigureOffload(in VendorParameter[] parameters);
}
diff --git a/audio/aidl/common/include/Utils.h b/audio/aidl/common/include/Utils.h
index d87bbd4..2cf862c 100644
--- a/audio/aidl/common/include/Utils.h
+++ b/audio/aidl/common/include/Utils.h
@@ -19,6 +19,7 @@
#include <algorithm>
#include <array>
#include <initializer_list>
+#include <regex>
#include <type_traits>
#include <aidl/android/media/audio/common/AudioChannelLayout.h>
@@ -29,7 +30,7 @@
#include <aidl/android/media/audio/common/AudioOutputFlags.h>
#include <aidl/android/media/audio/common/PcmType.h>
-namespace android::hardware::audio::common {
+namespace aidl::android::hardware::audio::common {
// Some values are reserved for use by the system code only.
// HALs must not accept or emit values outside from the provided list.
@@ -133,6 +134,18 @@
kValidAudioModes.end();
}
+static inline bool maybeVendorExtension(const std::string& s) {
+ // Only checks whether the string starts with the "vendor prefix".
+ static const std::string vendorPrefix = "VX_";
+ return s.size() > vendorPrefix.size() && s.substr(0, vendorPrefix.size()) == vendorPrefix;
+}
+
+static inline bool isVendorExtension(const std::string& s) {
+ // Must be the same as defined in {Playback|Record}TrackMetadata.aidl
+ static const std::regex vendorExtension("VX_[A-Z0-9]{3,}_[_A-Z0-9]+");
+ return std::regex_match(s.begin(), s.end(), vendorExtension);
+}
+
// The helper functions defined below are only applicable to the case when an enum type
// specifies zero-based bit positions, not bit masks themselves. This is why instantiation
// is restricted to certain enum types.
@@ -163,4 +176,4 @@
return result;
}
-} // namespace android::hardware::audio::common
+} // namespace aidl::android::hardware::audio::common
diff --git a/audio/aidl/common/tests/utils_tests.cpp b/audio/aidl/common/tests/utils_tests.cpp
index d7f1a5d..1b8b8df 100644
--- a/audio/aidl/common/tests/utils_tests.cpp
+++ b/audio/aidl/common/tests/utils_tests.cpp
@@ -26,13 +26,13 @@
#define LOG_TAG "Utils_Test"
#include <log/log.h>
+using aidl::android::hardware::audio::common::getChannelCount;
+using aidl::android::hardware::audio::common::getFrameSizeInBytes;
+using aidl::android::hardware::audio::common::getPcmSampleSizeInBytes;
using aidl::android::media::audio::common::AudioChannelLayout;
using aidl::android::media::audio::common::AudioFormatDescription;
using aidl::android::media::audio::common::AudioFormatType;
using aidl::android::media::audio::common::PcmType;
-using android::hardware::audio::common::getChannelCount;
-using android::hardware::audio::common::getFrameSizeInBytes;
-using android::hardware::audio::common::getPcmSampleSizeInBytes;
TEST(UtilsTest, ChannelCountOddCases) {
using Tag = AudioChannelLayout::Tag;
diff --git a/audio/aidl/default/Bluetooth.cpp b/audio/aidl/default/Bluetooth.cpp
index 8115e7b..c32b538 100644
--- a/audio/aidl/default/Bluetooth.cpp
+++ b/audio/aidl/default/Bluetooth.cpp
@@ -117,4 +117,17 @@
return ndk::ScopedAStatus::ok();
}
+ndk::ScopedAStatus BluetoothLe::supportsOffloadReconfiguration(bool* _aidl_return) {
+ *_aidl_return = true;
+ LOG(DEBUG) << __func__ << ": returning " << *_aidl_return;
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus BluetoothLe::reconfigureOffload(
+ const std::vector<::aidl::android::hardware::audio::core::VendorParameter>& in_parameters
+ __unused) {
+ LOG(DEBUG) << __func__ << ": " << ::android::internal::ToString(in_parameters);
+ return ndk::ScopedAStatus::ok();
+}
+
} // namespace aidl::android::hardware::audio::core
diff --git a/audio/aidl/default/Configuration.cpp b/audio/aidl/default/Configuration.cpp
index a72be24..e1e1f79 100644
--- a/audio/aidl/default/Configuration.cpp
+++ b/audio/aidl/default/Configuration.cpp
@@ -25,6 +25,7 @@
#include "core-impl/Configuration.h"
+using aidl::android::hardware::audio::common::makeBitPositionFlagMask;
using aidl::android::media::audio::common::AudioChannelLayout;
using aidl::android::media::audio::common::AudioDeviceDescription;
using aidl::android::media::audio::common::AudioDeviceType;
@@ -42,7 +43,6 @@
using aidl::android::media::audio::common::Int;
using aidl::android::media::audio::common::MicrophoneInfo;
using aidl::android::media::audio::common::PcmType;
-using android::hardware::audio::common::makeBitPositionFlagMask;
namespace aidl::android::hardware::audio::core::internal {
diff --git a/audio/aidl/default/EffectThread.cpp b/audio/aidl/default/EffectThread.cpp
index 024c0ea..4f8fb3c 100644
--- a/audio/aidl/default/EffectThread.cpp
+++ b/audio/aidl/default/EffectThread.cpp
@@ -34,13 +34,14 @@
};
RetCode EffectThread::createThread(std::shared_ptr<EffectContext> context, const std::string& name,
- const int priority) {
+ int priority, int sleepUs /* kSleepTimeUs */) {
if (mThread.joinable()) {
LOG(WARNING) << __func__ << " thread already created, no-op";
return RetCode::SUCCESS;
}
mName = name;
mPriority = priority;
+ mSleepTimeUs = sleepUs;
{
std::lock_guard lg(mThreadMutex);
mThreadContext = std::move(context);
@@ -134,7 +135,7 @@
LOG(DEBUG) << __func__ << " done processing, effect consumed " << status.fmqConsumed
<< " produced " << status.fmqProduced;
} else {
- // TODO: maybe add some sleep here to avoid busy waiting
+ usleep(mSleepTimeUs);
}
}
diff --git a/audio/aidl/default/Module.cpp b/audio/aidl/default/Module.cpp
index c95c199..984b9a1 100644
--- a/audio/aidl/default/Module.cpp
+++ b/audio/aidl/default/Module.cpp
@@ -34,6 +34,9 @@
#include "core-impl/Telephony.h"
#include "core-impl/utils.h"
+using aidl::android::hardware::audio::common::getFrameSizeInBytes;
+using aidl::android::hardware::audio::common::isBitPositionFlagSet;
+using aidl::android::hardware::audio::common::isValidAudioMode;
using aidl::android::hardware::audio::common::SinkMetadata;
using aidl::android::hardware::audio::common::SourceMetadata;
using aidl::android::hardware::audio::core::sounddose::ISoundDose;
@@ -57,9 +60,6 @@
using aidl::android::media::audio::common::Int;
using aidl::android::media::audio::common::MicrophoneInfo;
using aidl::android::media::audio::common::PcmType;
-using android::hardware::audio::common::getFrameSizeInBytes;
-using android::hardware::audio::common::isBitPositionFlagSet;
-using android::hardware::audio::common::isValidAudioMode;
namespace aidl::android::hardware::audio::core {
diff --git a/audio/aidl/default/Stream.cpp b/audio/aidl/default/Stream.cpp
index 871480b..77b0601 100644
--- a/audio/aidl/default/Stream.cpp
+++ b/audio/aidl/default/Stream.cpp
@@ -25,6 +25,8 @@
#include "core-impl/Stream.h"
using aidl::android::hardware::audio::common::AudioOffloadMetadata;
+using aidl::android::hardware::audio::common::getChannelCount;
+using aidl::android::hardware::audio::common::getFrameSizeInBytes;
using aidl::android::hardware::audio::common::SinkMetadata;
using aidl::android::hardware::audio::common::SourceMetadata;
using aidl::android::media::audio::common::AudioDevice;
@@ -34,8 +36,6 @@
using aidl::android::media::audio::common::AudioPlaybackRate;
using aidl::android::media::audio::common::MicrophoneDynamicInfo;
using aidl::android::media::audio::common::MicrophoneInfo;
-using android::hardware::audio::common::getChannelCount;
-using android::hardware::audio::common::getFrameSizeInBytes;
namespace aidl::android::hardware::audio::core {
diff --git a/audio/aidl/default/Telephony.cpp b/audio/aidl/default/Telephony.cpp
index ad22470..bf05a8d 100644
--- a/audio/aidl/default/Telephony.cpp
+++ b/audio/aidl/default/Telephony.cpp
@@ -22,10 +22,10 @@
#include "core-impl/Telephony.h"
+using aidl::android::hardware::audio::common::isValidAudioMode;
using aidl::android::media::audio::common::AudioMode;
using aidl::android::media::audio::common::Boolean;
using aidl::android::media::audio::common::Float;
-using android::hardware::audio::common::isValidAudioMode;
namespace aidl::android::hardware::audio::core {
diff --git a/audio/aidl/default/acousticEchoCanceler/AcousticEchoCancelerSw.cpp b/audio/aidl/default/acousticEchoCanceler/AcousticEchoCancelerSw.cpp
index f5af81e..561f9a3 100644
--- a/audio/aidl/default/acousticEchoCanceler/AcousticEchoCancelerSw.cpp
+++ b/audio/aidl/default/acousticEchoCanceler/AcousticEchoCancelerSw.cpp
@@ -17,10 +17,9 @@
#include <algorithm>
#include <cstddef>
#include <memory>
-#define LOG_TAG "AHAL_AcousticEchoCancelerSw"
-#include <Utils.h>
#include <unordered_set>
+#define LOG_TAG "AHAL_AcousticEchoCancelerSw"
#include <android-base/logging.h>
#include <fmq/AidlMessageQueue.h>
diff --git a/audio/aidl/default/automaticGainControlV2/AutomaticGainControlV2Sw.cpp b/audio/aidl/default/automaticGainControlV2/AutomaticGainControlV2Sw.cpp
index 8441f22..50712a4 100644
--- a/audio/aidl/default/automaticGainControlV2/AutomaticGainControlV2Sw.cpp
+++ b/audio/aidl/default/automaticGainControlV2/AutomaticGainControlV2Sw.cpp
@@ -17,10 +17,8 @@
#include <algorithm>
#include <cstddef>
#include <memory>
-#define LOG_TAG "AHAL_AutomaticGainControlV2Sw"
-#include <Utils.h>
-#include <unordered_set>
+#define LOG_TAG "AHAL_AutomaticGainControlV2Sw"
#include <android-base/logging.h>
#include <fmq/AidlMessageQueue.h>
diff --git a/audio/aidl/default/bassboost/BassBoostSw.cpp b/audio/aidl/default/bassboost/BassBoostSw.cpp
index e50f0a2..fb5374f 100644
--- a/audio/aidl/default/bassboost/BassBoostSw.cpp
+++ b/audio/aidl/default/bassboost/BassBoostSw.cpp
@@ -17,10 +17,8 @@
#include <algorithm>
#include <cstddef>
#include <memory>
-#define LOG_TAG "AHAL_BassBoostSw"
-#include <Utils.h>
-#include <unordered_set>
+#define LOG_TAG "AHAL_BassBoostSw"
#include <android-base/logging.h>
#include <fmq/AidlMessageQueue.h>
diff --git a/audio/aidl/default/downmix/DownmixSw.cpp b/audio/aidl/default/downmix/DownmixSw.cpp
index 0af95d0..81a4c89 100644
--- a/audio/aidl/default/downmix/DownmixSw.cpp
+++ b/audio/aidl/default/downmix/DownmixSw.cpp
@@ -14,12 +14,10 @@
* limitations under the License.
*/
-#include <cstddef>
-#define LOG_TAG "AHAL_DownmixSw"
-#include <Utils.h>
#include <algorithm>
-#include <unordered_set>
+#include <cstddef>
+#define LOG_TAG "AHAL_DownmixSw"
#include <android-base/logging.h>
#include <fmq/AidlMessageQueue.h>
diff --git a/audio/aidl/default/dynamicProcessing/DynamicsProcessingSw.cpp b/audio/aidl/default/dynamicProcessing/DynamicsProcessingSw.cpp
index 5e5c974..1dda6d1 100644
--- a/audio/aidl/default/dynamicProcessing/DynamicsProcessingSw.cpp
+++ b/audio/aidl/default/dynamicProcessing/DynamicsProcessingSw.cpp
@@ -14,13 +14,12 @@
* limitations under the License.
*/
-#include <cstddef>
-#define LOG_TAG "AHAL_DynamicsProcessingSw"
-#include <Utils.h>
#include <algorithm>
+#include <cstddef>
#include <set>
#include <unordered_set>
+#define LOG_TAG "AHAL_DynamicsProcessingSw"
#include <android-base/logging.h>
#include <fmq/AidlMessageQueue.h>
@@ -282,8 +281,8 @@
RetCode DynamicsProcessingSwContext::setCommon(const Parameter::Common& common) {
mCommon = common;
- mChannelCount =
- ::android::hardware::audio::common::getChannelCount(common.input.base.channelMask);
+ mChannelCount = ::aidl::android::hardware::audio::common::getChannelCount(
+ common.input.base.channelMask);
resizeChannels();
resizeBands();
LOG(INFO) << __func__ << mCommon.toString();
diff --git a/audio/aidl/default/dynamicProcessing/DynamicsProcessingSw.h b/audio/aidl/default/dynamicProcessing/DynamicsProcessingSw.h
index 3e14cce..769f9ef 100644
--- a/audio/aidl/default/dynamicProcessing/DynamicsProcessingSw.h
+++ b/audio/aidl/default/dynamicProcessing/DynamicsProcessingSw.h
@@ -16,10 +16,13 @@
#pragma once
-#include <aidl/android/hardware/audio/effect/BnEffect.h>
-#include <fmq/AidlMessageQueue.h>
#include <cstdlib>
#include <memory>
+#include <vector>
+
+#include <Utils.h>
+#include <aidl/android/hardware/audio/effect/BnEffect.h>
+#include <fmq/AidlMessageQueue.h>
#include "effect-impl/EffectImpl.h"
#include "effect-impl/EffectUUID.h"
@@ -30,7 +33,7 @@
public:
DynamicsProcessingSwContext(int statusDepth, const Parameter::Common& common)
: EffectContext(statusDepth, common),
- mChannelCount(::android::hardware::audio::common::getChannelCount(
+ mChannelCount(::aidl::android::hardware::audio::common::getChannelCount(
common.input.base.channelMask)),
mPreEqChCfgs(mChannelCount, {.channel = kInvalidChannelId}),
mPostEqChCfgs(mChannelCount, {.channel = kInvalidChannelId}),
diff --git a/audio/aidl/default/envReverb/EnvReverbSw.cpp b/audio/aidl/default/envReverb/EnvReverbSw.cpp
index 15373fe..29288ca 100644
--- a/audio/aidl/default/envReverb/EnvReverbSw.cpp
+++ b/audio/aidl/default/envReverb/EnvReverbSw.cpp
@@ -14,12 +14,11 @@
* limitations under the License.
*/
-#include <cstddef>
-#define LOG_TAG "AHAL_EnvReverbSw"
-#include <Utils.h>
#include <algorithm>
+#include <cstddef>
#include <unordered_set>
+#define LOG_TAG "AHAL_EnvReverbSw"
#include <android-base/logging.h>
#include <fmq/AidlMessageQueue.h>
diff --git a/audio/aidl/default/equalizer/EqualizerSw.cpp b/audio/aidl/default/equalizer/EqualizerSw.cpp
index 8cfe82e..0fa7a11 100644
--- a/audio/aidl/default/equalizer/EqualizerSw.cpp
+++ b/audio/aidl/default/equalizer/EqualizerSw.cpp
@@ -14,12 +14,10 @@
* limitations under the License.
*/
-#include <cstddef>
-#define LOG_TAG "AHAL_EqualizerSw"
-#include <Utils.h>
#include <algorithm>
-#include <unordered_set>
+#include <cstddef>
+#define LOG_TAG "AHAL_EqualizerSw"
#include <android-base/logging.h>
#include <fmq/AidlMessageQueue.h>
diff --git a/audio/aidl/default/extension/ExtensionEffect.cpp b/audio/aidl/default/extension/ExtensionEffect.cpp
index c4e4999..db1e4a4 100644
--- a/audio/aidl/default/extension/ExtensionEffect.cpp
+++ b/audio/aidl/default/extension/ExtensionEffect.cpp
@@ -19,9 +19,8 @@
#include <memory>
#include <unordered_set>
-#define LOG_TAG "AHAL_ExtensionEffect"
-#include <Utils.h>
#include <aidl/android/hardware/audio/effect/DefaultExtension.h>
+#define LOG_TAG "AHAL_ExtensionEffect"
#include <android-base/logging.h>
#include <fmq/AidlMessageQueue.h>
diff --git a/audio/aidl/default/hapticGenerator/HapticGeneratorSw.cpp b/audio/aidl/default/hapticGenerator/HapticGeneratorSw.cpp
index 6037ad2..944f715 100644
--- a/audio/aidl/default/hapticGenerator/HapticGeneratorSw.cpp
+++ b/audio/aidl/default/hapticGenerator/HapticGeneratorSw.cpp
@@ -14,12 +14,10 @@
* limitations under the License.
*/
-#include <cstddef>
-#define LOG_TAG "AHAL_HapticGeneratorSw"
-#include <Utils.h>
#include <algorithm>
-#include <unordered_set>
+#include <cstddef>
+#define LOG_TAG "AHAL_HapticGeneratorSw"
#include <android-base/logging.h>
#include <fmq/AidlMessageQueue.h>
diff --git a/audio/aidl/default/include/core-impl/Bluetooth.h b/audio/aidl/default/include/core-impl/Bluetooth.h
index 1cd0355..10e9045 100644
--- a/audio/aidl/default/include/core-impl/Bluetooth.h
+++ b/audio/aidl/default/include/core-impl/Bluetooth.h
@@ -56,6 +56,10 @@
private:
ndk::ScopedAStatus isEnabled(bool* _aidl_return) override;
ndk::ScopedAStatus setEnabled(bool in_enabled) override;
+ ndk::ScopedAStatus supportsOffloadReconfiguration(bool* _aidl_return) override;
+ ndk::ScopedAStatus reconfigureOffload(
+ const std::vector<::aidl::android::hardware::audio::core::VendorParameter>&
+ in_parameters) override;
bool mEnabled = false;
};
diff --git a/audio/aidl/default/include/effect-impl/EffectContext.h b/audio/aidl/default/include/effect-impl/EffectContext.h
index 2ab0ade..8b4a7d2 100644
--- a/audio/aidl/default/include/effect-impl/EffectContext.h
+++ b/audio/aidl/default/include/effect-impl/EffectContext.h
@@ -15,10 +15,10 @@
*/
#pragma once
-#include <Utils.h>
#include <memory>
#include <vector>
+#include <Utils.h>
#include <android-base/logging.h>
#include <fmq/AidlMessageQueue.h>
@@ -46,9 +46,9 @@
LOG_ALWAYS_FATAL_IF(output.base.format.pcm !=
aidl::android::media::audio::common::PcmType::FLOAT_32_BIT,
"outputFormatNotFloat");
- mInputFrameSize = ::android::hardware::audio::common::getFrameSizeInBytes(
+ mInputFrameSize = ::aidl::android::hardware::audio::common::getFrameSizeInBytes(
input.base.format, input.base.channelMask);
- mOutputFrameSize = ::android::hardware::audio::common::getFrameSizeInBytes(
+ mOutputFrameSize = ::aidl::android::hardware::audio::common::getFrameSizeInBytes(
output.base.format, output.base.channelMask);
// in/outBuffer size in float (FMQ data format defined for DataMQ)
size_t inBufferSizeInFloat = input.frameCount * mInputFrameSize / sizeof(float);
diff --git a/audio/aidl/default/include/effect-impl/EffectThread.h b/audio/aidl/default/include/effect-impl/EffectThread.h
index 9b1a75b..f9c6a31 100644
--- a/audio/aidl/default/include/effect-impl/EffectThread.h
+++ b/audio/aidl/default/include/effect-impl/EffectThread.h
@@ -35,7 +35,7 @@
// called by effect implementation.
RetCode createThread(std::shared_ptr<EffectContext> context, const std::string& name,
- const int priority = ANDROID_PRIORITY_URGENT_AUDIO);
+ int priority = ANDROID_PRIORITY_URGENT_AUDIO, int sleepUs = kSleepTimeUs);
RetCode destroyThread();
RetCode startThread();
RetCode stopThread();
@@ -72,7 +72,8 @@
virtual void process_l() REQUIRES(mThreadMutex);
private:
- const int kMaxTaskNameLen = 15;
+ static constexpr int kMaxTaskNameLen = 15;
+ static constexpr int kSleepTimeUs = 2000; // in micro-second
std::mutex mThreadMutex;
std::condition_variable mCv;
bool mExit GUARDED_BY(mThreadMutex) = false;
@@ -80,6 +81,7 @@
std::shared_ptr<EffectContext> mThreadContext GUARDED_BY(mThreadMutex);
std::thread mThread;
int mPriority;
+ int mSleepTimeUs = kSleepTimeUs; // sleep time in micro-second
std::string mName;
RetCode handleStartStop(bool stop);
diff --git a/audio/aidl/default/loudnessEnhancer/LoudnessEnhancerSw.cpp b/audio/aidl/default/loudnessEnhancer/LoudnessEnhancerSw.cpp
index da02076..f115cc5 100644
--- a/audio/aidl/default/loudnessEnhancer/LoudnessEnhancerSw.cpp
+++ b/audio/aidl/default/loudnessEnhancer/LoudnessEnhancerSw.cpp
@@ -14,12 +14,10 @@
* limitations under the License.
*/
-#include <cstddef>
-#define LOG_TAG "AHAL_LoudnessEnhancerSw"
-#include <Utils.h>
#include <algorithm>
-#include <unordered_set>
+#include <cstddef>
+#define LOG_TAG "AHAL_LoudnessEnhancerSw"
#include <android-base/logging.h>
#include <fmq/AidlMessageQueue.h>
diff --git a/audio/aidl/default/main.cpp b/audio/aidl/default/main.cpp
index a861f9d..af71aa8 100644
--- a/audio/aidl/default/main.cpp
+++ b/audio/aidl/default/main.cpp
@@ -41,6 +41,9 @@
// android::base::SetMinimumLogSeverity(::android::base::VERBOSE);
ABinderProcess_setThreadPoolMaxThreadCount(16);
+ // Guaranteed log for b/210919187 and logd_integration_test
+ LOG(INFO) << "Init for Audio AIDL HAL";
+
// Make the default config service
auto config = ndk::SharedRefBase::make<Config>();
const std::string configName = std::string() + Config::descriptor + "/default";
diff --git a/audio/aidl/default/noiseSuppression/NoiseSuppressionSw.cpp b/audio/aidl/default/noiseSuppression/NoiseSuppressionSw.cpp
index 0ea31ea..ba39b16 100644
--- a/audio/aidl/default/noiseSuppression/NoiseSuppressionSw.cpp
+++ b/audio/aidl/default/noiseSuppression/NoiseSuppressionSw.cpp
@@ -17,10 +17,8 @@
#include <algorithm>
#include <cstddef>
#include <memory>
-#define LOG_TAG "AHAL_NoiseSuppressionSw"
-#include <Utils.h>
-#include <unordered_set>
+#define LOG_TAG "AHAL_NoiseSuppressionSw"
#include <android-base/logging.h>
#include <fmq/AidlMessageQueue.h>
diff --git a/audio/aidl/default/presetReverb/PresetReverbSw.cpp b/audio/aidl/default/presetReverb/PresetReverbSw.cpp
index 2da3ff6..14546a4 100644
--- a/audio/aidl/default/presetReverb/PresetReverbSw.cpp
+++ b/audio/aidl/default/presetReverb/PresetReverbSw.cpp
@@ -14,12 +14,10 @@
* limitations under the License.
*/
-#include <cstddef>
-#define LOG_TAG "AHAL_PresetReverbSw"
-#include <Utils.h>
#include <algorithm>
-#include <unordered_set>
+#include <cstddef>
+#define LOG_TAG "AHAL_PresetReverbSw"
#include <android-base/logging.h>
#include <android/binder_enums.h>
#include <fmq/AidlMessageQueue.h>
diff --git a/audio/aidl/default/usb/ModuleUsb.cpp b/audio/aidl/default/usb/ModuleUsb.cpp
index 511ba74..80b0a5b 100644
--- a/audio/aidl/default/usb/ModuleUsb.cpp
+++ b/audio/aidl/default/usb/ModuleUsb.cpp
@@ -30,6 +30,7 @@
#include "alsa_device_profile.h"
}
+using aidl::android::hardware::audio::common::isUsbInputDeviceType;
using aidl::android::media::audio::common::AudioChannelLayout;
using aidl::android::media::audio::common::AudioDeviceAddress;
using aidl::android::media::audio::common::AudioDeviceDescription;
@@ -40,7 +41,6 @@
using aidl::android::media::audio::common::AudioPortConfig;
using aidl::android::media::audio::common::AudioPortExt;
using aidl::android::media::audio::common::AudioProfile;
-using android::hardware::audio::common::isUsbInputDeviceType;
namespace aidl::android::hardware::audio::core {
diff --git a/audio/aidl/default/usb/StreamUsb.cpp b/audio/aidl/default/usb/StreamUsb.cpp
index d6f757c..fbfe0f1 100644
--- a/audio/aidl/default/usb/StreamUsb.cpp
+++ b/audio/aidl/default/usb/StreamUsb.cpp
@@ -28,6 +28,7 @@
#include "alsa_device_profile.h"
}
+using aidl::android::hardware::audio::common::getChannelCount;
using aidl::android::hardware::audio::common::SinkMetadata;
using aidl::android::hardware::audio::common::SourceMetadata;
using aidl::android::media::audio::common::AudioDevice;
@@ -38,7 +39,6 @@
using aidl::android::media::audio::common::MicrophoneInfo;
using android::OK;
using android::status_t;
-using android::hardware::audio::common::getChannelCount;
namespace aidl::android::hardware::audio::core {
diff --git a/audio/aidl/default/usb/UsbAlsaUtils.cpp b/audio/aidl/default/usb/UsbAlsaUtils.cpp
index 3c79e1d..3a74c2a 100644
--- a/audio/aidl/default/usb/UsbAlsaUtils.cpp
+++ b/audio/aidl/default/usb/UsbAlsaUtils.cpp
@@ -24,11 +24,11 @@
#include "UsbAlsaUtils.h"
#include "core-impl/utils.h"
+using aidl::android::hardware::audio::common::getChannelCount;
using aidl::android::media::audio::common::AudioChannelLayout;
using aidl::android::media::audio::common::AudioFormatDescription;
using aidl::android::media::audio::common::AudioFormatType;
using aidl::android::media::audio::common::PcmType;
-using android::hardware::audio::common::getChannelCount;
namespace aidl::android::hardware::audio::core::usb {
@@ -178,4 +178,4 @@
return findValueOrDefault(getAudioFormatDescriptorToPcmFormatMap(), aidl, PCM_FORMAT_INVALID);
}
-} // namespace aidl::android::hardware::audio::core::usb
\ No newline at end of file
+} // namespace aidl::android::hardware::audio::core::usb
diff --git a/audio/aidl/default/virtualizer/VirtualizerSw.cpp b/audio/aidl/default/virtualizer/VirtualizerSw.cpp
index d75e4e0..c5a0e8d 100644
--- a/audio/aidl/default/virtualizer/VirtualizerSw.cpp
+++ b/audio/aidl/default/virtualizer/VirtualizerSw.cpp
@@ -14,12 +14,11 @@
* limitations under the License.
*/
+#include <algorithm>
#include <cstddef>
+
#define LOG_TAG "AHAL_VirtualizerSw"
#include <Utils.h>
-#include <algorithm>
-#include <unordered_set>
-
#include <android-base/logging.h>
#include <fmq/AidlMessageQueue.h>
@@ -170,7 +169,7 @@
ndk::ScopedAStatus VirtualizerSw::getSpeakerAngles(const Virtualizer::SpeakerAnglesPayload payload,
Parameter::Specific* specific) {
std::vector<Virtualizer::ChannelAngle> angles;
- const auto chNum = ::android::hardware::audio::common::getChannelCount(payload.layout);
+ const auto chNum = ::aidl::android::hardware::audio::common::getChannelCount(payload.layout);
if (chNum == 1) {
angles = {{.channel = (int32_t)AudioChannelLayout::CHANNEL_FRONT_LEFT,
.azimuthDegree = 0,
diff --git a/audio/aidl/default/volume/VolumeSw.cpp b/audio/aidl/default/volume/VolumeSw.cpp
index 796c332..44cac44 100644
--- a/audio/aidl/default/volume/VolumeSw.cpp
+++ b/audio/aidl/default/volume/VolumeSw.cpp
@@ -14,12 +14,10 @@
* limitations under the License.
*/
-#include <cstddef>
-#define LOG_TAG "AHAL_VolumeSw"
-#include <Utils.h>
#include <algorithm>
-#include <unordered_set>
+#include <cstddef>
+#define LOG_TAG "AHAL_VolumeSw"
#include <android-base/logging.h>
#include <fmq/AidlMessageQueue.h>
diff --git a/audio/aidl/vts/EffectHelper.h b/audio/aidl/vts/EffectHelper.h
index 5e03d67..a128f7c 100644
--- a/audio/aidl/vts/EffectHelper.h
+++ b/audio/aidl/vts/EffectHelper.h
@@ -23,6 +23,7 @@
#include <unordered_map>
#include <vector>
+#include <Utils.h>
#include <aidl/android/hardware/audio/effect/IEffect.h>
#include <aidl/android/hardware/audio/effect/IFactory.h>
#include <aidl/android/media/audio/common/AudioChannelLayout.h>
@@ -135,7 +136,7 @@
static void allocateInputData(const Parameter::Common common, std::unique_ptr<DataMQ>& mq,
std::vector<float>& buffer) {
ASSERT_NE(mq, nullptr);
- auto frameSize = android::hardware::audio::common::getFrameSizeInBytes(
+ auto frameSize = ::aidl::android::hardware::audio::common::getFrameSizeInBytes(
common.input.base.format, common.input.base.channelMask);
const size_t floatsToWrite = mq->availableToWrite();
ASSERT_NE(0UL, floatsToWrite);
diff --git a/audio/aidl/vts/ModuleConfig.cpp b/audio/aidl/vts/ModuleConfig.cpp
index b07edb7..8c448a8 100644
--- a/audio/aidl/vts/ModuleConfig.cpp
+++ b/audio/aidl/vts/ModuleConfig.cpp
@@ -27,6 +27,7 @@
using namespace android;
using namespace std::chrono_literals;
+using aidl::android::hardware::audio::common::isBitPositionFlagSet;
using aidl::android::hardware::audio::core::IModule;
using aidl::android::media::audio::common::AudioChannelLayout;
using aidl::android::media::audio::common::AudioDeviceType;
@@ -43,7 +44,6 @@
using aidl::android::media::audio::common::AudioProfile;
using aidl::android::media::audio::common::AudioUsage;
using aidl::android::media::audio::common::Int;
-using android::hardware::audio::common::isBitPositionFlagSet;
// static
std::optional<AudioOffloadInfo> ModuleConfig::generateOffloadInfoIfNeeded(
diff --git a/audio/aidl/vts/VtsHalAECTargetTest.cpp b/audio/aidl/vts/VtsHalAECTargetTest.cpp
index 39be191..2d36cbb 100644
--- a/audio/aidl/vts/VtsHalAECTargetTest.cpp
+++ b/audio/aidl/vts/VtsHalAECTargetTest.cpp
@@ -14,13 +14,13 @@
* limitations under the License.
*/
-#include <Utils.h>
-#include <aidl/Vintf.h>
#include <algorithm>
#include <string>
#include <unordered_set>
+#include <aidl/Vintf.h>
#define LOG_TAG "VtsHalAECParamTest"
+#include <android-base/logging.h>
#include "EffectHelper.h"
#include "effect-impl/EffectTypes.h"
@@ -177,4 +177,4 @@
ABinderProcess_setThreadPoolMaxThreadCount(1);
ABinderProcess_startThreadPool();
return RUN_ALL_TESTS();
-}
\ No newline at end of file
+}
diff --git a/audio/aidl/vts/VtsHalAGC1TargetTest.cpp b/audio/aidl/vts/VtsHalAGC1TargetTest.cpp
index a6fc1aa..15a9374 100644
--- a/audio/aidl/vts/VtsHalAGC1TargetTest.cpp
+++ b/audio/aidl/vts/VtsHalAGC1TargetTest.cpp
@@ -14,10 +14,9 @@
* limitations under the License.
*/
-#include <Utils.h>
#include <aidl/Vintf.h>
-
#define LOG_TAG "VtsHalAGC1ParamTest"
+#include <android-base/logging.h>
#include "EffectHelper.h"
diff --git a/audio/aidl/vts/VtsHalAGC2TargetTest.cpp b/audio/aidl/vts/VtsHalAGC2TargetTest.cpp
index fd3a866..140537e 100644
--- a/audio/aidl/vts/VtsHalAGC2TargetTest.cpp
+++ b/audio/aidl/vts/VtsHalAGC2TargetTest.cpp
@@ -14,12 +14,10 @@
* limitations under the License.
*/
-#include <Utils.h>
#include <aidl/Vintf.h>
-#include <android/binder_enums.h>
-#include <unordered_set>
-
#define LOG_TAG "VtsHalAGC2ParamTest"
+#include <android-base/logging.h>
+#include <android/binder_enums.h>
#include "EffectHelper.h"
@@ -200,4 +198,4 @@
ABinderProcess_setThreadPoolMaxThreadCount(1);
ABinderProcess_startThreadPool();
return RUN_ALL_TESTS();
-}
\ No newline at end of file
+}
diff --git a/audio/aidl/vts/VtsHalAudioCoreConfigTargetTest.cpp b/audio/aidl/vts/VtsHalAudioCoreConfigTargetTest.cpp
index e7f5817..e5e06eb 100644
--- a/audio/aidl/vts/VtsHalAudioCoreConfigTargetTest.cpp
+++ b/audio/aidl/vts/VtsHalAudioCoreConfigTargetTest.cpp
@@ -1,17 +1,32 @@
+/*
+ * Copyright (C) 2023 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 <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
-#define LOG_TAG "VtsHalAudioCore.Config"
-
-#include <Utils.h>
#include <aidl/Gtest.h>
#include <aidl/Vintf.h>
#include <aidl/android/hardware/audio/core/IConfig.h>
#include <aidl/android/media/audio/common/AudioFlag.h>
#include <aidl/android/media/audio/common/AudioProductStrategyType.h>
+#define LOG_TAG "VtsHalAudioCore.Config"
+#include <android-base/logging.h>
#include "AudioHalBinderServiceUtil.h"
#include "TestUtils.h"
diff --git a/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp b/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp
index 650a543..5d522a3 100644
--- a/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp
+++ b/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp
@@ -54,6 +54,10 @@
using namespace android;
using aidl::android::hardware::audio::common::AudioOffloadMetadata;
+using aidl::android::hardware::audio::common::getChannelCount;
+using aidl::android::hardware::audio::common::isBitPositionFlagSet;
+using aidl::android::hardware::audio::common::isTelephonyDeviceType;
+using aidl::android::hardware::audio::common::isValidAudioMode;
using aidl::android::hardware::audio::common::PlaybackTrackMetadata;
using aidl::android::hardware::audio::common::RecordTrackMetadata;
using aidl::android::hardware::audio::common::SinkMetadata;
@@ -100,10 +104,6 @@
using aidl::android::media::audio::common::MicrophoneDynamicInfo;
using aidl::android::media::audio::common::MicrophoneInfo;
using aidl::android::media::audio::common::Void;
-using android::hardware::audio::common::getChannelCount;
-using android::hardware::audio::common::isBitPositionFlagSet;
-using android::hardware::audio::common::isTelephonyDeviceType;
-using android::hardware::audio::common::isValidAudioMode;
using android::hardware::audio::common::StreamLogic;
using android::hardware::audio::common::StreamWorker;
using ndk::enum_range;
@@ -2148,6 +2148,23 @@
<< "setEnabled without actual state change must not fail";
}
+TEST_P(AudioCoreBluetoothLe, OffloadReconfiguration) {
+ if (bluetooth == nullptr) {
+ GTEST_SKIP() << "BluetoothLe is not supported";
+ }
+ bool isSupported;
+ ASSERT_IS_OK(bluetooth->supportsOffloadReconfiguration(&isSupported));
+ bool isSupported2;
+ ASSERT_IS_OK(bluetooth->supportsOffloadReconfiguration(&isSupported2));
+ EXPECT_EQ(isSupported, isSupported2);
+ if (isSupported) {
+ static const auto kStatuses = {EX_NONE, EX_ILLEGAL_STATE};
+ EXPECT_STATUS(kStatuses, bluetooth->reconfigureOffload({}));
+ } else {
+ EXPECT_STATUS(EX_UNSUPPORTED_OPERATION, bluetooth->reconfigureOffload({}));
+ }
+}
+
class AudioCoreTelephony : public AudioCoreModuleBase, public testing::TestWithParam<std::string> {
public:
void SetUp() override {
diff --git a/audio/aidl/vts/VtsHalAudioEffectTargetTest.cpp b/audio/aidl/vts/VtsHalAudioEffectTargetTest.cpp
index 947d30e..df66bd3 100644
--- a/audio/aidl/vts/VtsHalAudioEffectTargetTest.cpp
+++ b/audio/aidl/vts/VtsHalAudioEffectTargetTest.cpp
@@ -21,7 +21,6 @@
#include <string>
#include <vector>
-#include <Utils.h>
#include <aidl/Gtest.h>
#include <aidl/Vintf.h>
#include <aidl/android/hardware/audio/effect/IEffect.h>
diff --git a/audio/aidl/vts/VtsHalBassBoostTargetTest.cpp b/audio/aidl/vts/VtsHalBassBoostTargetTest.cpp
index a1862d2..824bd9f 100644
--- a/audio/aidl/vts/VtsHalBassBoostTargetTest.cpp
+++ b/audio/aidl/vts/VtsHalBassBoostTargetTest.cpp
@@ -14,12 +14,12 @@
* limitations under the License.
*/
-#define LOG_TAG "VtsHalBassBoostTest"
-
-#include <Utils.h>
-#include <aidl/Vintf.h>
#include <limits.h>
+#include <aidl/Vintf.h>
+#define LOG_TAG "VtsHalBassBoostTest"
+#include <android-base/logging.h>
+
#include "EffectHelper.h"
using namespace android;
diff --git a/audio/aidl/vts/VtsHalDownmixTargetTest.cpp b/audio/aidl/vts/VtsHalDownmixTargetTest.cpp
index 0601cc4..bd3b76b 100644
--- a/audio/aidl/vts/VtsHalDownmixTargetTest.cpp
+++ b/audio/aidl/vts/VtsHalDownmixTargetTest.cpp
@@ -14,10 +14,10 @@
* limitations under the License.
*/
-#define LOG_TAG "VtsHalDownmixTargetTest"
-
-#include <Utils.h>
#include <aidl/Vintf.h>
+#define LOG_TAG "VtsHalDownmixTargetTest"
+#include <android-base/logging.h>
+
#include "EffectHelper.h"
using namespace android;
diff --git a/audio/aidl/vts/VtsHalDynamicsProcessingTest.cpp b/audio/aidl/vts/VtsHalDynamicsProcessingTest.cpp
index 3e6fa7a..0b05b17 100644
--- a/audio/aidl/vts/VtsHalDynamicsProcessingTest.cpp
+++ b/audio/aidl/vts/VtsHalDynamicsProcessingTest.cpp
@@ -14,16 +14,16 @@
* limitations under the License.
*/
-#include <aidl/Vintf.h>
-
-#define LOG_TAG "VtsHalDynamicsProcessingTest"
-
#include <set>
#include <string>
-#include <unordered_map>
#include <unordered_set>
+#include <aidl/Vintf.h>
+#define LOG_TAG "VtsHalDynamicsProcessingTest"
+#include <android-base/logging.h>
+
#include <Utils.h>
+
#include "EffectHelper.h"
using namespace android;
@@ -45,7 +45,7 @@
int32_t channelLayOut = AudioChannelLayout::LAYOUT_STEREO) {
std::tie(mFactory, mDescriptor) = pair;
mChannelLayout = channelLayOut;
- mChannelCount = ::android::hardware::audio::common::getChannelCount(
+ mChannelCount = ::aidl::android::hardware::audio::common::getChannelCount(
AudioChannelLayout::make<AudioChannelLayout::layoutMask>(mChannelLayout));
}
diff --git a/audio/aidl/vts/VtsHalEnvironmentalReverbTargetTest.cpp b/audio/aidl/vts/VtsHalEnvironmentalReverbTargetTest.cpp
index fea41cb..a2deb7c 100644
--- a/audio/aidl/vts/VtsHalEnvironmentalReverbTargetTest.cpp
+++ b/audio/aidl/vts/VtsHalEnvironmentalReverbTargetTest.cpp
@@ -14,11 +14,10 @@
* limitations under the License.
*/
-#define LOG_TAG "VtsHalEnvironmentalReverbTest"
-
-#include <Utils.h>
#include <aidl/Vintf.h>
-#include <unordered_set>
+#define LOG_TAG "VtsHalEnvironmentalReverbTest"
+#include <android-base/logging.h>
+
#include "EffectHelper.h"
using namespace android;
diff --git a/audio/aidl/vts/VtsHalEqualizerTargetTest.cpp b/audio/aidl/vts/VtsHalEqualizerTargetTest.cpp
index 54d00a7..9beb0a7 100644
--- a/audio/aidl/vts/VtsHalEqualizerTargetTest.cpp
+++ b/audio/aidl/vts/VtsHalEqualizerTargetTest.cpp
@@ -22,10 +22,11 @@
#include <string>
#include <vector>
-#define LOG_TAG "VtsHalEqualizerTest"
-
#include <aidl/Gtest.h>
#include <aidl/Vintf.h>
+#include <aidl/android/hardware/audio/effect/IEffect.h>
+#include <aidl/android/hardware/audio/effect/IFactory.h>
+#define LOG_TAG "VtsHalEqualizerTest"
#include <android-base/logging.h>
#include <android-base/properties.h>
#include <android/binder_interface_utils.h>
@@ -33,10 +34,6 @@
#include <android/binder_process.h>
#include <gtest/gtest.h>
-#include <Utils.h>
-#include <aidl/android/hardware/audio/effect/IEffect.h>
-#include <aidl/android/hardware/audio/effect/IFactory.h>
-
#include "AudioHalBinderServiceUtil.h"
#include "EffectHelper.h"
#include "TestUtils.h"
diff --git a/audio/aidl/vts/VtsHalHapticGeneratorTargetTest.cpp b/audio/aidl/vts/VtsHalHapticGeneratorTargetTest.cpp
index 6c3016e..32ebc4f 100644
--- a/audio/aidl/vts/VtsHalHapticGeneratorTargetTest.cpp
+++ b/audio/aidl/vts/VtsHalHapticGeneratorTargetTest.cpp
@@ -14,15 +14,15 @@
* limitations under the License.
*/
-#define LOG_TAG "VtsHalHapticGeneratorTargetTest"
-
-#include <Utils.h>
-#include <aidl/Vintf.h>
-#include <android/binder_enums.h>
#include <map>
#include <utility>
#include <vector>
+#include <aidl/Vintf.h>
+#define LOG_TAG "VtsHalHapticGeneratorTargetTest"
+#include <android-base/logging.h>
+#include <android/binder_enums.h>
+
#include "EffectHelper.h"
using namespace android;
diff --git a/audio/aidl/vts/VtsHalLoudnessEnhancerTargetTest.cpp b/audio/aidl/vts/VtsHalLoudnessEnhancerTargetTest.cpp
index 75941ff..5faf7f4 100644
--- a/audio/aidl/vts/VtsHalLoudnessEnhancerTargetTest.cpp
+++ b/audio/aidl/vts/VtsHalLoudnessEnhancerTargetTest.cpp
@@ -14,12 +14,12 @@
* limitations under the License.
*/
-#include <aidl/Vintf.h>
#include <string>
+#include <aidl/Vintf.h>
#define LOG_TAG "VtsHalLoudnessEnhancerTest"
+#include <android-base/logging.h>
-#include <Utils.h>
#include "EffectHelper.h"
using namespace android;
diff --git a/audio/aidl/vts/VtsHalNSTargetTest.cpp b/audio/aidl/vts/VtsHalNSTargetTest.cpp
index 16c79e3..4fcda6b 100644
--- a/audio/aidl/vts/VtsHalNSTargetTest.cpp
+++ b/audio/aidl/vts/VtsHalNSTargetTest.cpp
@@ -14,14 +14,14 @@
* limitations under the License.
*/
-#include <Utils.h>
-#include <aidl/Vintf.h>
-#include <android/binder_enums.h>
#include <unordered_set>
-#define LOG_TAG "VtsHalNSParamTest"
-
+#include <aidl/Vintf.h>
#include <aidl/android/hardware/audio/effect/NoiseSuppression.h>
+#define LOG_TAG "VtsHalNSParamTest"
+#include <android-base/logging.h>
+#include <android/binder_enums.h>
+
#include "EffectHelper.h"
using namespace android;
@@ -171,4 +171,4 @@
ABinderProcess_setThreadPoolMaxThreadCount(1);
ABinderProcess_startThreadPool();
return RUN_ALL_TESTS();
-}
\ No newline at end of file
+}
diff --git a/audio/aidl/vts/VtsHalPresetReverbTargetTest.cpp b/audio/aidl/vts/VtsHalPresetReverbTargetTest.cpp
index c9c2a31..7bce9c3 100644
--- a/audio/aidl/vts/VtsHalPresetReverbTargetTest.cpp
+++ b/audio/aidl/vts/VtsHalPresetReverbTargetTest.cpp
@@ -14,11 +14,11 @@
* limitations under the License.
*/
-#define LOG_TAG "VtsHalPresetReverbTargetTest"
-
-#include <Utils.h>
#include <aidl/Vintf.h>
+#define LOG_TAG "VtsHalPresetReverbTargetTest"
+#include <android-base/logging.h>
#include <android/binder_enums.h>
+
#include "EffectHelper.h"
using namespace android;
diff --git a/audio/aidl/vts/VtsHalVirtualizerTargetTest.cpp b/audio/aidl/vts/VtsHalVirtualizerTargetTest.cpp
index 8b0210c..84b980f 100644
--- a/audio/aidl/vts/VtsHalVirtualizerTargetTest.cpp
+++ b/audio/aidl/vts/VtsHalVirtualizerTargetTest.cpp
@@ -14,10 +14,10 @@
* limitations under the License.
*/
-#define LOG_TAG "VtsHalVirtualizerTest"
-
-#include <Utils.h>
#include <aidl/Vintf.h>
+#define LOG_TAG "VtsHalVirtualizerTest"
+#include <android-base/logging.h>
+
#include "EffectHelper.h"
using namespace android;
diff --git a/audio/aidl/vts/VtsHalVisualizerTargetTest.cpp b/audio/aidl/vts/VtsHalVisualizerTargetTest.cpp
index e2625cb..e273824 100644
--- a/audio/aidl/vts/VtsHalVisualizerTargetTest.cpp
+++ b/audio/aidl/vts/VtsHalVisualizerTargetTest.cpp
@@ -14,14 +14,13 @@
* limitations under the License.
*/
-#include <aidl/Vintf.h>
-
-#define LOG_TAG "VtsHalVisualizerTest"
-
-#include <Utils.h>
-#include <android/binder_enums.h>
#include <unordered_set>
+#include <aidl/Vintf.h>
+#define LOG_TAG "VtsHalVisualizerTest"
+#include <android-base/logging.h>
+#include <android/binder_enums.h>
+
#include "EffectHelper.h"
using namespace android;
@@ -213,4 +212,4 @@
ABinderProcess_setThreadPoolMaxThreadCount(1);
ABinderProcess_startThreadPool();
return RUN_ALL_TESTS();
-}
\ No newline at end of file
+}
diff --git a/audio/aidl/vts/VtsHalVolumeTargetTest.cpp b/audio/aidl/vts/VtsHalVolumeTargetTest.cpp
index 44ce146..fbd10a8 100644
--- a/audio/aidl/vts/VtsHalVolumeTargetTest.cpp
+++ b/audio/aidl/vts/VtsHalVolumeTargetTest.cpp
@@ -14,10 +14,10 @@
* limitations under the License.
*/
-#define LOG_TAG "VtsHalVolumeTest"
-
-#include <Utils.h>
#include <aidl/Vintf.h>
+#define LOG_TAG "VtsHalVolumeTest"
+#include <android-base/logging.h>
+
#include "EffectHelper.h"
using namespace android;
diff --git a/audio/common/all-versions/default/HidlUtils.h b/audio/common/all-versions/default/HidlUtils.h
index ad9dee2..844a651 100644
--- a/audio/common/all-versions/default/HidlUtils.h
+++ b/audio/common/all-versions/default/HidlUtils.h
@@ -81,7 +81,7 @@
#endif
#if MAJOR_VERSION >= 7
- static constexpr char sAudioTagSeparator = ';';
+ static constexpr char sAudioTagSeparator = AUDIO_ATTRIBUTES_TAGS_SEPARATOR;
static status_t audioChannelMaskFromHal(audio_channel_mask_t halChannelMask, bool isInput,
AudioChannelMask* channelMask);
diff --git a/gatekeeper/OWNERS b/gatekeeper/OWNERS
index fddc2ff..5262dce 100644
--- a/gatekeeper/OWNERS
+++ b/gatekeeper/OWNERS
@@ -1,4 +1,6 @@
# Bug component: 1124862
-swillden@google.com
+drysdale@google.com
guangzhu@google.com
+oarbildo@google.com
subrahmanyaman@google.com
+swillden@google.com
diff --git a/identity/aidl/vts/Util.cpp b/identity/aidl/vts/Util.cpp
index f3d7c30..4f5c121 100644
--- a/identity/aidl/vts/Util.cpp
+++ b/identity/aidl/vts/Util.cpp
@@ -523,8 +523,24 @@
int64_t allowDriftSecs = 10;
EXPECT_LE(-allowDriftSecs, diffSecs);
EXPECT_GE(allowDriftSecs, diffSecs);
- constexpr uint64_t kSecsInOneYear = 365 * 24 * 60 * 60;
- EXPECT_EQ(notBefore + kSecsInOneYear, notAfter);
+
+ // The AIDL spec used to call for "one year in the future (365
+ // days)" but was updated to say "current time and 31536000
+ // seconds in the future (approximately 365 days)" to clarify that
+ // this was the original intention.
+ //
+ // However a number of implementations interpreted this as a
+ // "literal year" which started causing problems in March 2023
+ // because 2024 is a leap year. Since the extra day doesn't really
+ // matter (the validity period is specified in the MSO anyway and
+ // that's what RPs use), we allow both interpretations.
+ //
+ // For simplicity, we just require that that notAfter is after
+ // 31536000 and which also covers the case if there's a leap-day
+ // and possible leap-seconds.
+ //
+ constexpr uint64_t kSecsIn365Days = 365 * 24 * 60 * 60;
+ EXPECT_LE(notBefore + kSecsIn365Days, notAfter);
}
vector<RequestNamespace> buildRequestNamespaces(const vector<TestEntryData> entries) {
diff --git a/security/keymint/aidl/default/Android.bp b/security/keymint/aidl/default/Android.bp
index 17520b7..953630b 100644
--- a/security/keymint/aidl/default/Android.bp
+++ b/security/keymint/aidl/default/Android.bp
@@ -42,7 +42,6 @@
"service.cpp",
],
required: [
- "RemoteProvisioner",
"android.hardware.hardware_keystore.xml",
],
}
diff --git a/security/keymint/aidl/vts/functional/AttestKeyTest.cpp b/security/keymint/aidl/vts/functional/AttestKeyTest.cpp
index bbf3633..8ffc179 100644
--- a/security/keymint/aidl/vts/functional/AttestKeyTest.cpp
+++ b/security/keymint/aidl/vts/functional/AttestKeyTest.cpp
@@ -172,8 +172,9 @@
// allowing it to be launched with Android S (or later) with Keymaster 4.0
// in StrongBox
void check_skip_test(void) const {
- if (is_attest_key_feature_disabled() && is_strongbox_enabled() &&
- is_chipset_allowed_km4_strongbox()) {
+ // Check the chipset first as that doesn't require a round-trip to Package Manager.
+ if (is_chipset_allowed_km4_strongbox() && is_strongbox_enabled() &&
+ is_attest_key_feature_disabled()) {
GTEST_SKIP() << "Test is not applicable";
}
}
diff --git a/security/keymint/aidl/vts/functional/AuthTest.cpp b/security/keymint/aidl/vts/functional/AuthTest.cpp
index a31ac01..78c88f4 100644
--- a/security/keymint/aidl/vts/functional/AuthTest.cpp
+++ b/security/keymint/aidl/vts/functional/AuthTest.cpp
@@ -274,7 +274,7 @@
std::shared_ptr<ISecureClock> clock_;
string password_;
uint32_t uid_;
- long sid_;
+ int64_t sid_;
std::vector<uint8_t> handle_;
};
diff --git a/security/keymint/aidl/vts/functional/KeyMintAidlTestBase.cpp b/security/keymint/aidl/vts/functional/KeyMintAidlTestBase.cpp
index fb5ef49..1dec8d7 100644
--- a/security/keymint/aidl/vts/functional/KeyMintAidlTestBase.cpp
+++ b/security/keymint/aidl/vts/functional/KeyMintAidlTestBase.cpp
@@ -108,6 +108,15 @@
return true;
}
+void check_crl_distribution_points_extension_not_present(X509* certificate) {
+ ASN1_OBJECT_Ptr crl_dp_oid(OBJ_txt2obj(kCrlDPOid, 1 /* dotted string format */));
+ ASSERT_TRUE(crl_dp_oid.get());
+
+ int location =
+ X509_get_ext_by_OBJ(certificate, crl_dp_oid.get(), -1 /* search from beginning */);
+ ASSERT_EQ(location, -1);
+}
+
void check_attestation_version(uint32_t attestation_version, int32_t aidl_version) {
// Version numbers in attestation extensions should be a multiple of 100.
EXPECT_EQ(attestation_version % 100, 0);
@@ -1690,6 +1699,10 @@
EXPECT_TRUE(!!cert.get());
if (!cert.get()) return false;
+ // Make sure CRL Distribution Points extension is not present in a certificate
+ // containing attestation record.
+ check_crl_distribution_points_extension_not_present(cert.get());
+
ASN1_OCTET_STRING* attest_rec = get_attestation_record(cert.get());
EXPECT_TRUE(!!attest_rec);
if (!attest_rec) return false;
diff --git a/security/keymint/aidl/vts/functional/KeyMintAidlTestBase.h b/security/keymint/aidl/vts/functional/KeyMintAidlTestBase.h
index a6a9df6..3c753d1 100644
--- a/security/keymint/aidl/vts/functional/KeyMintAidlTestBase.h
+++ b/security/keymint/aidl/vts/functional/KeyMintAidlTestBase.h
@@ -356,7 +356,7 @@
SecurityLevel securityLevel_;
string name_;
string author_;
- long challenge_;
+ int64_t challenge_;
private:
void CheckEncryptOneByteAtATime(BlockMode block_mode, const int block_size,
diff --git a/security/keymint/support/include/keymint_support/attestation_record.h b/security/keymint/support/include/keymint_support/attestation_record.h
index bc76c93..f280f48 100644
--- a/security/keymint/support/include/keymint_support/attestation_record.h
+++ b/security/keymint/support/include/keymint_support/attestation_record.h
@@ -43,6 +43,8 @@
*/
static const char kAttestionRecordOid[] = "1.3.6.1.4.1.11129.2.1.17";
+static const char kCrlDPOid[] = "2.5.29.31"; // Standard CRL Distribution Points extension.
+
enum class VerifiedBoot : uint8_t {
VERIFIED = 0,
SELF_SIGNED = 1,
diff --git a/security/keymint/support/remote_prov_utils.cpp b/security/keymint/support/remote_prov_utils.cpp
index 9620b6a..086ee79 100644
--- a/security/keymint/support/remote_prov_utils.cpp
+++ b/security/keymint/support/remote_prov_utils.cpp
@@ -290,11 +290,12 @@
return chain.encode();
}
-ErrMsgOr<std::vector<BccEntryData>> validateBcc(const cppbor::Array* bcc) {
+ErrMsgOr<std::vector<BccEntryData>> validateBcc(const cppbor::Array* bcc,
+ hwtrust::DiceChain::Kind kind) {
auto encodedBcc = bcc->encode();
- auto chain = hwtrust::DiceChain::verify(encodedBcc);
+ auto chain = hwtrust::DiceChain::Verify(encodedBcc, kind);
if (!chain.ok()) return chain.error().message();
- auto keys = chain->cose_public_keys();
+ auto keys = chain->CosePublicKeys();
if (!keys.ok()) return keys.error().message();
std::vector<BccEntryData> result;
for (auto& key : *keys) {
@@ -569,7 +570,7 @@
}
// BCC is [ pubkey, + BccEntry]
- auto bccContents = validateBcc(bcc->asArray());
+ auto bccContents = validateBcc(bcc->asArray(), hwtrust::DiceChain::Kind::kProtectedData);
if (!bccContents) {
return bccContents.message() + "\n" + prettyPrint(bcc.get());
}
@@ -805,8 +806,8 @@
return "Challenge must be a Bstr.";
}
- if (challenge.size() < 32 || challenge.size() > 64) {
- return "Challenge size must be between 32 and 64 bytes inclusive. "
+ if (challenge.size() < 16 || challenge.size() > 64) {
+ return "Challenge size must be between 16 and 64 bytes inclusive. "
"However, challenge is " +
std::to_string(challenge.size()) + " bytes long.";
}
@@ -859,8 +860,8 @@
return "AuthenticatedRequest SignedData must be an Array.";
}
- // DICE chain is [ pubkey, + DiceChainEntry ]. Its format is the same as BCC from RKP v1-2.
- auto diceContents = validateBcc(diceCertChain);
+ // DICE chain is [ pubkey, + DiceChainEntry ].
+ auto diceContents = validateBcc(diceCertChain, hwtrust::DiceChain::Kind::kAuthenticatedMessage);
if (!diceContents) {
return diceContents.message() + "\n" + prettyPrint(diceCertChain);
}
diff --git a/security/rkp/aidl/android/hardware/security/keymint/IRemotelyProvisionedComponent.aidl b/security/rkp/aidl/android/hardware/security/keymint/IRemotelyProvisionedComponent.aidl
index 5bd2145..35b83dd 100644
--- a/security/rkp/aidl/android/hardware/security/keymint/IRemotelyProvisionedComponent.aidl
+++ b/security/rkp/aidl/android/hardware/security/keymint/IRemotelyProvisionedComponent.aidl
@@ -315,7 +315,7 @@
*
* @param in challenge contains a byte string from the provisioning server which will be
* included in the signed data of the CSR structure. Different provisioned backends may
- * use different semantic data for this field, but the supported sizes must be between 32
+ * use different semantic data for this field, but the supported sizes must be between 16
* and 64 bytes, inclusive.
*
* @return the following CBOR Certificate Signing Request (Csr) serialized into a byte array:
diff --git a/tv/tuner/aidl/default/Dvr.cpp b/tv/tuner/aidl/default/Dvr.cpp
index c591d07..c157bdd 100644
--- a/tv/tuner/aidl/default/Dvr.cpp
+++ b/tv/tuner/aidl/default/Dvr.cpp
@@ -164,7 +164,7 @@
return false;
}
- mDvrMQ = move(tmpDvrMQ);
+ mDvrMQ = std::move(tmpDvrMQ);
if (EventFlag::createEventFlag(mDvrMQ->getEventFlagWord(), &mDvrEventFlag) != ::android::OK) {
return false;
diff --git a/vibrator/aidl/default/example_java_client/Android.bp b/vibrator/aidl/default/example_java_client/Android.bp
new file mode 100644
index 0000000..17a649c
--- /dev/null
+++ b/vibrator/aidl/default/example_java_client/Android.bp
@@ -0,0 +1,54 @@
+package {
+ // See: http://go/android-license-faq
+ // A large-scale-change added 'default_applicable_licenses' to import
+ // all of the 'license_kinds' from "hardware_interfaces_license"
+ // to get the below license kinds:
+ // SPDX-license-identifier-Apache-2.0
+ default_applicable_licenses: ["hardware_interfaces_license"],
+}
+
+cc_library {
+ name: "libexample_vib_getter",
+ srcs: ["getter.cpp"],
+ product_available: true,
+ vendor_available: true,
+ shared_libs: [
+ "liblog",
+ "libbinder_ndk",
+ ],
+ header_libs: ["jni_headers"],
+ stl: "c++_shared",
+ visibility: [":__subpackages__"],
+}
+
+android_app {
+ name: "ExampleVibratorJavaVendorClient",
+ vendor: true,
+ static_libs: ["android.hardware.vibrator-V1-java"],
+ jni_libs: ["libexample_vib_getter"],
+ use_embedded_native_libs: true,
+ jarjar_rules: "jarjar.txt",
+ stl: "c++_shared",
+ srcs: ["example/vib/MyActivity.java"],
+ sdk_version: "system_current",
+ visibility: [":__subpackages__"],
+}
+
+android_app {
+ name: "ExampleVibratorJavaProductClient",
+ product_specific: true,
+ static_libs: ["android.hardware.vibrator-V1-java"],
+ jni_libs: ["libexample_vib_getter"],
+ use_embedded_native_libs: true,
+ jarjar_rules: "jarjar.txt",
+ stl: "c++_shared",
+ srcs: ["example/vib/MyActivity.java"],
+ sdk_version: "system_current",
+ visibility: [":__subpackages__"],
+ // If PRODUCT_ENFORCE_PRODUCT_PARTITION_INTERFACE is not true, product apps
+ // may use unstable APIs. jni_uses_platform_apis must set to use the
+ // non-SDK jni libs in this case.
+ // This is not required if PRODUCT_ENFORCE_PRODUCT_PARTITION_INTERFACE is
+ // set to true.
+ jni_uses_platform_apis: true,
+}
diff --git a/vibrator/aidl/default/example_vendor_java_client/AndroidManifest.xml b/vibrator/aidl/default/example_java_client/AndroidManifest.xml
similarity index 100%
rename from vibrator/aidl/default/example_vendor_java_client/AndroidManifest.xml
rename to vibrator/aidl/default/example_java_client/AndroidManifest.xml
diff --git a/vibrator/aidl/default/example_vendor_java_client/example/vib/MyActivity.java b/vibrator/aidl/default/example_java_client/example/vib/MyActivity.java
similarity index 100%
rename from vibrator/aidl/default/example_vendor_java_client/example/vib/MyActivity.java
rename to vibrator/aidl/default/example_java_client/example/vib/MyActivity.java
diff --git a/vibrator/aidl/default/example_vendor_java_client/getter.cpp b/vibrator/aidl/default/example_java_client/getter.cpp
similarity index 100%
rename from vibrator/aidl/default/example_vendor_java_client/getter.cpp
rename to vibrator/aidl/default/example_java_client/getter.cpp
diff --git a/vibrator/aidl/default/example_vendor_java_client/jarjar.txt b/vibrator/aidl/default/example_java_client/jarjar.txt
similarity index 100%
rename from vibrator/aidl/default/example_vendor_java_client/jarjar.txt
rename to vibrator/aidl/default/example_java_client/jarjar.txt
diff --git a/vibrator/aidl/default/example_vendor_java_client/Android.bp b/vibrator/aidl/default/example_vendor_java_client/Android.bp
deleted file mode 100644
index f615cb1..0000000
--- a/vibrator/aidl/default/example_vendor_java_client/Android.bp
+++ /dev/null
@@ -1,34 +0,0 @@
-package {
- // See: http://go/android-license-faq
- // A large-scale-change added 'default_applicable_licenses' to import
- // all of the 'license_kinds' from "hardware_interfaces_license"
- // to get the below license kinds:
- // SPDX-license-identifier-Apache-2.0
- default_applicable_licenses: ["hardware_interfaces_license"],
-}
-
-cc_library {
- name: "libexample_vib_getter",
- srcs: ["getter.cpp"],
- vendor: true,
- shared_libs: [
- "liblog",
- "libbinder_ndk",
- ],
- header_libs: ["jni_headers"],
- stl: "c++_shared",
- visibility: [":__subpackages__"],
-}
-
-android_app {
- name: "ExampleVibratorJavaVendorClient",
- privileged: true,
- vendor: true,
- static_libs: ["android.hardware.vibrator-V1-java"],
- jni_libs: ["libexample_vib_getter"],
- jarjar_rules: "jarjar.txt",
- stl: "c++_shared",
- srcs: ["example/vib/MyActivity.java"],
- sdk_version: "system_current",
- visibility: [":__subpackages__"],
-}