Merge changes from topic "presubmit-am-b0494ecceafb42819a1320b09b4ee514" into udc-dev
* changes:
[automerge] Add a Vendor dependent UCI Status code for UWB OFF 2p: 3f884a8b91
Add a Vendor dependent UCI Status code for UWB OFF
diff --git a/audio/aidl/Android.bp b/audio/aidl/Android.bp
index 2c91918..bb48ecd 100644
--- a/audio/aidl/Android.bp
+++ b/audio/aidl/Android.bp
@@ -113,6 +113,7 @@
"android/hardware/audio/core/AudioPatch.aidl",
"android/hardware/audio/core/AudioRoute.aidl",
"android/hardware/audio/core/IBluetooth.aidl",
+ "android/hardware/audio/core/IBluetoothA2dp.aidl",
"android/hardware/audio/core/IConfig.aidl",
"android/hardware/audio/core/IModule.aidl",
"android/hardware/audio/core/IStreamCallback.aidl",
diff --git a/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/IBluetoothA2dp.aidl b/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/IBluetoothA2dp.aidl
new file mode 100644
index 0000000..0f4c46d
--- /dev/null
+++ b/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/IBluetoothA2dp.aidl
@@ -0,0 +1,41 @@
+/*
+ * 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.audio.core;
+@VintfStability
+interface IBluetoothA2dp {
+ boolean isEnabled();
+ void setEnabled(boolean enabled);
+ boolean supportsOffloadReconfiguration();
+ void reconfigureOffload(in android.hardware.audio.core.VendorParameter[] parameters);
+}
diff --git a/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/IModule.aidl b/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/IModule.aidl
index 1eafdab..f18d6a5 100644
--- a/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/IModule.aidl
+++ b/audio/aidl/aidl_api/android.hardware.audio.core/current/android/hardware/audio/core/IModule.aidl
@@ -37,6 +37,7 @@
void setModuleDebug(in android.hardware.audio.core.ModuleDebug debug);
@nullable android.hardware.audio.core.ITelephony getTelephony();
@nullable android.hardware.audio.core.IBluetooth getBluetooth();
+ @nullable android.hardware.audio.core.IBluetoothA2dp getBluetoothA2dp();
android.media.audio.common.AudioPort connectExternalDevice(in android.media.audio.common.AudioPort templateIdAndAdditionalData);
void disconnectExternalDevice(int portId);
android.hardware.audio.core.AudioPatch[] getAudioPatches();
diff --git a/audio/aidl/android/hardware/audio/core/IBluetoothA2dp.aidl b/audio/aidl/android/hardware/audio/core/IBluetoothA2dp.aidl
new file mode 100644
index 0000000..dc4b8d0
--- /dev/null
+++ b/audio/aidl/android/hardware/audio/core/IBluetoothA2dp.aidl
@@ -0,0 +1,83 @@
+/*
+ * 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.
+ */
+
+package android.hardware.audio.core;
+
+import android.hardware.audio.core.VendorParameter;
+
+/**
+ * An instance of IBluetoothA2dp manages settings for the A2DP (Advanced Audio
+ * Distribution Profile) profiles. This interface is optional to implement by
+ * the vendor. It needs to be provided only if the device actually supports BT
+ * A2DP.
+ *
+ * This interface is separate from IBluetooth interface which manages SCO & HFP.
+ * The HAL module can handle both SCO and A2DP profiles or only one of them.
+ */
+@VintfStability
+interface IBluetoothA2dp {
+ /**
+ * Whether BT A2DP is enabled.
+ *
+ * Returns the current state of A2DP support. The client might need to
+ * disable (suspend) A2DP when another profile (for example, SCO) is
+ * activated.
+ *
+ * @return Whether BT A2DP is enabled.
+ */
+ boolean isEnabled();
+
+ /**
+ * Enable or disable A2DP.
+ *
+ * Sets the current state of A2DP support. The client might need to
+ * disable (suspend) A2DP when another profile (for example, SCO) is
+ * activated.
+ *
+ * @param enabled Whether BT A2DP must be enabled or suspended.
+ * @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 coded 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.
+ *
+ * @return Whether reconfiguration offload of offloaded codecs is supported.
+ */
+ boolean supportsOffloadReconfiguration();
+
+ /**
+ * Instructs the HAL module to reconfigure offloaded codec.
+ *
+ * Offloaded coded 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
+ * '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/android/hardware/audio/core/IModule.aidl b/audio/aidl/android/hardware/audio/core/IModule.aidl
index edfb9f2..080d826 100644
--- a/audio/aidl/android/hardware/audio/core/IModule.aidl
+++ b/audio/aidl/android/hardware/audio/core/IModule.aidl
@@ -21,6 +21,7 @@
import android.hardware.audio.core.AudioPatch;
import android.hardware.audio.core.AudioRoute;
import android.hardware.audio.core.IBluetooth;
+import android.hardware.audio.core.IBluetoothA2dp;
import android.hardware.audio.core.IStreamCallback;
import android.hardware.audio.core.IStreamIn;
import android.hardware.audio.core.IStreamOut;
@@ -103,6 +104,20 @@
@nullable IBluetooth getBluetooth();
/**
+ * Retrieve the interface to control Bluetooth A2DP.
+ *
+ * If the HAL module supports A2DP Profile functionality for Bluetooth, it
+ * must return an instance of the IBluetoothA2dp interface. The same
+ * instance must be returned during the lifetime of the HAL module. If the
+ * HAL module does not support BT A2DP, a null must be returned, without
+ * throwing any errors.
+ *
+ * @return An instance of the IBluetoothA2dp interface implementation.
+ * @throws EX_ILLEGAL_STATE If there was an error creating an instance.
+ */
+ @nullable IBluetoothA2dp getBluetoothA2dp();
+
+ /**
* Set a device port of an external device into connected state.
*
* This method is used to inform the HAL module that an external device has
@@ -596,6 +611,7 @@
* @param mute Whether the output from the module is muted.
* @throws EX_UNSUPPORTED_OPERATION If muting of combined output
* is not supported by the module.
+ * @throws EX_ILLEGAL_STATE If any error happens while muting of combined output.
*/
void setMasterMute(boolean mute);
@@ -627,6 +643,8 @@
* accepted range.
* @throws EX_UNSUPPORTED_OPERATION If attenuation of combined output
* is not supported by the module.
+ * @throws EX_ILLEGAL_STATE If any error happens while updating attenuation of
+ combined output.
*/
void setMasterVolume(float volume);
diff --git a/audio/aidl/android/hardware/audio/core/IStreamOut.aidl b/audio/aidl/android/hardware/audio/core/IStreamOut.aidl
index 54c8162..f26dc1c 100644
--- a/audio/aidl/android/hardware/audio/core/IStreamOut.aidl
+++ b/audio/aidl/android/hardware/audio/core/IStreamOut.aidl
@@ -98,7 +98,8 @@
* @throws EX_ILLEGAL_ARGUMENT If the number of elements in the provided
* array does not match the channel count, or
* attenuation values are out of range.
- * @throws EX_ILLEGAL_STATE If the stream is closed.
+ * @throws EX_ILLEGAL_STATE If the stream is closed or there is any error happens
+ when applying hardware volume.
* @throws EX_UNSUPPORTED_OPERATION If hardware volume control is not supported.
*/
void setHwVolume(in float[] channelVolumes);
diff --git a/audio/aidl/default/Android.bp b/audio/aidl/default/Android.bp
index 21616be..93362c6 100644
--- a/audio/aidl/default/Android.bp
+++ b/audio/aidl/default/Android.bp
@@ -75,6 +75,7 @@
"Telephony.cpp",
"usb/ModuleUsb.cpp",
"usb/StreamUsb.cpp",
+ "usb/UsbAlsaMixerControl.cpp",
"usb/UsbAlsaUtils.cpp",
],
generated_sources: [
diff --git a/audio/aidl/default/Bluetooth.cpp b/audio/aidl/default/Bluetooth.cpp
index 38e0c21..bd9a864 100644
--- a/audio/aidl/default/Bluetooth.cpp
+++ b/audio/aidl/default/Bluetooth.cpp
@@ -19,6 +19,7 @@
#include "core-impl/Bluetooth.h"
+using aidl::android::hardware::audio::core::VendorParameter;
using aidl::android::media::audio::common::Boolean;
using aidl::android::media::audio::common::Float;
using aidl::android::media::audio::common::Int;
@@ -79,4 +80,29 @@
return ndk::ScopedAStatus::ok();
}
+ndk::ScopedAStatus BluetoothA2dp::isEnabled(bool* _aidl_return) {
+ *_aidl_return = mEnabled;
+ LOG(DEBUG) << __func__ << ": returning " << *_aidl_return;
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus BluetoothA2dp::setEnabled(bool in_enabled) {
+ mEnabled = in_enabled;
+ LOG(DEBUG) << __func__ << ": " << mEnabled;
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus BluetoothA2dp::supportsOffloadReconfiguration(bool* _aidl_return) {
+ *_aidl_return = true;
+ LOG(DEBUG) << __func__ << ": returning " << *_aidl_return;
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus BluetoothA2dp::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/Module.cpp b/audio/aidl/default/Module.cpp
index 5440b8d..c4f3844 100644
--- a/audio/aidl/default/Module.cpp
+++ b/audio/aidl/default/Module.cpp
@@ -370,29 +370,32 @@
}
ndk::ScopedAStatus Module::getTelephony(std::shared_ptr<ITelephony>* _aidl_return) {
- if (mTelephony == nullptr) {
+ if (!mTelephony) {
mTelephony = ndk::SharedRefBase::make<Telephony>();
- mTelephonyBinder = mTelephony->asBinder();
- AIBinder_setMinSchedulerPolicy(mTelephonyBinder.get(), SCHED_NORMAL,
- ANDROID_PRIORITY_AUDIO);
}
- *_aidl_return = mTelephony;
+ *_aidl_return = mTelephony.getPtr();
LOG(DEBUG) << __func__ << ": returning instance of ITelephony: " << _aidl_return->get();
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus Module::getBluetooth(std::shared_ptr<IBluetooth>* _aidl_return) {
- if (mBluetooth == nullptr) {
+ if (!mBluetooth) {
mBluetooth = ndk::SharedRefBase::make<Bluetooth>();
- mBluetoothBinder = mBluetooth->asBinder();
- AIBinder_setMinSchedulerPolicy(mBluetoothBinder.get(), SCHED_NORMAL,
- ANDROID_PRIORITY_AUDIO);
}
- *_aidl_return = mBluetooth;
+ *_aidl_return = mBluetooth.getPtr();
LOG(DEBUG) << __func__ << ": returning instance of IBluetooth: " << _aidl_return->get();
return ndk::ScopedAStatus::ok();
}
+ndk::ScopedAStatus Module::getBluetoothA2dp(std::shared_ptr<IBluetoothA2dp>* _aidl_return) {
+ if (!mBluetoothA2dp) {
+ mBluetoothA2dp = ndk::SharedRefBase::make<BluetoothA2dp>();
+ }
+ *_aidl_return = mBluetoothA2dp.getPtr();
+ LOG(DEBUG) << __func__ << ": returning instance of IBluetoothA2dp: " << _aidl_return->get();
+ return ndk::ScopedAStatus::ok();
+}
+
ndk::ScopedAStatus Module::connectExternalDevice(const AudioPort& in_templateIdAndAdditionalData,
AudioPort* _aidl_return) {
const int32_t templateId = in_templateIdAndAdditionalData.id;
@@ -457,6 +460,7 @@
connectedPort.profiles = connectedProfilesIt->second;
}
ports.push_back(connectedPort);
+ onExternalDeviceConnectionChanged(connectedPort, true /*connected*/);
*_aidl_return = std::move(connectedPort);
std::vector<AudioRoute> newRoutes;
@@ -510,6 +514,7 @@
<< configIt->id;
return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_STATE);
}
+ onExternalDeviceConnectionChanged(*portIt, false /*connected*/);
ports.erase(portIt);
mConnectedDevicePorts.erase(in_portId);
LOG(DEBUG) << __func__ << ": connected device port " << in_portId << " released";
@@ -980,8 +985,17 @@
ndk::ScopedAStatus Module::setMasterMute(bool in_mute) {
LOG(DEBUG) << __func__ << ": " << in_mute;
- mMasterMute = in_mute;
- return ndk::ScopedAStatus::ok();
+ auto result = mDebug.simulateDeviceConnections ? ndk::ScopedAStatus::ok()
+ : onMasterMuteChanged(in_mute);
+ if (result.isOk()) {
+ mMasterMute = in_mute;
+ } else {
+ LOG(ERROR) << __func__ << ": failed calling onMasterMuteChanged(" << in_mute
+ << "), error=" << result;
+ // Reset master mute if it failed.
+ onMasterMuteChanged(mMasterMute);
+ }
+ return std::move(result);
}
ndk::ScopedAStatus Module::getMasterVolume(float* _aidl_return) {
@@ -993,8 +1007,17 @@
ndk::ScopedAStatus Module::setMasterVolume(float in_volume) {
LOG(DEBUG) << __func__ << ": " << in_volume;
if (in_volume >= 0.0f && in_volume <= 1.0f) {
- mMasterVolume = in_volume;
- return ndk::ScopedAStatus::ok();
+ auto result = mDebug.simulateDeviceConnections ? ndk::ScopedAStatus::ok()
+ : onMasterVolumeChanged(in_volume);
+ if (result.isOk()) {
+ mMasterVolume = in_volume;
+ } else {
+ // Reset master volume if it failed.
+ LOG(ERROR) << __func__ << ": failed calling onMasterVolumeChanged(" << in_volume
+ << "), error=" << result;
+ onMasterVolumeChanged(mMasterVolume);
+ }
+ return std::move(result);
}
LOG(ERROR) << __func__ << ": invalid master volume value: " << in_volume;
return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT);
@@ -1039,13 +1062,10 @@
}
ndk::ScopedAStatus Module::getSoundDose(std::shared_ptr<ISoundDose>* _aidl_return) {
- if (mSoundDose == nullptr) {
+ if (!mSoundDose) {
mSoundDose = ndk::SharedRefBase::make<sounddose::SoundDose>();
- mSoundDoseBinder = mSoundDose->asBinder();
- AIBinder_setMinSchedulerPolicy(mSoundDoseBinder.get(), SCHED_NORMAL,
- ANDROID_PRIORITY_AUDIO);
}
- *_aidl_return = mSoundDose;
+ *_aidl_return = mSoundDose.getPtr();
LOG(DEBUG) << __func__ << ": returning instance of ISoundDose: " << _aidl_return->get();
return ndk::ScopedAStatus::ok();
}
@@ -1251,14 +1271,30 @@
}
ndk::ScopedAStatus Module::populateConnectedDevicePort(AudioPort* audioPort __unused) {
- LOG(DEBUG) << __func__ << ": do nothing and return ok";
+ LOG(VERBOSE) << __func__ << ": do nothing and return ok";
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus Module::checkAudioPatchEndpointsMatch(
const std::vector<AudioPortConfig*>& sources __unused,
const std::vector<AudioPortConfig*>& sinks __unused) {
- LOG(DEBUG) << __func__ << ": do nothing and return ok";
+ LOG(VERBOSE) << __func__ << ": do nothing and return ok";
+ return ndk::ScopedAStatus::ok();
+}
+
+void Module::onExternalDeviceConnectionChanged(
+ const ::aidl::android::media::audio::common::AudioPort& audioPort __unused,
+ bool connected __unused) {
+ LOG(DEBUG) << __func__ << ": do nothing and return";
+}
+
+ndk::ScopedAStatus Module::onMasterMuteChanged(bool mute __unused) {
+ LOG(VERBOSE) << __func__ << ": do nothing and return ok";
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus Module::onMasterVolumeChanged(float volume __unused) {
+ LOG(VERBOSE) << __func__ << ": do nothing and return ok";
return ndk::ScopedAStatus::ok();
}
diff --git a/audio/aidl/default/include/core-impl/Bluetooth.h b/audio/aidl/default/include/core-impl/Bluetooth.h
index f2e762d..e2f48ba 100644
--- a/audio/aidl/default/include/core-impl/Bluetooth.h
+++ b/audio/aidl/default/include/core-impl/Bluetooth.h
@@ -17,6 +17,7 @@
#pragma once
#include <aidl/android/hardware/audio/core/BnBluetooth.h>
+#include <aidl/android/hardware/audio/core/BnBluetoothA2dp.h>
namespace aidl::android::hardware::audio::core {
@@ -32,4 +33,19 @@
HfpConfig mHfpConfig;
};
+class BluetoothA2dp : public BnBluetoothA2dp {
+ public:
+ BluetoothA2dp() = default;
+
+ 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;
+};
+
} // namespace aidl::android::hardware::audio::core
diff --git a/audio/aidl/default/include/core-impl/Module.h b/audio/aidl/default/include/core-impl/Module.h
index 8365b34..c35025f 100644
--- a/audio/aidl/default/include/core-impl/Module.h
+++ b/audio/aidl/default/include/core-impl/Module.h
@@ -46,11 +46,32 @@
bool forceTransientBurst = false;
bool forceSynchronousDrain = false;
};
+ // Helper used for interfaces that require a persistent instance. We hold them via a strong
+ // pointer. The binder token is retained for a call to 'setMinSchedulerPolicy'.
+ template <class C>
+ struct ChildInterface : private std::pair<std::shared_ptr<C>, ndk::SpAIBinder> {
+ ChildInterface() {}
+ ChildInterface& operator=(const std::shared_ptr<C>& c) {
+ return operator=(std::shared_ptr<C>(c));
+ }
+ ChildInterface& operator=(std::shared_ptr<C>&& c) {
+ this->first = std::move(c);
+ this->second = this->first->asBinder();
+ AIBinder_setMinSchedulerPolicy(this->second.get(), SCHED_NORMAL,
+ ANDROID_PRIORITY_AUDIO);
+ return *this;
+ }
+ explicit operator bool() const { return !!this->first; }
+ C& operator*() const { return *(this->first); }
+ C* operator->() const { return this->first; }
+ std::shared_ptr<C> getPtr() const { return this->first; }
+ };
ndk::ScopedAStatus setModuleDebug(
const ::aidl::android::hardware::audio::core::ModuleDebug& in_debug) override;
ndk::ScopedAStatus getTelephony(std::shared_ptr<ITelephony>* _aidl_return) override;
ndk::ScopedAStatus getBluetooth(std::shared_ptr<IBluetooth>* _aidl_return) override;
+ ndk::ScopedAStatus getBluetoothA2dp(std::shared_ptr<IBluetoothA2dp>* _aidl_return) override;
ndk::ScopedAStatus connectExternalDevice(
const ::aidl::android::media::audio::common::AudioPort& in_templateIdAndAdditionalData,
::aidl::android::media::audio::common::AudioPort* _aidl_return) override;
@@ -151,23 +172,17 @@
std::unique_ptr<internal::Configuration> mConfig;
ModuleDebug mDebug;
VendorDebug mVendorDebug;
- // For the interfaces requiring to return the same instance, we need to hold them
- // via a strong pointer. The binder token is retained for a call to 'setMinSchedulerPolicy'.
- std::shared_ptr<ITelephony> mTelephony;
- ndk::SpAIBinder mTelephonyBinder;
- std::shared_ptr<IBluetooth> mBluetooth;
- ndk::SpAIBinder mBluetoothBinder;
+ ChildInterface<ITelephony> mTelephony;
+ ChildInterface<IBluetooth> mBluetooth;
+ ChildInterface<IBluetoothA2dp> mBluetoothA2dp;
// ids of ports created at runtime via 'connectExternalDevice'.
std::set<int32_t> mConnectedDevicePorts;
Streams mStreams;
// Maps port ids and port config ids to patch ids.
// Multimap because both ports and configs can be used by multiple patches.
std::multimap<int32_t, int32_t> mPatches;
- bool mMasterMute = false;
- float mMasterVolume = 1.0f;
bool mMicMute = false;
- std::shared_ptr<sounddose::ISoundDose> mSoundDose;
- ndk::SpAIBinder mSoundDoseBinder;
+ ChildInterface<sounddose::ISoundDose> mSoundDose;
std::optional<bool> mIsMmapSupported;
protected:
@@ -180,6 +195,13 @@
virtual ndk::ScopedAStatus checkAudioPatchEndpointsMatch(
const std::vector<::aidl::android::media::audio::common::AudioPortConfig*>& sources,
const std::vector<::aidl::android::media::audio::common::AudioPortConfig*>& sinks);
+ virtual void onExternalDeviceConnectionChanged(
+ const ::aidl::android::media::audio::common::AudioPort& audioPort, bool connected);
+ virtual ndk::ScopedAStatus onMasterMuteChanged(bool mute);
+ virtual ndk::ScopedAStatus onMasterVolumeChanged(float volume);
+
+ bool mMasterMute = false;
+ float mMasterVolume = 1.0f;
};
} // namespace aidl::android::hardware::audio::core
diff --git a/audio/aidl/default/include/core-impl/ModuleUsb.h b/audio/aidl/default/include/core-impl/ModuleUsb.h
index 7b177e8..1aa2244 100644
--- a/audio/aidl/default/include/core-impl/ModuleUsb.h
+++ b/audio/aidl/default/include/core-impl/ModuleUsb.h
@@ -28,10 +28,6 @@
// IModule interfaces
ndk::ScopedAStatus getTelephony(std::shared_ptr<ITelephony>* _aidl_return) override;
ndk::ScopedAStatus getBluetooth(std::shared_ptr<IBluetooth>* _aidl_return) override;
- ndk::ScopedAStatus getMasterMute(bool* _aidl_return) override;
- ndk::ScopedAStatus setMasterMute(bool in_mute) override;
- ndk::ScopedAStatus getMasterVolume(float* _aidl_return) override;
- ndk::ScopedAStatus setMasterVolume(float in_volume) override;
ndk::ScopedAStatus getMicMute(bool* _aidl_return) override;
ndk::ScopedAStatus setMicMute(bool in_mute) override;
@@ -42,6 +38,11 @@
const std::vector<::aidl::android::media::audio::common::AudioPortConfig*>& sources,
const std::vector<::aidl::android::media::audio::common::AudioPortConfig*>& sinks)
override;
+ void onExternalDeviceConnectionChanged(
+ const ::aidl::android::media::audio::common::AudioPort& audioPort,
+ bool connected) override;
+ ndk::ScopedAStatus onMasterMuteChanged(bool mute) override;
+ ndk::ScopedAStatus onMasterVolumeChanged(float volume) override;
};
} // namespace aidl::android::hardware::audio::core
diff --git a/audio/aidl/default/include/core-impl/StreamUsb.h b/audio/aidl/default/include/core-impl/StreamUsb.h
index c04dc66..f1815dd 100644
--- a/audio/aidl/default/include/core-impl/StreamUsb.h
+++ b/audio/aidl/default/include/core-impl/StreamUsb.h
@@ -17,6 +17,7 @@
#pragma once
#include <mutex>
+#include <vector>
#include <aidl/android/media/audio/common/AudioChannelLayout.h>
@@ -93,6 +94,12 @@
StreamContext&& context,
const std::optional<::aidl::android::media::audio::common::AudioOffloadInfo>&
offloadInfo);
+
+ ndk::ScopedAStatus getHwVolume(std::vector<float>* _aidl_return) override;
+ ndk::ScopedAStatus setHwVolume(const std::vector<float>& in_channelVolumes) override;
+
+ int mChannelCount;
+ std::vector<float> mHwVolumes;
};
} // namespace aidl::android::hardware::audio::core
diff --git a/audio/aidl/default/usb/ModuleUsb.cpp b/audio/aidl/default/usb/ModuleUsb.cpp
index e803420..511ba74 100644
--- a/audio/aidl/default/usb/ModuleUsb.cpp
+++ b/audio/aidl/default/usb/ModuleUsb.cpp
@@ -22,6 +22,7 @@
#include <android-base/logging.h>
#include <tinyalsa/asoundlib.h>
+#include "UsbAlsaMixerControl.h"
#include "UsbAlsaUtils.h"
#include "core-impl/ModuleUsb.h"
@@ -86,26 +87,6 @@
return ndk::ScopedAStatus::ok();
}
-ndk::ScopedAStatus ModuleUsb::getMasterMute(bool* _aidl_return __unused) {
- LOG(DEBUG) << __func__ << ": is not supported";
- return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
-}
-
-ndk::ScopedAStatus ModuleUsb::setMasterMute(bool in_mute __unused) {
- LOG(DEBUG) << __func__ << ": is not supported";
- return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
-}
-
-ndk::ScopedAStatus ModuleUsb::getMasterVolume(float* _aidl_return __unused) {
- LOG(DEBUG) << __func__ << ": is not supported";
- return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
-}
-
-ndk::ScopedAStatus ModuleUsb::setMasterVolume(float in_volume __unused) {
- LOG(DEBUG) << __func__ << ": is not supported";
- return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
-}
-
ndk::ScopedAStatus ModuleUsb::getMicMute(bool* _aidl_return __unused) {
LOG(DEBUG) << __func__ << ": is not supported";
return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
@@ -180,4 +161,26 @@
return ndk::ScopedAStatus::ok();
}
+void ModuleUsb::onExternalDeviceConnectionChanged(
+ const ::aidl::android::media::audio::common::AudioPort& audioPort, bool connected) {
+ if (audioPort.ext.getTag() != AudioPortExt::Tag::device) {
+ return;
+ }
+ const auto& address = audioPort.ext.get<AudioPortExt::Tag::device>().device.address;
+ if (address.getTag() != AudioDeviceAddress::alsa) {
+ return;
+ }
+ const int card = address.get<AudioDeviceAddress::alsa>()[0];
+ usb::UsbAlsaMixerControl::getInstance().setDeviceConnectionState(card, mMasterMute,
+ mMasterVolume, connected);
+}
+
+ndk::ScopedAStatus ModuleUsb::onMasterMuteChanged(bool mute) {
+ return usb::UsbAlsaMixerControl::getInstance().setMasterMute(mute);
+}
+
+ndk::ScopedAStatus ModuleUsb::onMasterVolumeChanged(float volume) {
+ return usb::UsbAlsaMixerControl::getInstance().setMasterVolume(volume);
+}
+
} // namespace aidl::android::hardware::audio::core
diff --git a/audio/aidl/default/usb/StreamUsb.cpp b/audio/aidl/default/usb/StreamUsb.cpp
index bd53a0e..d6f757c 100644
--- a/audio/aidl/default/usb/StreamUsb.cpp
+++ b/audio/aidl/default/usb/StreamUsb.cpp
@@ -17,6 +17,9 @@
#define LOG_TAG "AHAL_StreamUsb"
#include <android-base/logging.h>
+#include <Utils.h>
+
+#include "UsbAlsaMixerControl.h"
#include "UsbAlsaUtils.h"
#include "core-impl/Module.h"
#include "core-impl/StreamUsb.h"
@@ -30,8 +33,12 @@
using aidl::android::media::audio::common::AudioDevice;
using aidl::android::media::audio::common::AudioDeviceAddress;
using aidl::android::media::audio::common::AudioOffloadInfo;
+using aidl::android::media::audio::common::AudioPortExt;
using aidl::android::media::audio::common::MicrophoneDynamicInfo;
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 {
@@ -239,6 +246,31 @@
// The default worker implementation is used.
return new StreamOutWorker(ctx, driver);
},
- offloadInfo) {}
+ offloadInfo) {
+ mChannelCount = getChannelCount(mContext.getChannelLayout());
+}
+
+ndk::ScopedAStatus StreamOutUsb::getHwVolume(std::vector<float>* _aidl_return) {
+ *_aidl_return = mHwVolumes;
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus StreamOutUsb::setHwVolume(const std::vector<float>& in_channelVolumes) {
+ for (const auto& device : mConnectedDevices) {
+ if (device.address.getTag() != AudioDeviceAddress::alsa) {
+ LOG(DEBUG) << __func__ << ": skip as the device address is not alsa";
+ continue;
+ }
+ const int card = device.address.get<AudioDeviceAddress::alsa>()[0];
+ if (auto result =
+ usb::UsbAlsaMixerControl::getInstance().setVolumes(card, in_channelVolumes);
+ !result.isOk()) {
+ LOG(ERROR) << __func__ << ": failed to set volume for device, card=" << card;
+ return result;
+ }
+ }
+ mHwVolumes = in_channelVolumes;
+ return ndk::ScopedAStatus::ok();
+}
} // namespace aidl::android::hardware::audio::core
diff --git a/audio/aidl/default/usb/UsbAlsaMixerControl.cpp b/audio/aidl/default/usb/UsbAlsaMixerControl.cpp
new file mode 100644
index 0000000..b5337d1
--- /dev/null
+++ b/audio/aidl/default/usb/UsbAlsaMixerControl.cpp
@@ -0,0 +1,239 @@
+/*
+ * 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.
+ */
+
+#define LOG_TAG "AHAL_UsbAlsaMixerControl"
+#include <android-base/logging.h>
+
+#include <cmath>
+#include <string>
+#include <vector>
+
+#include <android/binder_status.h>
+
+#include "UsbAlsaMixerControl.h"
+
+namespace aidl::android::hardware::audio::core::usb {
+
+//-----------------------------------------------------------------------------
+
+MixerControl::MixerControl(struct mixer_ctl* ctl)
+ : mCtl(ctl),
+ mNumValues(mixer_ctl_get_num_values(ctl)),
+ mMinValue(mixer_ctl_get_range_min(ctl)),
+ mMaxValue(mixer_ctl_get_range_max(ctl)) {}
+
+unsigned int MixerControl::getNumValues() const {
+ return mNumValues;
+}
+
+int MixerControl::getMaxValue() const {
+ return mMaxValue;
+}
+
+int MixerControl::getMinValue() const {
+ return mMinValue;
+}
+
+int MixerControl::setArray(const void* array, size_t count) {
+ const std::lock_guard guard(mLock);
+ return mixer_ctl_set_array(mCtl, array, count);
+}
+
+//-----------------------------------------------------------------------------
+
+// static
+const std::map<AlsaMixer::Control, std::vector<AlsaMixer::ControlNamesAndExpectedCtlType>>
+ AlsaMixer::kPossibleControls = {
+ {AlsaMixer::MASTER_SWITCH, {{"Master Playback Switch", MIXER_CTL_TYPE_BOOL}}},
+ {AlsaMixer::MASTER_VOLUME, {{"Master Playback Volume", MIXER_CTL_TYPE_INT}}},
+ {AlsaMixer::HW_VOLUME,
+ {{"Headphone Playback Volume", MIXER_CTL_TYPE_INT},
+ {"Headset Playback Volume", MIXER_CTL_TYPE_INT},
+ {"PCM Playback Volume", MIXER_CTL_TYPE_INT}}}};
+
+// static
+std::map<AlsaMixer::Control, std::shared_ptr<MixerControl>> AlsaMixer::initializeMixerControls(
+ struct mixer* mixer) {
+ std::map<AlsaMixer::Control, std::shared_ptr<MixerControl>> mixerControls;
+ std::string mixerCtlNames;
+ for (const auto& [control, possibleCtls] : kPossibleControls) {
+ for (const auto& [ctlName, expectedCtlType] : possibleCtls) {
+ struct mixer_ctl* ctl = mixer_get_ctl_by_name(mixer, ctlName.c_str());
+ if (ctl != nullptr && mixer_ctl_get_type(ctl) == expectedCtlType) {
+ mixerControls.emplace(control, std::make_unique<MixerControl>(ctl));
+ if (!mixerCtlNames.empty()) {
+ mixerCtlNames += ",";
+ }
+ mixerCtlNames += ctlName;
+ break;
+ }
+ }
+ }
+ LOG(DEBUG) << __func__ << ": available mixer control names=[" << mixerCtlNames << "]";
+ return mixerControls;
+}
+
+AlsaMixer::AlsaMixer(struct mixer* mixer)
+ : mMixer(mixer), mMixerControls(initializeMixerControls(mMixer)) {}
+
+AlsaMixer::~AlsaMixer() {
+ mixer_close(mMixer);
+}
+
+namespace {
+
+int volumeFloatToInteger(float fValue, int maxValue, int minValue) {
+ return minValue + std::ceil((maxValue - minValue) * fValue);
+}
+
+float volumeIntegerToFloat(int iValue, int maxValue, int minValue) {
+ if (iValue > maxValue) {
+ return 1.0f;
+ }
+ if (iValue < minValue) {
+ return 0.0f;
+ }
+ return static_cast<float>(iValue - minValue) / (maxValue - minValue);
+}
+
+} // namespace
+
+ndk::ScopedAStatus AlsaMixer::setMasterMute(bool muted) {
+ auto it = mMixerControls.find(AlsaMixer::MASTER_SWITCH);
+ if (it == mMixerControls.end()) {
+ return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
+ }
+ const int numValues = it->second->getNumValues();
+ std::vector<int> values(numValues, muted ? 0 : 1);
+ if (int err = it->second->setArray(values.data(), numValues); err != 0) {
+ LOG(ERROR) << __func__ << ": failed to set master mute, err=" << err;
+ return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_STATE);
+ }
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus AlsaMixer::setMasterVolume(float volume) {
+ auto it = mMixerControls.find(AlsaMixer::MASTER_VOLUME);
+ if (it == mMixerControls.end()) {
+ return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
+ }
+ const int numValues = it->second->getNumValues();
+ std::vector<int> values(numValues, volumeFloatToInteger(volume, it->second->getMaxValue(),
+ it->second->getMinValue()));
+ if (int err = it->second->setArray(values.data(), numValues); err != 0) {
+ LOG(ERROR) << __func__ << ": failed to set master volume, err=" << err;
+ return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_STATE);
+ }
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus AlsaMixer::setVolumes(std::vector<float> volumes) {
+ auto it = mMixerControls.find(AlsaMixer::HW_VOLUME);
+ if (it == mMixerControls.end()) {
+ return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
+ }
+ const int numValues = it->second->getNumValues();
+ const int maxValue = it->second->getMaxValue();
+ const int minValue = it->second->getMinValue();
+ std::vector<int> values;
+ size_t i = 0;
+ for (; i < numValues && i < values.size(); ++i) {
+ values.emplace_back(volumeFloatToInteger(volumes[i], maxValue, minValue));
+ }
+ if (int err = it->second->setArray(values.data(), values.size()); err != 0) {
+ LOG(ERROR) << __func__ << ": failed to set volume, err=" << err;
+ return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_STATE);
+ }
+ return ndk::ScopedAStatus::ok();
+}
+
+//-----------------------------------------------------------------------------
+
+// static
+UsbAlsaMixerControl& UsbAlsaMixerControl::getInstance() {
+ static UsbAlsaMixerControl gInstance;
+ return gInstance;
+}
+
+void UsbAlsaMixerControl::setDeviceConnectionState(int card, bool masterMuted, float masterVolume,
+ bool connected) {
+ LOG(DEBUG) << __func__ << ": card=" << card << ", connected=" << connected;
+ if (connected) {
+ struct mixer* mixer = mixer_open(card);
+ if (mixer == nullptr) {
+ PLOG(ERROR) << __func__ << ": failed to open mixer for card=" << card;
+ return;
+ }
+ auto alsaMixer = std::make_shared<AlsaMixer>(mixer);
+ alsaMixer->setMasterMute(masterMuted);
+ alsaMixer->setMasterVolume(masterVolume);
+ const std::lock_guard guard(mLock);
+ mMixerControls.emplace(card, alsaMixer);
+ } else {
+ const std::lock_guard guard(mLock);
+ mMixerControls.erase(card);
+ }
+}
+
+ndk::ScopedAStatus UsbAlsaMixerControl::setMasterMute(bool mute) {
+ auto alsaMixers = getAlsaMixers();
+ for (auto it = alsaMixers.begin(); it != alsaMixers.end(); ++it) {
+ if (auto result = it->second->setMasterMute(mute); !result.isOk()) {
+ // Return illegal state if there are multiple devices connected and one of them fails
+ // to set master mute. Otherwise, return the error from calling `setMasterMute`.
+ LOG(ERROR) << __func__ << ": failed to set master mute for card=" << it->first;
+ return alsaMixers.size() > 1 ? ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_STATE)
+ : std::move(result);
+ }
+ }
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus UsbAlsaMixerControl::setMasterVolume(float volume) {
+ auto alsaMixers = getAlsaMixers();
+ for (auto it = alsaMixers.begin(); it != alsaMixers.end(); ++it) {
+ if (auto result = it->second->setMasterVolume(volume); !result.isOk()) {
+ // Return illegal state if there are multiple devices connected and one of them fails
+ // to set master volume. Otherwise, return the error from calling `setMasterVolume`.
+ LOG(ERROR) << __func__ << ": failed to set master volume for card=" << it->first;
+ return alsaMixers.size() > 1 ? ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_STATE)
+ : std::move(result);
+ }
+ }
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus UsbAlsaMixerControl::setVolumes(int card, std::vector<float> volumes) {
+ auto alsaMixer = getAlsaMixer(card);
+ if (alsaMixer == nullptr) {
+ LOG(ERROR) << __func__ << ": no mixer control found for card=" << card;
+ return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
+ }
+ return alsaMixer->setVolumes(volumes);
+}
+
+std::shared_ptr<AlsaMixer> UsbAlsaMixerControl::getAlsaMixer(int card) {
+ const std::lock_guard guard(mLock);
+ const auto it = mMixerControls.find(card);
+ return it == mMixerControls.end() ? nullptr : it->second;
+}
+
+std::map<int, std::shared_ptr<AlsaMixer>> UsbAlsaMixerControl::getAlsaMixers() {
+ const std::lock_guard guard(mLock);
+ return mMixerControls;
+}
+
+} // namespace aidl::android::hardware::audio::core::usb
diff --git a/audio/aidl/default/usb/UsbAlsaMixerControl.h b/audio/aidl/default/usb/UsbAlsaMixerControl.h
new file mode 100644
index 0000000..cbcddd8
--- /dev/null
+++ b/audio/aidl/default/usb/UsbAlsaMixerControl.h
@@ -0,0 +1,106 @@
+/*
+ * 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.
+ */
+
+#pragma once
+
+#include <map>
+#include <memory>
+#include <mutex>
+#include <optional>
+#include <string>
+#include <vector>
+
+#include <android-base/thread_annotations.h>
+#include <android/binder_auto_utils.h>
+
+extern "C" {
+#include <tinyalsa/mixer.h>
+}
+
+namespace aidl::android::hardware::audio::core::usb {
+
+class MixerControl {
+ public:
+ explicit MixerControl(struct mixer_ctl* ctl);
+
+ unsigned int getNumValues() const;
+ int getMaxValue() const;
+ int getMinValue() const;
+ int setArray(const void* array, size_t count);
+
+ private:
+ std::mutex mLock;
+ // The mixer_ctl object is owned by ALSA and will be released when the mixer is closed.
+ struct mixer_ctl* mCtl GUARDED_BY(mLock);
+ const unsigned int mNumValues;
+ const int mMinValue;
+ const int mMaxValue;
+};
+
+class AlsaMixer {
+ public:
+ explicit AlsaMixer(struct mixer* mixer);
+
+ ~AlsaMixer();
+
+ bool isValid() const { return mMixer != nullptr; }
+
+ ndk::ScopedAStatus setMasterMute(bool muted);
+ ndk::ScopedAStatus setMasterVolume(float volume);
+ ndk::ScopedAStatus setVolumes(std::vector<float> volumes);
+
+ private:
+ enum Control {
+ MASTER_SWITCH,
+ MASTER_VOLUME,
+ HW_VOLUME,
+ };
+ using ControlNamesAndExpectedCtlType = std::pair<std::string, enum mixer_ctl_type>;
+ static const std::map<Control, std::vector<ControlNamesAndExpectedCtlType>> kPossibleControls;
+ static std::map<Control, std::shared_ptr<MixerControl>> initializeMixerControls(
+ struct mixer* mixer);
+
+ // The mixer object is owned by ALSA and will be released when the mixer is closed.
+ struct mixer* mMixer;
+ // `mMixerControls` will only be initialized in constructor. After that, it wil only be
+ // read but not be modified.
+ const std::map<Control, std::shared_ptr<MixerControl>> mMixerControls;
+};
+
+class UsbAlsaMixerControl {
+ public:
+ static UsbAlsaMixerControl& getInstance();
+
+ void setDeviceConnectionState(int card, bool masterMuted, float masterVolume, bool connected);
+
+ // Master volume settings will be applied to all sound cards, it is only set by the
+ // USB module.
+ ndk::ScopedAStatus setMasterMute(bool muted);
+ ndk::ScopedAStatus setMasterVolume(float volume);
+ // The volume settings can be different on sound cards. It is controlled by streams.
+ ndk::ScopedAStatus setVolumes(int card, std::vector<float> volumes);
+
+ private:
+ std::shared_ptr<AlsaMixer> getAlsaMixer(int card);
+ std::map<int, std::shared_ptr<AlsaMixer>> getAlsaMixers();
+
+ std::mutex mLock;
+ // A map whose key is the card number and value is a shared pointer to corresponding
+ // AlsaMixer object.
+ std::map<int, std::shared_ptr<AlsaMixer>> mMixerControls GUARDED_BY(mLock);
+};
+
+} // namespace aidl::android::hardware::audio::core::usb
diff --git a/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp b/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp
index cd7ab0e..1e0c900 100644
--- a/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp
+++ b/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp
@@ -61,6 +61,7 @@
using aidl::android::hardware::audio::core::AudioPatch;
using aidl::android::hardware::audio::core::AudioRoute;
using aidl::android::hardware::audio::core::IBluetooth;
+using aidl::android::hardware::audio::core::IBluetoothA2dp;
using aidl::android::hardware::audio::core::IModule;
using aidl::android::hardware::audio::core::IStreamCommon;
using aidl::android::hardware::audio::core::IStreamIn;
@@ -2055,6 +2056,59 @@
&hfpConfig));
}
+class AudioCoreBluetoothA2dp : public AudioCoreModuleBase,
+ public testing::TestWithParam<std::string> {
+ public:
+ void SetUp() override {
+ ASSERT_NO_FATAL_FAILURE(SetUpImpl(GetParam()));
+ ASSERT_IS_OK(module->getBluetoothA2dp(&bluetooth));
+ }
+
+ void TearDown() override { ASSERT_NO_FATAL_FAILURE(TearDownImpl()); }
+
+ std::shared_ptr<IBluetoothA2dp> bluetooth;
+};
+
+TEST_P(AudioCoreBluetoothA2dp, SameInstance) {
+ if (bluetooth == nullptr) {
+ GTEST_SKIP() << "BluetoothA2dp is not supported";
+ }
+ std::shared_ptr<IBluetoothA2dp> bluetooth2;
+ EXPECT_IS_OK(module->getBluetoothA2dp(&bluetooth2));
+ ASSERT_NE(nullptr, bluetooth2.get());
+ EXPECT_EQ(bluetooth->asBinder(), bluetooth2->asBinder())
+ << "getBluetoothA2dp must return the same interface instance across invocations";
+}
+
+TEST_P(AudioCoreBluetoothA2dp, Enabled) {
+ if (bluetooth == nullptr) {
+ GTEST_SKIP() << "BluetoothA2dp is not supported";
+ }
+ // Since enabling A2DP may require having an actual device connection,
+ // limit testing to setting back the current value.
+ bool enabled;
+ ASSERT_IS_OK(bluetooth->isEnabled(&enabled));
+ EXPECT_IS_OK(bluetooth->setEnabled(enabled))
+ << "setEnabled without actual state change must not fail";
+}
+
+TEST_P(AudioCoreBluetoothA2dp, OffloadReconfiguration) {
+ if (bluetooth == nullptr) {
+ GTEST_SKIP() << "BluetoothA2dp 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 {
@@ -3462,6 +3516,10 @@
testing::ValuesIn(android::getAidlHalInstanceNames(IModule::descriptor)),
android::PrintInstanceNameToString);
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(AudioCoreBluetooth);
+INSTANTIATE_TEST_SUITE_P(AudioCoreBluetoothA2dpTest, AudioCoreBluetoothA2dp,
+ testing::ValuesIn(android::getAidlHalInstanceNames(IModule::descriptor)),
+ android::PrintInstanceNameToString);
+GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(AudioCoreBluetoothA2dp);
INSTANTIATE_TEST_SUITE_P(AudioCoreTelephonyTest, AudioCoreTelephony,
testing::ValuesIn(android::getAidlHalInstanceNames(IModule::descriptor)),
android::PrintInstanceNameToString);
diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl
index c29076d..b628b60 100644
--- a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl
+++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl
@@ -2146,6 +2146,7 @@
*
* @change_mode VehiclePropertyChangeMode.ON_CHANGE
* @access VehiclePropertyAccess.READ
+ * @unit VehicleUnit:MILLI_SECS
*/
WINDSHIELD_WIPERS_PERIOD =
0x0BC5 + VehiclePropertyGroup.SYSTEM + VehicleArea.WINDOW + VehiclePropertyType.INT32,
diff --git a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/AcquiredInfo.aidl b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/AcquiredInfo.aidl
index 89f76f4..7075f71 100644
--- a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/AcquiredInfo.aidl
+++ b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/AcquiredInfo.aidl
@@ -49,4 +49,5 @@
IMMOBILE,
RETRYING_CAPTURE,
LIFT_TOO_SOON,
+ POWER_PRESS,
}
diff --git a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/Error.aidl b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/Error.aidl
index d3592a1..9eeaac5 100644
--- a/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/Error.aidl
+++ b/biometrics/fingerprint/aidl/aidl_api/android.hardware.biometrics.fingerprint/current/android/hardware/biometrics/fingerprint/Error.aidl
@@ -44,4 +44,5 @@
UNABLE_TO_REMOVE,
VENDOR,
BAD_CALIBRATION,
+ POWER_PRESS,
}
diff --git a/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/AcquiredInfo.aidl b/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/AcquiredInfo.aidl
index 2cdc196..41b7c5e 100644
--- a/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/AcquiredInfo.aidl
+++ b/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/AcquiredInfo.aidl
@@ -103,4 +103,10 @@
* Fingerprint was lifted before the capture completed.
*/
LIFT_TOO_SOON,
+
+ /**
+ * Indicates a power press event has occurred. This is typically sent by fingerprint
+ * sensors that have the sensor co-located with the power button.
+ */
+ POWER_PRESS,
}
diff --git a/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/Error.aidl b/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/Error.aidl
index d8d47fa..39a5676 100644
--- a/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/Error.aidl
+++ b/biometrics/fingerprint/aidl/android/hardware/biometrics/fingerprint/Error.aidl
@@ -70,4 +70,10 @@
* There's a problem with the sensor's calibration.
*/
BAD_CALIBRATION,
+
+ /**
+ * Indicates a power press event has occurred. This is typically sent by fingerprint
+ * sensors that have the sensor co-located with the power button.
+ */
+ POWER_PRESS,
}
diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanCipherSuiteType.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanCipherSuiteType.aidl
index d1149c4..6f3158e 100644
--- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanCipherSuiteType.aidl
+++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/NanCipherSuiteType.aidl
@@ -39,6 +39,6 @@
SHARED_KEY_256_MASK = (1 << 1) /* 2 */,
PUBLIC_KEY_2WDH_128_MASK = (1 << 2) /* 4 */,
PUBLIC_KEY_2WDH_256_MASK = (1 << 3) /* 8 */,
- PUBLIC_KEY_PASN_128_MASK = (1 << 4) /* 16 */,
- PUBLIC_KEY_PASN_256_MASK = (1 << 5) /* 32 */,
+ PUBLIC_KEY_PASN_128_MASK = (1 << 6) /* 64 */,
+ PUBLIC_KEY_PASN_256_MASK = (1 << 7) /* 128 */,
}
diff --git a/wifi/aidl/android/hardware/wifi/IWifiNanIface.aidl b/wifi/aidl/android/hardware/wifi/IWifiNanIface.aidl
index 5f3ce6c..3ce8d02 100644
--- a/wifi/aidl/android/hardware/wifi/IWifiNanIface.aidl
+++ b/wifi/aidl/android/hardware/wifi/IWifiNanIface.aidl
@@ -79,6 +79,7 @@
* Asynchronous response is with |IWifiNanIfaceEventCallback.notifyCreateDataInterfaceResponse|.
*
* @param cmdId Command Id to use for this invocation.
+ * @param ifaceName The name of the interface, e.g. "aware0".
* @throws ServiceSpecificException with one of the following values:
* |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
* |WifiStatusCode.ERROR_UNKNOWN|
@@ -90,6 +91,7 @@
* Asynchronous response is with |IWifiNanIfaceEventCallback.notifyDeleteDataInterfaceResponse|.
*
* @param cmdId Command Id to use for this invocation.
+ * @param ifaceName The name of the interface, e.g. "aware0".
* @throws ServiceSpecificException with one of the following values:
* |WifiStatusCode.ERROR_WIFI_IFACE_INVALID|,
* |WifiStatusCode.ERROR_UNKNOWN|
diff --git a/wifi/aidl/android/hardware/wifi/IWifiNanIfaceEventCallback.aidl b/wifi/aidl/android/hardware/wifi/IWifiNanIfaceEventCallback.aidl
index 8a61a9c..3649b7b 100644
--- a/wifi/aidl/android/hardware/wifi/IWifiNanIfaceEventCallback.aidl
+++ b/wifi/aidl/android/hardware/wifi/IWifiNanIfaceEventCallback.aidl
@@ -132,7 +132,7 @@
/**
* Callback providing status on a completed followup message transmit operation.
*
- * @param cmdId Command Id corresponding to the original |transmitFollowupRequest| request.
+ * @param id Command ID corresponding to the original |transmitFollowupRequest| request.
* @param status NanStatus of the operation. Possible status codes are:
* |NanStatusCode.SUCCESS|
* |NanStatusCode.NO_OTA_ACK|
@@ -151,7 +151,7 @@
* Callback invoked in response to a capability request
* |IWifiNanIface.getCapabilitiesRequest|.
*
- * @param cmdId Command Id corresponding to the original request.
+ * @param id Command ID corresponding to the original request.
* @param status NanStatus of the operation. Possible status codes are:
* |NanStatusCode.SUCCESS|
* @param capabilities Capability data.
@@ -162,7 +162,7 @@
/**
* Callback invoked in response to a config request |IWifiNanIface.configRequest|.
*
- * @param cmdId Command Id corresponding to the original request.
+ * @param id Command ID corresponding to the original request.
* @param status NanStatus of the operation. Possible status codes are:
* |NanStatusCode.SUCCESS|
* |NanStatusCode.INVALID_ARGS|
@@ -175,7 +175,7 @@
* Callback invoked in response to a create data interface request
* |IWifiNanIface.createDataInterfaceRequest|.
*
- * @param cmdId Command Id corresponding to the original request.
+ * @param id Command ID corresponding to the original request.
* @param status NanStatus of the operation. Possible status codes are:
* |NanStatusCode.SUCCESS|
* |NanStatusCode.INVALID_ARGS|
@@ -187,7 +187,7 @@
* Callback invoked in response to a delete data interface request
* |IWifiNanIface.deleteDataInterfaceRequest|.
*
- * @param cmdId Command Id corresponding to the original request.
+ * @param id Command ID corresponding to the original request.
* @param status NanStatus of the operation. Possible status codes are:
* |NanStatusCode.SUCCESS|
* |NanStatusCode.INVALID_ARGS|
@@ -198,7 +198,7 @@
/**
* Callback invoked in response to a disable request |IWifiNanIface.disableRequest|.
*
- * @param cmdId Command Id corresponding to the original request.
+ * @param id Command ID corresponding to the original request.
* @param status NanStatus of the operation. Possible status codes are:
* |NanStatusCode.SUCCESS|
* |NanStatusCode.PROTOCOL_FAILURE|
@@ -208,7 +208,7 @@
/**
* Callback invoked in response to an enable request |IWifiNanIface.enableRequest|.
*
- * @param cmdId Command Id corresponding to the original request.
+ * @param id Command ID corresponding to the original request.
* @param status NanStatus of the operation. Possible status codes are:
* |NanStatusCode.SUCCESS|
* |NanStatusCode.ALREADY_ENABLED|
@@ -223,7 +223,7 @@
* Callback invoked in response to an initiate data path request
* |IWifiNanIface.initiateDataPathRequest|.
*
- * @param cmdId Command Id corresponding to the original request.
+ * @param id Command ID corresponding to the original request.
* @param status NanStatus of the operation. Possible status codes are:
* |NanStatusCode.SUCCESS|
* |NanStatusCode.INVALID_ARGS|
@@ -238,7 +238,7 @@
* Callback invoked in response to a respond to data path indication request
* |IWifiNanIface.respondToDataPathIndicationRequest|.
*
- * @param cmdId Command Id corresponding to the original request.
+ * @param id Command ID corresponding to the original request.
* @param status NanStatus of the operation. Possible status codes are:
* |NanStatusCode.SUCCESS|
* |NanStatusCode.INVALID_ARGS|
@@ -252,7 +252,7 @@
* Callback invoked to notify the status of the start publish request
* |IWifiNanIface.startPublishRequest|.
*
- * @param cmdId Command Id corresponding to the original request.
+ * @param id Command ID corresponding to the original request.
* @param status NanStatus of the operation. Possible status codes are:
* |NanStatusCode.SUCCESS|
* |NanStatusCode.INVALID_ARGS|
@@ -267,7 +267,7 @@
* Callback invoked to notify the status of the start subscribe request
* |IWifiNanIface.startSubscribeRequest|.
*
- * @param cmdId Command Id corresponding to the original request.
+ * @param id Command ID corresponding to the original request.
* @param status NanStatus of the operation. Possible status codes are:
* |NanStatusCode.SUCCESS|
* |NanStatusCode.INVALID_ARGS|
@@ -282,7 +282,7 @@
* Callback invoked in response to a stop publish request
* |IWifiNanIface.stopPublishRequest|.
*
- * @param cmdId Command Id corresponding to the original request.
+ * @param id Command ID corresponding to the original request.
* @param status NanStatus of the operation. Possible status codes are:
* |NanStatusCode.SUCCESS|
* |NanStatusCode.INVALID_SESSION_ID|
@@ -294,7 +294,7 @@
* Callback invoked in response to a stop subscribe request
* |IWifiNanIface.stopSubscribeRequest|.
*
- * @param cmdId Command Id corresponding to the original request.
+ * @param id Command ID corresponding to the original request.
* @param status NanStatus of the operation. Possible status codes are:
* |NanStatusCode.SUCCESS|
* |NanStatusCode.INVALID_SESSION_ID|
@@ -306,7 +306,7 @@
* Callback invoked in response to a terminate data path request
* |IWifiNanIface.terminateDataPathRequest|.
*
- * @param cmdId Command Id corresponding to the original request.
+ * @param id Command ID corresponding to the original request.
* @param status NanStatus of the operation. Possible status codes are:
* |NanStatusCode.SUCCESS|
* |NanStatusCode.INVALID_ARGS|
@@ -320,7 +320,7 @@
* Callback invoked in response to a suspension request
* |IWifiNanIface.suspendRequest|.
*
- * @param cmdId Command Id corresponding to the original request.
+ * @param id Command ID corresponding to the original request.
* @param status NanStatus of the operation. Possible status codes are:
* |NanStatusCode.SUCCESS|
* |NanStatusCode.INVALID_SESSION_ID|
@@ -333,7 +333,7 @@
* Callback invoked in response to a resume request
* |IWifiNanIface.resumeRequest|.
*
- * @param cmdId Command Id corresponding to the original request.
+ * @param id Command ID corresponding to the original request.
* @param status NanStatus of the operation. Possible status codes are:
* |NanStatusCode.SUCCESS|
* |NanStatusCode.INVALID_SESSION_ID|
@@ -346,7 +346,7 @@
* Callback invoked in response to a transmit followup request
* |IWifiNanIface.transmitFollowupRequest|.
*
- * @param cmdId Command Id corresponding to the original request.
+ * @param id Command ID corresponding to the original request.
* @param status NanStatus of the operation. Possible status codes are:
* |NanStatusCode.SUCCESS|
* |NanStatusCode.INVALID_ARGS|
@@ -377,7 +377,7 @@
* Callback invoked in response to an initiate NAN pairing request
* |IWifiNanIface.initiatePairingRequest|.
*
- * @param cmdId Command Id corresponding to the original request.
+ * @param id Command ID corresponding to the original request.
* @param status NanStatus of the operation. Possible status codes are:
* |NanStatusCode.SUCCESS|
* |NanStatusCode.INVALID_ARGS|
@@ -392,7 +392,7 @@
* Callback invoked in response to a respond to NAN pairing indication request
* |IWifiNanIface.respondToPairingIndicationRequest|.
*
- * @param cmdId Command Id corresponding to the original request.
+ * @param id Command ID corresponding to the original request.
* @param status NanStatus of the operation. Possible status codes are:
* |NanStatusCode.SUCCESS|
* |NanStatusCode.INVALID_ARGS|
@@ -422,7 +422,7 @@
* Callback invoked in response to an initiate NAN pairing bootstrapping request
* |IWifiNanIface.initiateBootstrappingRequest|.
*
- * @param cmdId Command Id corresponding to the original request.
+ * @param id Command ID corresponding to the original request.
* @param status NanStatus of the operation. Possible status codes are:
* |NanStatusCode.SUCCESS|
* |NanStatusCode.INVALID_ARGS|
@@ -438,7 +438,7 @@
* Callback invoked in response to a respond to pairing bootstrapping indication request
* |IWifiNanIface.respondToBootstrappingIndicationRequest|.
*
- * @param cmdId Command Id corresponding to the original request.
+ * @param id Command ID corresponding to the original request.
* @param status NanStatus of the operation. Possible status codes are:
* |NanStatusCode.SUCCESS|
* |NanStatusCode.INVALID_ARGS|
diff --git a/wifi/aidl/android/hardware/wifi/NanBootstrappingConfirmInd.aidl b/wifi/aidl/android/hardware/wifi/NanBootstrappingConfirmInd.aidl
index 7d7a436..e72c940 100644
--- a/wifi/aidl/android/hardware/wifi/NanBootstrappingConfirmInd.aidl
+++ b/wifi/aidl/android/hardware/wifi/NanBootstrappingConfirmInd.aidl
@@ -16,10 +16,12 @@
package android.hardware.wifi;
-import android.hardware.wifi.NanBootstrappingMethod;
import android.hardware.wifi.NanBootstrappingResponseCode;
import android.hardware.wifi.NanStatus;
+/**
+ * See Wi-Fi Aware R4.0 section 9.5.21.7
+ */
@VintfStability
parcelable NanBootstrappingConfirmInd {
/**
@@ -44,7 +46,7 @@
int comeBackDelay;
/**
- * Cookie received from the comeback response.
+ * Cookie received from peer with |comeBackDelay| for follow up |NanBootstrappingRequest|
*/
byte[] cookie;
}
diff --git a/wifi/aidl/android/hardware/wifi/NanBootstrappingMethod.aidl b/wifi/aidl/android/hardware/wifi/NanBootstrappingMethod.aidl
index 8960794..da2ff25 100644
--- a/wifi/aidl/android/hardware/wifi/NanBootstrappingMethod.aidl
+++ b/wifi/aidl/android/hardware/wifi/NanBootstrappingMethod.aidl
@@ -17,7 +17,8 @@
package android.hardware.wifi;
/**
- * Pairing bootstrapping method flag
+ * Pairing bootstrapping method flag.
+ * See Wi-Fi Aware R4.0 section 9.5.21.7 table 128
*/
@VintfStability
@Backing(type="int")
diff --git a/wifi/aidl/android/hardware/wifi/NanBootstrappingRequest.aidl b/wifi/aidl/android/hardware/wifi/NanBootstrappingRequest.aidl
index 5297b9f..4836612 100644
--- a/wifi/aidl/android/hardware/wifi/NanBootstrappingRequest.aidl
+++ b/wifi/aidl/android/hardware/wifi/NanBootstrappingRequest.aidl
@@ -18,6 +18,9 @@
import android.hardware.wifi.NanBootstrappingMethod;
+/**
+ * See Wi-Fi Aware R4.0 section 9.5.21.7
+ */
@VintfStability
parcelable NanBootstrappingRequest {
/**
@@ -39,7 +42,7 @@
NanBootstrappingMethod requestBootstrappingMethod;
/**
- * Cookie for the follow up request
+ * Cookie received from previous |NanBootstrappingConfirmInd| for comeback request.
*/
byte[] cookie;
}
diff --git a/wifi/aidl/android/hardware/wifi/NanBootstrappingRequestInd.aidl b/wifi/aidl/android/hardware/wifi/NanBootstrappingRequestInd.aidl
index e11122f..9094579 100644
--- a/wifi/aidl/android/hardware/wifi/NanBootstrappingRequestInd.aidl
+++ b/wifi/aidl/android/hardware/wifi/NanBootstrappingRequestInd.aidl
@@ -21,7 +21,7 @@
/**
* NAN Data path request indication message structure.
* Event indication received by an intended Responder when a NAN
- * data request initiated by an Initiator.
+ * data request is initiated by an Initiator. See Wi-Fi Aware R4.0 section 9.5.21.7
*/
@VintfStability
parcelable NanBootstrappingRequestInd {
diff --git a/wifi/aidl/android/hardware/wifi/NanBootstrappingResponse.aidl b/wifi/aidl/android/hardware/wifi/NanBootstrappingResponse.aidl
index 0a7d621..dbe8923 100644
--- a/wifi/aidl/android/hardware/wifi/NanBootstrappingResponse.aidl
+++ b/wifi/aidl/android/hardware/wifi/NanBootstrappingResponse.aidl
@@ -16,8 +16,9 @@
package android.hardware.wifi;
-import android.hardware.wifi.NanBootstrappingMethod;
-
+/**
+ * See Wi-Fi Aware R4.0 section 9.5.21.7
+ */
@VintfStability
parcelable NanBootstrappingResponse {
/**
diff --git a/wifi/aidl/android/hardware/wifi/NanCipherSuiteType.aidl b/wifi/aidl/android/hardware/wifi/NanCipherSuiteType.aidl
index 0d2fc99..91b5caf 100644
--- a/wifi/aidl/android/hardware/wifi/NanCipherSuiteType.aidl
+++ b/wifi/aidl/android/hardware/wifi/NanCipherSuiteType.aidl
@@ -17,13 +17,19 @@
package android.hardware.wifi;
/**
- * Cipher suite flags. Wi-Fi Aware Specification 4.0 section 7.1.2
+ * Cipher suite flags. Wi-Fi Aware Specification 4.0 section 9.5.21.1.
*/
@VintfStability
@Backing(type="int")
enum NanCipherSuiteType {
NONE = 0,
+ /**
+ * NCS-SK-128
+ */
SHARED_KEY_128_MASK = 1 << 0,
+ /**
+ * NCS-SK-256
+ */
SHARED_KEY_256_MASK = 1 << 1,
/**
* NCS-PK-2WDH-128
@@ -34,11 +40,15 @@
*/
PUBLIC_KEY_2WDH_256_MASK = 1 << 3,
/**
+ * bit 4 and bit 5 are reserved for NCS-GTK-CCMP-128 and NCS-GTK-CCMP-256. Which are not used
+ * from framework
+ */
+ /**
* NCS-PK-PASN-128
*/
- PUBLIC_KEY_PASN_128_MASK = 1 << 4,
+ PUBLIC_KEY_PASN_128_MASK = 1 << 6,
/**
* NCS-PK-PASN-256
*/
- PUBLIC_KEY_PASN_256_MASK = 1 << 5,
+ PUBLIC_KEY_PASN_256_MASK = 1 << 7,
}
diff --git a/wifi/aidl/android/hardware/wifi/NanIdentityResolutionAttribute.aidl b/wifi/aidl/android/hardware/wifi/NanIdentityResolutionAttribute.aidl
index 917feff..807081b 100644
--- a/wifi/aidl/android/hardware/wifi/NanIdentityResolutionAttribute.aidl
+++ b/wifi/aidl/android/hardware/wifi/NanIdentityResolutionAttribute.aidl
@@ -17,7 +17,8 @@
package android.hardware.wifi;
/**
- * NIRA for pairing identity resolution
+ * NIRA for pairing identity resolution.
+ * See Wi-Fi Aware R4.0 section 9.5.21.6
*/
@VintfStability
parcelable NanIdentityResolutionAttribute {
diff --git a/wifi/aidl/android/hardware/wifi/NanPairingConfig.aidl b/wifi/aidl/android/hardware/wifi/NanPairingConfig.aidl
index 4f9c3ae..20122e2 100644
--- a/wifi/aidl/android/hardware/wifi/NanPairingConfig.aidl
+++ b/wifi/aidl/android/hardware/wifi/NanPairingConfig.aidl
@@ -16,8 +16,6 @@
package android.hardware.wifi;
-import android.hardware.wifi.NanBootstrappingMethod;
-
/**
* The NAN pairing config
*/
diff --git a/wifi/aidl/android/hardware/wifi/NanPairingConfirmInd.aidl b/wifi/aidl/android/hardware/wifi/NanPairingConfirmInd.aidl
index cd98c72..a5670ec 100644
--- a/wifi/aidl/android/hardware/wifi/NanPairingConfirmInd.aidl
+++ b/wifi/aidl/android/hardware/wifi/NanPairingConfirmInd.aidl
@@ -16,7 +16,6 @@
package android.hardware.wifi;
-import android.hardware.wifi.NanDataPathChannelInfo;
import android.hardware.wifi.NanPairingRequestType;
import android.hardware.wifi.NanStatus;
import android.hardware.wifi.NpkSecurityAssociation;
@@ -24,7 +23,7 @@
/**
* NAN pairing confirmation indication structure. Event indication is
* received on both initiator and responder side when negotiation for a
- * pairing finishes on success or failure.
+ * pairing finishes on success or failure. See Wi-Fi Aware R4.0 section 7.6.1.4
*/
@VintfStability
parcelable NanPairingConfirmInd {
diff --git a/wifi/aidl/android/hardware/wifi/NanPairingRequest.aidl b/wifi/aidl/android/hardware/wifi/NanPairingRequest.aidl
index 6f1a072..0c2080b 100644
--- a/wifi/aidl/android/hardware/wifi/NanPairingRequest.aidl
+++ b/wifi/aidl/android/hardware/wifi/NanPairingRequest.aidl
@@ -20,9 +20,10 @@
import android.hardware.wifi.NanPairingSecurityConfig;
/**
- * NAN pairing initiate request
- * Which can be used for setup(the initial pairing request) or
- * verification(re-pairing for paired devices)
+ * NAN pairing initiate request.
+ * Can be used for setup (the initial pairing request) or
+ * verification (re-pairing for paired devices).
+ * See Wi-Fi Aware R4.0 section 7.6.1.1
*/
@VintfStability
parcelable NanPairingRequest {
diff --git a/wifi/aidl/android/hardware/wifi/NanPairingRequestInd.aidl b/wifi/aidl/android/hardware/wifi/NanPairingRequestInd.aidl
index f247e45..ec8548f 100644
--- a/wifi/aidl/android/hardware/wifi/NanPairingRequestInd.aidl
+++ b/wifi/aidl/android/hardware/wifi/NanPairingRequestInd.aidl
@@ -22,7 +22,7 @@
/**
* NAN pairing request indication message structure.
* Event indication received by an intended Responder when a
- * pairing request initiated by an Initiator.
+ * pairing request is initiated by an Initiator. See Wi-Fi Aware R4.0 section 7.6.1.3
*/
@VintfStability
parcelable NanPairingRequestInd {
diff --git a/wifi/aidl/android/hardware/wifi/NanRespondToPairingIndicationRequest.aidl b/wifi/aidl/android/hardware/wifi/NanRespondToPairingIndicationRequest.aidl
index 456b430..fab2a40 100644
--- a/wifi/aidl/android/hardware/wifi/NanRespondToPairingIndicationRequest.aidl
+++ b/wifi/aidl/android/hardware/wifi/NanRespondToPairingIndicationRequest.aidl
@@ -21,6 +21,7 @@
/**
* Response to a pairing request from a peer.
+ * See Wi-Fi Aware R4.0 section 7.6.1.2
*/
@VintfStability
parcelable NanRespondToPairingIndicationRequest {
diff --git a/wifi/aidl/android/hardware/wifi/NanSuspensionModeChangeInd.aidl b/wifi/aidl/android/hardware/wifi/NanSuspensionModeChangeInd.aidl
index afabe8c..057e63b 100644
--- a/wifi/aidl/android/hardware/wifi/NanSuspensionModeChangeInd.aidl
+++ b/wifi/aidl/android/hardware/wifi/NanSuspensionModeChangeInd.aidl
@@ -22,7 +22,7 @@
@VintfStability
parcelable NanSuspensionModeChangeInd {
/**
- * Indication whether the device has entered or existed the NAN suspension mode(deep sleep)
+ * Indication whether the device has entered or exited the NAN suspension mode(deep sleep)
*/
boolean isSuspended;
}