Merge changes from topic "vendor-hal-bitmaps" into udc-dev
* changes:
Update Vendor HAL service to use ints for bitmaps instead of using enums.
Use an int to represent bitmaps in the Vendor HAL AIDL interface.
diff --git a/audio/aidl/android/hardware/audio/core/IModule.aidl b/audio/aidl/android/hardware/audio/core/IModule.aidl
index 5a6df97..080d826 100644
--- a/audio/aidl/android/hardware/audio/core/IModule.aidl
+++ b/audio/aidl/android/hardware/audio/core/IModule.aidl
@@ -611,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);
@@ -642,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..ea00dcb 100644
--- a/audio/aidl/default/Android.bp
+++ b/audio/aidl/default/Android.bp
@@ -54,12 +54,13 @@
],
}
-cc_library_static {
+cc_library {
name: "libaudioserviceexampleimpl",
defaults: [
"aidlaudioservice_defaults",
"latest_android_media_audio_common_types_ndk_shared",
"latest_android_hardware_audio_core_ndk_shared",
+ "latest_android_hardware_audio_core_sounddose_ndk_shared",
],
export_include_dirs: ["include"],
srcs: [
@@ -75,6 +76,7 @@
"Telephony.cpp",
"usb/ModuleUsb.cpp",
"usb/StreamUsb.cpp",
+ "usb/UsbAlsaMixerControl.cpp",
"usb/UsbAlsaUtils.cpp",
],
generated_sources: [
diff --git a/audio/aidl/default/Module.cpp b/audio/aidl/default/Module.cpp
index a8f03af..c4f3844 100644
--- a/audio/aidl/default/Module.cpp
+++ b/audio/aidl/default/Module.cpp
@@ -460,6 +460,7 @@
connectedPort.profiles = connectedProfilesIt->second;
}
ports.push_back(connectedPort);
+ onExternalDeviceConnectionChanged(connectedPort, true /*connected*/);
*_aidl_return = std::move(connectedPort);
std::vector<AudioRoute> newRoutes;
@@ -513,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";
@@ -983,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) {
@@ -996,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);
@@ -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/Module.h b/audio/aidl/default/include/core-impl/Module.h
index 6b254db..c35025f 100644
--- a/audio/aidl/default/include/core-impl/Module.h
+++ b/audio/aidl/default/include/core-impl/Module.h
@@ -181,8 +181,6 @@
// 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;
ChildInterface<sounddose::ISoundDose> mSoundDose;
std::optional<bool> mIsMmapSupported;
@@ -197,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/automotive/can/1.0/default/libc++fs/src/filesystem/directory_iterator.cpp b/automotive/can/1.0/default/libc++fs/src/filesystem/directory_iterator.cpp
index 624538b..37c863b 100644
--- a/automotive/can/1.0/default/libc++fs/src/filesystem/directory_iterator.cpp
+++ b/automotive/can/1.0/default/libc++fs/src/filesystem/directory_iterator.cpp
@@ -169,8 +169,8 @@
__dir_stream& operator=(const __dir_stream&) = delete;
__dir_stream(__dir_stream&& other) noexcept : __stream_(other.__stream_),
- __root_(move(other.__root_)),
- __entry_(move(other.__entry_)) {
+ __root_(std::move(other.__root_)),
+ __entry_(std::move(other.__entry_)) {
other.__stream_ = nullptr;
}
@@ -252,7 +252,7 @@
error_code m_ec;
if (!__imp_->advance(m_ec)) {
- path root = move(__imp_->__root_);
+ path root = std::move(__imp_->__root_);
__imp_.reset();
if (m_ec)
err.report(m_ec, "at root \"%s\"", root);
@@ -286,7 +286,7 @@
__imp_ = make_shared<__shared_imp>();
__imp_->__options_ = opt;
- __imp_->__stack_.push(move(new_s));
+ __imp_->__stack_.push(std::move(new_s));
}
void recursive_directory_iterator::__pop(error_code* ec) {
@@ -340,7 +340,7 @@
}
if (m_ec) {
- path root = move(stack.top().__root_);
+ path root = std::move(stack.top().__root_);
__imp_.reset();
err.report(m_ec, "at root \"%s\"", root);
} else {
@@ -374,7 +374,7 @@
if (!skip_rec) {
__dir_stream new_it(curr_it.__entry_.path(), __imp_->__options_, m_ec);
if (new_it.good()) {
- __imp_->__stack_.push(move(new_it));
+ __imp_->__stack_.push(std::move(new_it));
return true;
}
}
@@ -385,7 +385,7 @@
if (ec)
ec->clear();
} else {
- path at_ent = move(curr_it.__entry_.__p_);
+ path at_ent = std::move(curr_it.__entry_.__p_);
__imp_.reset();
err.report(m_ec, "attempting recursion into \"%s\"", at_ent);
}
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/bluetooth/1.0/vts/functional/VtsHalBluetoothV1_0TargetTest.cpp b/bluetooth/1.0/vts/functional/VtsHalBluetoothV1_0TargetTest.cpp
index 8ea1ddd..9451087 100644
--- a/bluetooth/1.0/vts/functional/VtsHalBluetoothV1_0TargetTest.cpp
+++ b/bluetooth/1.0/vts/functional/VtsHalBluetoothV1_0TargetTest.cpp
@@ -516,12 +516,15 @@
// Return the number of completed packets reported by the controller.
int BluetoothHidlTest::wait_for_completed_packets_event(uint16_t handle) {
int packets_processed = 0;
- wait_for_event(false);
- if (event_queue.size() == 0) {
- ALOGW("%s: WaitForCallback timed out.", __func__);
- return packets_processed;
- }
- while (event_queue.size() > 0) {
+ while (true) {
+ // There should be at least one event.
+ wait_for_event(packets_processed == 0);
+ if (event_queue.empty()) {
+ if (packets_processed == 0) {
+ ALOGW("%s: WaitForCallback timed out.", __func__);
+ }
+ return packets_processed;
+ }
hidl_vec<uint8_t> event = event_queue.front();
event_queue.pop();
diff --git a/bluetooth/1.1/vts/functional/VtsHalBluetoothV1_1TargetTest.cpp b/bluetooth/1.1/vts/functional/VtsHalBluetoothV1_1TargetTest.cpp
index 9ae3837..28ac603 100644
--- a/bluetooth/1.1/vts/functional/VtsHalBluetoothV1_1TargetTest.cpp
+++ b/bluetooth/1.1/vts/functional/VtsHalBluetoothV1_1TargetTest.cpp
@@ -539,12 +539,15 @@
// Return the number of completed packets reported by the controller.
int BluetoothHidlTest::wait_for_completed_packets_event(uint16_t handle) {
int packets_processed = 0;
- wait_for_event(false);
- if (event_queue.size() == 0) {
- ALOGW("%s: WaitForCallback timed out.", __func__);
- return packets_processed;
- }
- while (event_queue.size() > 0) {
+ while (true) {
+ // There should be at least one event.
+ wait_for_event(packets_processed == 0);
+ if (event_queue.empty()) {
+ if (packets_processed == 0) {
+ ALOGW("%s: WaitForCallback timed out.", __func__);
+ }
+ return packets_processed;
+ }
hidl_vec<uint8_t> event = event_queue.front();
event_queue.pop();
diff --git a/confirmationui/1.0/default/OWNERS b/confirmationui/1.0/default/OWNERS
index 335660d..17aed51 100644
--- a/confirmationui/1.0/default/OWNERS
+++ b/confirmationui/1.0/default/OWNERS
@@ -1,2 +1,3 @@
+# Bug component: 1124672
jdanis@google.com
swillden@google.com
diff --git a/confirmationui/1.0/vts/OWNERS b/confirmationui/1.0/vts/OWNERS
index e7aa8b4..aa07242 100644
--- a/confirmationui/1.0/vts/OWNERS
+++ b/confirmationui/1.0/vts/OWNERS
@@ -1,3 +1,4 @@
+# Bug component: 1124672
jdanis@google.com
swillden@google.com
yim@google.com
diff --git a/confirmationui/OWNERS b/confirmationui/OWNERS
index 2bcdb0e..d3896df 100644
--- a/confirmationui/OWNERS
+++ b/confirmationui/OWNERS
@@ -1,2 +1,3 @@
+# Bug component: 1124672
swillden@google.com
subrahmanyaman@google.com
diff --git a/confirmationui/support/OWNERS b/confirmationui/support/OWNERS
index 335660d..17aed51 100644
--- a/confirmationui/support/OWNERS
+++ b/confirmationui/support/OWNERS
@@ -1,2 +1,3 @@
+# Bug component: 1124672
jdanis@google.com
swillden@google.com
diff --git a/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/IContextHub.aidl b/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/IContextHub.aidl
index d66e1ac..9f2eb76 100644
--- a/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/IContextHub.aidl
+++ b/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/IContextHub.aidl
@@ -46,7 +46,7 @@
void onHostEndpointConnected(in android.hardware.contexthub.HostEndpointInfo hostEndpointInfo);
void onHostEndpointDisconnected(char hostEndpointId);
long[] getPreloadedNanoappIds();
- void onNanSessionStateChanged(in boolean state);
+ void onNanSessionStateChanged(in android.hardware.contexthub.NanSessionStateUpdate update);
void setTestMode(in boolean enable);
- const int EX_CONTEXT_HUB_UNSPECIFIED = (-1);
+ const int EX_CONTEXT_HUB_UNSPECIFIED = (-1) /* -1 */;
}
diff --git a/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/IContextHubCallback.aidl b/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/IContextHubCallback.aidl
index e72ae73..6163cfc 100644
--- a/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/IContextHubCallback.aidl
+++ b/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/IContextHubCallback.aidl
@@ -38,6 +38,6 @@
void handleContextHubMessage(in android.hardware.contexthub.ContextHubMessage msg, in String[] msgContentPerms);
void handleContextHubAsyncEvent(in android.hardware.contexthub.AsyncEventType evt);
void handleTransactionResult(in int transactionId, in boolean success);
- void handleNanSessionRequest(in boolean enable);
+ void handleNanSessionRequest(in android.hardware.contexthub.NanSessionRequest request);
const int CONTEXTHUB_NAN_TRANSACTION_TIMEOUT_MS = 10000;
}
diff --git a/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/NanSessionRequest.aidl b/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/NanSessionRequest.aidl
new file mode 100644
index 0000000..d539707
--- /dev/null
+++ b/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/NanSessionRequest.aidl
@@ -0,0 +1,38 @@
+/*
+ * 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.contexthub;
+@VintfStability
+parcelable NanSessionRequest {
+ boolean enable;
+}
diff --git a/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/NanSessionStateUpdate.aidl b/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/NanSessionStateUpdate.aidl
new file mode 100644
index 0000000..80771e2
--- /dev/null
+++ b/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/NanSessionStateUpdate.aidl
@@ -0,0 +1,38 @@
+/*
+ * 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.contexthub;
+@VintfStability
+parcelable NanSessionStateUpdate {
+ boolean state;
+}
diff --git a/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/NanoappBinary.aidl b/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/NanoappBinary.aidl
index 741a9cf..fdf3860 100644
--- a/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/NanoappBinary.aidl
+++ b/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/NanoappBinary.aidl
@@ -40,7 +40,7 @@
byte targetChreApiMajorVersion;
byte targetChreApiMinorVersion;
byte[] customBinary;
- const int FLAG_SIGNED = (1 << 0);
- const int FLAG_ENCRYPTED = (1 << 1);
- const int FLAG_TCM_CAPABLE = (1 << 2);
+ const int FLAG_SIGNED = (1 << 0) /* 1 */;
+ const int FLAG_ENCRYPTED = (1 << 1) /* 2 */;
+ const int FLAG_TCM_CAPABLE = (1 << 2) /* 4 */;
}
diff --git a/contexthub/aidl/android/hardware/contexthub/IContextHub.aidl b/contexthub/aidl/android/hardware/contexthub/IContextHub.aidl
index f9838bd..17bffd6 100644
--- a/contexthub/aidl/android/hardware/contexthub/IContextHub.aidl
+++ b/contexthub/aidl/android/hardware/contexthub/IContextHub.aidl
@@ -20,6 +20,7 @@
import android.hardware.contexthub.ContextHubMessage;
import android.hardware.contexthub.HostEndpointInfo;
import android.hardware.contexthub.IContextHubCallback;
+import android.hardware.contexthub.NanSessionStateUpdate;
import android.hardware.contexthub.NanoappBinary;
import android.hardware.contexthub.NanoappInfo;
import android.hardware.contexthub.Setting;
@@ -212,9 +213,9 @@
* explicitly invoke handleNanSessionRequest() at a later point in time to attempt to
* re-enable NAN.
*
- * @param state True if the NAN session is currently enabled.
+ * @param update Information about the latest NAN session state.
*/
- void onNanSessionStateChanged(in boolean state);
+ void onNanSessionStateChanged(in NanSessionStateUpdate update);
/**
* Puts the context hub in and out of test mode. Test mode is a clean state
diff --git a/contexthub/aidl/android/hardware/contexthub/IContextHubCallback.aidl b/contexthub/aidl/android/hardware/contexthub/IContextHubCallback.aidl
index cff1893..bfcb51e 100644
--- a/contexthub/aidl/android/hardware/contexthub/IContextHubCallback.aidl
+++ b/contexthub/aidl/android/hardware/contexthub/IContextHubCallback.aidl
@@ -18,6 +18,7 @@
import android.hardware.contexthub.AsyncEventType;
import android.hardware.contexthub.ContextHubMessage;
+import android.hardware.contexthub.NanSessionRequest;
import android.hardware.contexthub.NanoappInfo;
@VintfStability
@@ -85,10 +86,9 @@
* request times out, onNanSessionStateChanged() will be invoked with the state that the session
* was previously in.
*
- * @param enable Whether the NAN session should be enabled or disabled depending on whether the
- * Contexthub needs access to NAN.
+ * @param request Request from the HAL indicating the latest NAN session state it would like.
*/
- void handleNanSessionRequest(in boolean enable);
+ void handleNanSessionRequest(in NanSessionRequest request);
/**
* Amount of time, in milliseconds, that a handleNanSessionRequest can be pending before the
diff --git a/contexthub/aidl/android/hardware/contexthub/NanSessionRequest.aidl b/contexthub/aidl/android/hardware/contexthub/NanSessionRequest.aidl
new file mode 100644
index 0000000..c462ba1
--- /dev/null
+++ b/contexthub/aidl/android/hardware/contexthub/NanSessionRequest.aidl
@@ -0,0 +1,29 @@
+/*
+ * 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.contexthub;
+
+/**
+ * Contains information needed to request a state change for a NAN session.
+ */
+@VintfStability
+parcelable NanSessionRequest {
+ /**
+ * Whether the NAN session should be enabled or disabled depending on whether the Contexthub
+ * needs access to NAN.
+ */
+ boolean enable;
+}
diff --git a/contexthub/aidl/android/hardware/contexthub/NanSessionStateUpdate.aidl b/contexthub/aidl/android/hardware/contexthub/NanSessionStateUpdate.aidl
new file mode 100644
index 0000000..a58eda5
--- /dev/null
+++ b/contexthub/aidl/android/hardware/contexthub/NanSessionStateUpdate.aidl
@@ -0,0 +1,28 @@
+/*
+ * 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.contexthub;
+
+/**
+ * Contains information provided as a response to a NanSessionRequest.
+ */
+@VintfStability
+parcelable NanSessionStateUpdate {
+ /**
+ * True if the NAN session is currently enabled.
+ */
+ boolean state;
+}
diff --git a/contexthub/aidl/default/ContextHub.cpp b/contexthub/aidl/default/ContextHub.cpp
index b98bfb2..66f9857 100644
--- a/contexthub/aidl/default/ContextHub.cpp
+++ b/contexthub/aidl/default/ContextHub.cpp
@@ -87,7 +87,7 @@
return ndk::ScopedAStatus::ok();
}
-ScopedAStatus ContextHub::onNanSessionStateChanged(bool /*sin_state*/) {
+ScopedAStatus ContextHub::onNanSessionStateChanged(const NanSessionStateUpdate& /*in_update*/) {
return ndk::ScopedAStatus::ok();
}
diff --git a/contexthub/aidl/default/include/contexthub-impl/ContextHub.h b/contexthub/aidl/default/include/contexthub-impl/ContextHub.h
index dc9aef0..02ecf53 100644
--- a/contexthub/aidl/default/include/contexthub-impl/ContextHub.h
+++ b/contexthub/aidl/default/include/contexthub-impl/ContextHub.h
@@ -48,7 +48,7 @@
::ndk::ScopedAStatus onHostEndpointConnected(const HostEndpointInfo& in_info) override;
::ndk::ScopedAStatus onHostEndpointDisconnected(char16_t in_hostEndpointId) override;
- ::ndk::ScopedAStatus onNanSessionStateChanged(bool in_state) override;
+ ::ndk::ScopedAStatus onNanSessionStateChanged(const NanSessionStateUpdate& in_update) override;
private:
static constexpr uint32_t kMockHubId = 0;
diff --git a/contexthub/aidl/vts/VtsAidlHalContextHubTargetTest.cpp b/contexthub/aidl/vts/VtsAidlHalContextHubTargetTest.cpp
index b227e4a..9707ecf 100644
--- a/contexthub/aidl/vts/VtsAidlHalContextHubTargetTest.cpp
+++ b/contexthub/aidl/vts/VtsAidlHalContextHubTargetTest.cpp
@@ -42,6 +42,8 @@
using ::android::hardware::contexthub::NanoappBinary;
using ::android::hardware::contexthub::NanoappInfo;
using ::android::hardware::contexthub::NanoappRpcService;
+using ::android::hardware::contexthub::NanSessionRequest;
+using ::android::hardware::contexthub::NanSessionStateUpdate;
using ::android::hardware::contexthub::Setting;
using ::android::hardware::contexthub::vts_utils::kNonExistentAppId;
using ::android::hardware::contexthub::vts_utils::waitForCallback;
@@ -121,7 +123,9 @@
return Status::ok();
}
- Status handleNanSessionRequest(bool /* enable */) override { return Status::ok(); }
+ Status handleNanSessionRequest(const NanSessionRequest& /* request */) override {
+ return Status::ok();
+ }
};
TEST_P(ContextHubAidl, TestRegisterCallback) {
@@ -153,7 +157,9 @@
return Status::ok();
}
- Status handleNanSessionRequest(bool /* enable */) override { return Status::ok(); }
+ Status handleNanSessionRequest(const NanSessionRequest& /* request */) override {
+ return Status::ok();
+ }
std::promise<std::vector<NanoappInfo>> promise;
};
@@ -218,7 +224,9 @@
return Status::ok();
}
- Status handleNanSessionRequest(bool /* enable */) override { return Status::ok(); }
+ Status handleNanSessionRequest(const NanSessionRequest& /* request */) override {
+ return Status::ok();
+ }
uint32_t expectedTransactionId = 0;
std::promise<bool> promise;
@@ -382,8 +390,11 @@
}
TEST_P(ContextHubAidl, TestNanSessionStateChange) {
- ASSERT_TRUE(contextHub->onNanSessionStateChanged(true /*state*/).isOk());
- ASSERT_TRUE(contextHub->onNanSessionStateChanged(false /*state*/).isOk());
+ NanSessionStateUpdate update;
+ update.state = true;
+ ASSERT_TRUE(contextHub->onNanSessionStateChanged(update).isOk());
+ update.state = false;
+ ASSERT_TRUE(contextHub->onNanSessionStateChanged(update).isOk());
}
std::string PrintGeneratedTest(const testing::TestParamInfo<ContextHubAidl::ParamType>& info) {
diff --git a/graphics/composer/aidl/vts/GraphicsComposerCallback.cpp b/graphics/composer/aidl/vts/GraphicsComposerCallback.cpp
index 4fb5d01..7b3a2b4 100644
--- a/graphics/composer/aidl/vts/GraphicsComposerCallback.cpp
+++ b/graphics/composer/aidl/vts/GraphicsComposerCallback.cpp
@@ -29,6 +29,11 @@
mVsyncAllowed = allowed;
}
+void GraphicsComposerCallback::setRefreshRateChangedDebugDataEnabledCallbackAllowed(bool allowed) {
+ std::scoped_lock lock(mMutex);
+ mRefreshRateChangedDebugDataEnabledCallbackAllowed = allowed;
+}
+
std::vector<int64_t> GraphicsComposerCallback::getDisplays() const {
std::scoped_lock lock(mMutex);
return mDisplays;
@@ -79,6 +84,21 @@
return ret;
}
+std::vector<RefreshRateChangedDebugData>
+GraphicsComposerCallback::takeListOfRefreshRateChangedDebugData() {
+ std::scoped_lock lock(mMutex);
+
+ std::vector<RefreshRateChangedDebugData> ret;
+ ret.swap(mRefreshRateChangedDebugData);
+
+ return ret;
+}
+
+int32_t GraphicsComposerCallback::getInvalidRefreshRateDebugEnabledCallbackCount() const {
+ std::scoped_lock lock(mMutex);
+ return mInvalidRefreshRateDebugEnabledCallbackCount;
+}
+
::ndk::ScopedAStatus GraphicsComposerCallback::onHotplug(int64_t in_display, bool in_connected) {
std::scoped_lock lock(mMutex);
@@ -125,9 +145,16 @@
}
::ndk::ScopedAStatus GraphicsComposerCallback::onRefreshRateChangedDebug(
- const RefreshRateChangedDebugData&) {
- // TODO(b/202734676) Add implementation for Vts tests
- return ::ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
+ const RefreshRateChangedDebugData& data) {
+ std::scoped_lock lock(mMutex);
+
+ const auto it = std::find(mDisplays.begin(), mDisplays.end(), data.display);
+ if (mRefreshRateChangedDebugDataEnabledCallbackAllowed && it != mDisplays.end()) {
+ mRefreshRateChangedDebugData.push_back(data);
+ } else {
+ mInvalidRefreshRateDebugEnabledCallbackCount++;
+ }
+ return ::ndk::ScopedAStatus::ok();
}
::ndk::ScopedAStatus GraphicsComposerCallback::onVsyncPeriodTimingChanged(
diff --git a/graphics/composer/aidl/vts/GraphicsComposerCallback.h b/graphics/composer/aidl/vts/GraphicsComposerCallback.h
index 9c3bc70..13e992a 100644
--- a/graphics/composer/aidl/vts/GraphicsComposerCallback.h
+++ b/graphics/composer/aidl/vts/GraphicsComposerCallback.h
@@ -26,6 +26,8 @@
public:
void setVsyncAllowed(bool allowed);
+ void setRefreshRateChangedDebugDataEnabledCallbackAllowed(bool allowed);
+
std::vector<int64_t> getDisplays() const;
int32_t getInvalidHotplugCount() const;
@@ -44,6 +46,10 @@
std::optional<VsyncPeriodChangeTimeline> takeLastVsyncPeriodChangeTimeline();
+ std::vector<RefreshRateChangedDebugData> takeListOfRefreshRateChangedDebugData();
+
+ int32_t getInvalidRefreshRateDebugEnabledCallbackCount() const;
+
private:
virtual ::ndk::ScopedAStatus onHotplug(int64_t in_display, bool in_connected) override;
virtual ::ndk::ScopedAStatus onRefresh(int64_t in_display) override;
@@ -63,9 +69,13 @@
std::vector<int64_t> mDisplays GUARDED_BY(mMutex);
// true only when vsync is enabled
bool mVsyncAllowed GUARDED_BY(mMutex) = true;
+ // true only when RefreshRateChangedCallbackDebugEnabled is set to true.
+ bool mRefreshRateChangedDebugDataEnabledCallbackAllowed GUARDED_BY(mMutex) = false;
std::optional<VsyncPeriodChangeTimeline> mTimeline GUARDED_BY(mMutex);
+ std::vector<RefreshRateChangedDebugData> mRefreshRateChangedDebugData GUARDED_BY(mMutex);
+
int32_t mVsyncIdleCount GUARDED_BY(mMutex) = 0;
int64_t mVsyncIdleTime GUARDED_BY(mMutex) = 0;
@@ -75,6 +85,7 @@
int32_t mInvalidVsyncCount GUARDED_BY(mMutex) = 0;
int32_t mInvalidVsyncPeriodChangeCount GUARDED_BY(mMutex) = 0;
int32_t mInvalidSeamlessPossibleCount GUARDED_BY(mMutex) = 0;
+ int32_t mInvalidRefreshRateDebugEnabledCallbackCount GUARDED_BY(mMutex) = 0;
};
} // namespace aidl::android::hardware::graphics::composer3::vts
diff --git a/graphics/composer/aidl/vts/VtsComposerClient.cpp b/graphics/composer/aidl/vts/VtsComposerClient.cpp
index e03ef25..25b0ca0 100644
--- a/graphics/composer/aidl/vts/VtsComposerClient.cpp
+++ b/graphics/composer/aidl/vts/VtsComposerClient.cpp
@@ -119,6 +119,24 @@
return updateDisplayProperties(vtsDisplay, config);
}
+ScopedAStatus VtsComposerClient::setPeakRefreshRateConfig(VtsDisplay* vtsDisplay) {
+ const auto displayId = vtsDisplay->getDisplayId();
+ auto [activeStatus, activeConfig] = getActiveConfig(displayId);
+ EXPECT_TRUE(activeStatus.isOk());
+ auto peakDisplayConfig = vtsDisplay->getDisplayConfig(activeConfig);
+ auto peakConfig = activeConfig;
+
+ const auto displayConfigs = vtsDisplay->getDisplayConfigs();
+ for (const auto [config, displayConfig] : displayConfigs) {
+ if (displayConfig.configGroup == peakDisplayConfig.configGroup &&
+ displayConfig.vsyncPeriod < peakDisplayConfig.vsyncPeriod) {
+ peakDisplayConfig = displayConfig;
+ peakConfig = config;
+ }
+ }
+ return setActiveConfig(vtsDisplay, peakConfig);
+}
+
std::pair<ScopedAStatus, int32_t> VtsComposerClient::getDisplayAttribute(
int64_t display, int32_t config, DisplayAttribute displayAttribute) {
int32_t outDisplayAttribute;
@@ -375,10 +393,15 @@
return mComposerCallback->getVsyncIdleTime();
}
-ndk::ScopedAStatus VtsComposerClient::setRefreshRateChangedCallbackDebugEnabled(
- int64_t /* display */, bool /* enabled */) {
- // TODO(b/202734676) Add implementation for VTS tests
- return ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
+ndk::ScopedAStatus VtsComposerClient::setRefreshRateChangedCallbackDebugEnabled(int64_t display,
+ bool enabled) {
+ mComposerCallback->setRefreshRateChangedDebugDataEnabledCallbackAllowed(enabled);
+ return mComposerClient->setRefreshRateChangedCallbackDebugEnabled(display, enabled);
+}
+
+std::vector<RefreshRateChangedDebugData>
+VtsComposerClient::takeListOfRefreshRateChangedDebugData() {
+ return mComposerCallback->takeListOfRefreshRateChangedDebugData();
}
int64_t VtsComposerClient::getInvalidDisplayId() {
@@ -545,6 +568,10 @@
ALOGE("Invalid seamless possible count");
isValid = false;
}
+ if (mComposerCallback->getInvalidRefreshRateDebugEnabledCallbackCount() != 0) {
+ ALOGE("Invalid refresh rate debug enabled callback count");
+ isValid = false;
+ }
}
return isValid;
}
diff --git a/graphics/composer/aidl/vts/VtsComposerClient.h b/graphics/composer/aidl/vts/VtsComposerClient.h
index 81a62b3..ea3318c 100644
--- a/graphics/composer/aidl/vts/VtsComposerClient.h
+++ b/graphics/composer/aidl/vts/VtsComposerClient.h
@@ -77,6 +77,8 @@
ScopedAStatus setActiveConfig(VtsDisplay* vtsDisplay, int32_t config);
+ ScopedAStatus setPeakRefreshRateConfig(VtsDisplay* vtsDisplay);
+
std::pair<ScopedAStatus, int32_t> getDisplayAttribute(int64_t display, int32_t config,
DisplayAttribute displayAttribute);
@@ -183,6 +185,10 @@
std::pair<ScopedAStatus, OverlayProperties> getOverlaySupport();
+ ndk::ScopedAStatus setRefreshRateChangedCallbackDebugEnabled(int64_t display, bool enabled);
+
+ std::vector<RefreshRateChangedDebugData> takeListOfRefreshRateChangedDebugData();
+
private:
ScopedAStatus addDisplayConfig(VtsDisplay* vtsDisplay, int32_t config);
ScopedAStatus updateDisplayProperties(VtsDisplay* vtsDisplay, int32_t config);
@@ -197,9 +203,6 @@
bool verifyComposerCallbackParams();
- ndk::ScopedAStatus setRefreshRateChangedCallbackDebugEnabled(int64_t /* display */,
- bool /* enabled */);
-
// Keep track of displays and layers. When a test fails/ends,
// the VtsComposerClient::tearDown should be called from the
// test tearDown to clean up the resources for the test.
@@ -245,15 +248,17 @@
};
void addDisplayConfig(int32_t config, DisplayConfig displayConfig) {
- displayConfigs.insert({config, displayConfig});
+ mDisplayConfigs.insert({config, displayConfig});
}
- DisplayConfig getDisplayConfig(int32_t config) { return displayConfigs.find(config)->second; }
+ DisplayConfig getDisplayConfig(int32_t config) { return mDisplayConfigs.find(config)->second; }
+
+ std::unordered_map<int32_t, DisplayConfig> getDisplayConfigs() { return mDisplayConfigs; }
private:
int64_t mDisplayId;
int32_t mDisplayWidth;
int32_t mDisplayHeight;
- std::unordered_map<int32_t, DisplayConfig> displayConfigs;
+ std::unordered_map<int32_t, DisplayConfig> mDisplayConfigs;
};
} // namespace aidl::android::hardware::graphics::composer3::vts
diff --git a/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp b/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp
index 4974e71..37576b9 100644
--- a/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp
+++ b/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp
@@ -1217,6 +1217,14 @@
}
}
+ bool checkIfCallbackRefreshRateChangedDebugEnabledReceived(
+ std::function<bool(RefreshRateChangedDebugData)> filter) {
+ const auto list = mComposerClient->takeListOfRefreshRateChangedDebugData();
+ return std::any_of(list.begin(), list.end(), [&](auto refreshRateChangedDebugData) {
+ return filter(refreshRateChangedDebugData);
+ });
+ }
+
sp<GraphicBuffer> allocate(::android::PixelFormat pixelFormat) {
return sp<GraphicBuffer>::make(
static_cast<uint32_t>(getPrimaryDisplay().getDisplayWidth()),
@@ -1316,7 +1324,7 @@
return vsyncPeriod;
}
- int64_t createOnScreenLayer() {
+ int64_t createOnScreenLayer(Composition composition = Composition::DEVICE) {
const auto& [status, layer] =
mComposerClient->createLayer(getPrimaryDisplayId(), kBufferSlotCount);
EXPECT_TRUE(status.isOk());
@@ -1324,12 +1332,25 @@
getPrimaryDisplay().getDisplayHeight()};
FRect cropRect{0, 0, (float)getPrimaryDisplay().getDisplayWidth(),
(float)getPrimaryDisplay().getDisplayHeight()};
- configureLayer(getPrimaryDisplay(), layer, Composition::DEVICE, displayFrame, cropRect);
+ configureLayer(getPrimaryDisplay(), layer, composition, displayFrame, cropRect);
auto& writer = getWriter(getPrimaryDisplayId());
writer.setLayerDataspace(getPrimaryDisplayId(), layer, common::Dataspace::UNKNOWN);
return layer;
}
+ void sendBufferUpdate(int64_t layer) {
+ const auto buffer = allocate(::android::PIXEL_FORMAT_RGBA_8888);
+ ASSERT_NE(nullptr, buffer->handle);
+
+ auto& writer = getWriter(getPrimaryDisplayId());
+ writer.setLayerBuffer(getPrimaryDisplayId(), layer, /*slot*/ 0, buffer->handle,
+ /*acquireFence*/ -1);
+
+ const sp<::android::Fence> presentFence =
+ presentAndGetFence(ComposerClientWriter::kNoTimestamp);
+ presentFence->waitForever(LOG_TAG);
+ }
+
bool hasDisplayCapability(int64_t display, DisplayCapability cap) {
const auto& [status, capabilities] = mComposerClient->getDisplayCapabilities(display);
EXPECT_TRUE(status.isOk());
@@ -2268,6 +2289,179 @@
EXPECT_TRUE(mComposerClient->setPowerMode(getPrimaryDisplayId(), PowerMode::OFF).isOk());
}
+TEST_P(GraphicsComposerAidlCommandTest, SetRefreshRateChangedCallbackDebug_Unsupported) {
+ if (!hasCapability(Capability::REFRESH_RATE_CHANGED_CALLBACK_DEBUG)) {
+ auto status = mComposerClient->setRefreshRateChangedCallbackDebugEnabled(
+ getPrimaryDisplayId(), /*enabled*/ true);
+ EXPECT_FALSE(status.isOk());
+ EXPECT_NO_FATAL_FAILURE(
+ assertServiceSpecificError(status, IComposerClient::EX_UNSUPPORTED));
+
+ status = mComposerClient->setRefreshRateChangedCallbackDebugEnabled(getPrimaryDisplayId(),
+ /*enabled*/ false);
+ EXPECT_FALSE(status.isOk());
+ EXPECT_NO_FATAL_FAILURE(
+ assertServiceSpecificError(status, IComposerClient::EX_UNSUPPORTED));
+ }
+}
+
+TEST_P(GraphicsComposerAidlCommandTest, SetRefreshRateChangedCallbackDebug_Enabled) {
+ if (!hasCapability(Capability::REFRESH_RATE_CHANGED_CALLBACK_DEBUG)) {
+ GTEST_SUCCEED() << "Capability::REFRESH_RATE_CHANGED_CALLBACK_DEBUG is not supported";
+ return;
+ }
+
+ const auto displayId = getPrimaryDisplayId();
+ EXPECT_TRUE(mComposerClient->setPowerMode(displayId, PowerMode::ON).isOk());
+ // Enable the callback
+ ASSERT_TRUE(mComposerClient
+ ->setRefreshRateChangedCallbackDebugEnabled(displayId,
+ /*enabled*/ true)
+ .isOk());
+ std::this_thread::sleep_for(100ms);
+
+ const bool isCallbackReceived = checkIfCallbackRefreshRateChangedDebugEnabledReceived(
+ [&](auto refreshRateChangedDebugData) {
+ return displayId == refreshRateChangedDebugData.display;
+ });
+
+ // Check that we immediately got a callback
+ EXPECT_TRUE(isCallbackReceived);
+
+ ASSERT_TRUE(mComposerClient
+ ->setRefreshRateChangedCallbackDebugEnabled(displayId,
+ /*enabled*/ false)
+ .isOk());
+}
+
+TEST_P(GraphicsComposerAidlCommandTest,
+ SetRefreshRateChangedCallbackDebugEnabled_noCallbackWhenIdle) {
+ if (!hasCapability(Capability::REFRESH_RATE_CHANGED_CALLBACK_DEBUG)) {
+ GTEST_SUCCEED() << "Capability::REFRESH_RATE_CHANGED_CALLBACK_DEBUG is not supported";
+ return;
+ }
+
+ auto display = getEditablePrimaryDisplay();
+ const auto displayId = display.getDisplayId();
+
+ if (!hasDisplayCapability(displayId, DisplayCapability::DISPLAY_IDLE_TIMER)) {
+ GTEST_SUCCEED() << "DisplayCapability::DISPLAY_IDLE_TIMER is not supported";
+ return;
+ }
+
+ EXPECT_TRUE(mComposerClient->setPowerMode(displayId, PowerMode::ON).isOk());
+ EXPECT_TRUE(mComposerClient->setPeakRefreshRateConfig(&display).isOk());
+
+ ASSERT_TRUE(mComposerClient->setIdleTimerEnabled(displayId, /*timeoutMs*/ 500).isOk());
+ // Enable the callback
+ ASSERT_TRUE(mComposerClient
+ ->setRefreshRateChangedCallbackDebugEnabled(displayId,
+ /*enabled*/ true)
+ .isOk());
+
+ const bool isCallbackReceived = checkIfCallbackRefreshRateChangedDebugEnabledReceived(
+ [&](auto refreshRateChangedDebugData) {
+ return displayId == refreshRateChangedDebugData.display;
+ });
+
+ int retryCount = 3;
+ do {
+ // Wait for 1s so that we enter the idle state
+ std::this_thread::sleep_for(1s);
+ if (!isCallbackReceived) {
+ // DID NOT receive a callback, we are in the idle state.
+ break;
+ }
+ } while (--retryCount > 0);
+
+ if (retryCount == 0) {
+ GTEST_SUCCEED() << "Unable to enter the idle mode";
+ return;
+ }
+
+ // Send the REFRESH_RATE_INDICATOR update
+ ASSERT_NO_FATAL_FAILURE(
+ sendBufferUpdate(createOnScreenLayer(Composition::REFRESH_RATE_INDICATOR)));
+ std::this_thread::sleep_for(1s);
+ EXPECT_FALSE(isCallbackReceived)
+ << "A callback should not be received for REFRESH_RATE_INDICATOR";
+
+ EXPECT_TRUE(mComposerClient
+ ->setRefreshRateChangedCallbackDebugEnabled(displayId,
+ /*enabled*/ false)
+ .isOk());
+}
+
+TEST_P(GraphicsComposerAidlCommandTest,
+ SetRefreshRateChangedCallbackDebugEnabled_SetActiveConfigWithConstraints) {
+ if (!hasCapability(Capability::REFRESH_RATE_CHANGED_CALLBACK_DEBUG)) {
+ GTEST_SUCCEED() << "Capability::REFRESH_RATE_CHANGED_CALLBACK_DEBUG is not supported";
+ return;
+ }
+
+ VsyncPeriodChangeConstraints constraints;
+ constraints.seamlessRequired = false;
+ constraints.desiredTimeNanos = systemTime();
+
+ for (VtsDisplay& display : mDisplays) {
+ const auto displayId = display.getDisplayId();
+ EXPECT_TRUE(mComposerClient->setPowerMode(displayId, PowerMode::ON).isOk());
+
+ // Enable the callback
+ ASSERT_TRUE(mComposerClient
+ ->setRefreshRateChangedCallbackDebugEnabled(displayId, /*enabled*/ true)
+ .isOk());
+
+ forEachTwoConfigs(displayId, [&](int32_t config1, int32_t config2) {
+ const int32_t vsyncPeriod1 = display.getDisplayConfig(config1).vsyncPeriod;
+ const int32_t vsyncPeriod2 = display.getDisplayConfig(config2).vsyncPeriod;
+
+ if (vsyncPeriod1 == vsyncPeriod2) {
+ return; // continue
+ }
+
+ EXPECT_TRUE(mComposerClient->setActiveConfig(&display, config1).isOk());
+ sendRefreshFrame(display, nullptr);
+
+ const auto& [status, timeline] =
+ mComposerClient->setActiveConfigWithConstraints(&display, config2, constraints);
+ EXPECT_TRUE(status.isOk());
+
+ if (timeline.refreshRequired) {
+ sendRefreshFrame(display, &timeline);
+ }
+
+ const auto isCallbackReceived = checkIfCallbackRefreshRateChangedDebugEnabledReceived(
+ [&](auto refreshRateChangedDebugData) {
+ constexpr int kVsyncThreshold = 1000;
+ return displayId == refreshRateChangedDebugData.display &&
+ std::abs(vsyncPeriod2 -
+ refreshRateChangedDebugData.vsyncPeriodNanos) <=
+ kVsyncThreshold;
+ });
+
+ int retryCount = 3;
+ do {
+ std::this_thread::sleep_for(100ms);
+ if (isCallbackReceived) {
+ GTEST_SUCCEED() << "Received a callback successfully";
+ break;
+ }
+ } while (--retryCount > 0);
+
+ if (retryCount == 0) {
+ GTEST_FAIL() << "failed to get a callback for the display " << displayId
+ << " with config " << config2;
+ }
+ });
+
+ EXPECT_TRUE(
+ mComposerClient
+ ->setRefreshRateChangedCallbackDebugEnabled(displayId, /*enabled*/ false)
+ .isOk());
+ }
+}
+
/*
* Test that no two display configs are exactly the same.
*/
diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AmrMode.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AmrMode.aidl
index 84376b7..37e3b25 100644
--- a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AmrMode.aidl
+++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AmrMode.aidl
@@ -34,13 +34,13 @@
package android.hardware.radio.ims.media;
@Backing(type="int") @VintfStability
enum AmrMode {
- AMR_MODE_0 = (1 << 0),
- AMR_MODE_1 = (1 << 1),
- AMR_MODE_2 = (1 << 2),
- AMR_MODE_3 = (1 << 3),
- AMR_MODE_4 = (1 << 4),
- AMR_MODE_5 = (1 << 5),
- AMR_MODE_6 = (1 << 6),
- AMR_MODE_7 = (1 << 7),
- AMR_MODE_8 = (1 << 8),
+ AMR_MODE_0 = (1 << 0) /* 1 */,
+ AMR_MODE_1 = (1 << 1) /* 2 */,
+ AMR_MODE_2 = (1 << 2) /* 4 */,
+ AMR_MODE_3 = (1 << 3) /* 8 */,
+ AMR_MODE_4 = (1 << 4) /* 16 */,
+ AMR_MODE_5 = (1 << 5) /* 32 */,
+ AMR_MODE_6 = (1 << 6) /* 64 */,
+ AMR_MODE_7 = (1 << 7) /* 128 */,
+ AMR_MODE_8 = (1 << 8) /* 256 */,
}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/CodecType.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/CodecType.aidl
index 9eaf129..e4193cd 100644
--- a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/CodecType.aidl
+++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/CodecType.aidl
@@ -34,9 +34,9 @@
package android.hardware.radio.ims.media;
@Backing(type="int") @VintfStability
enum CodecType {
- AMR = (1 << 0),
- AMR_WB = (1 << 1),
- EVS = (1 << 2),
- PCMA = (1 << 3),
- PCMU = (1 << 4),
+ AMR = (1 << 0) /* 1 */,
+ AMR_WB = (1 << 1) /* 2 */,
+ EVS = (1 << 2) /* 4 */,
+ PCMA = (1 << 3) /* 8 */,
+ PCMU = (1 << 4) /* 16 */,
}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/EvsBandwidth.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/EvsBandwidth.aidl
index 5e80f91..db3eb29 100644
--- a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/EvsBandwidth.aidl
+++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/EvsBandwidth.aidl
@@ -35,8 +35,8 @@
@Backing(type="int") @VintfStability
enum EvsBandwidth {
NONE = 0,
- NARROW_BAND = (1 << 0),
- WIDE_BAND = (1 << 1),
- SUPER_WIDE_BAND = (1 << 2),
- FULL_BAND = (1 << 3),
+ NARROW_BAND = (1 << 0) /* 1 */,
+ WIDE_BAND = (1 << 1) /* 2 */,
+ SUPER_WIDE_BAND = (1 << 2) /* 4 */,
+ FULL_BAND = (1 << 3) /* 8 */,
}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/EvsMode.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/EvsMode.aidl
index a530a8d..fb1f14d 100644
--- a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/EvsMode.aidl
+++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/EvsMode.aidl
@@ -34,25 +34,25 @@
package android.hardware.radio.ims.media;
@Backing(type="int") @VintfStability
enum EvsMode {
- EVS_MODE_0 = (1 << 0),
- EVS_MODE_1 = (1 << 1),
- EVS_MODE_2 = (1 << 2),
- EVS_MODE_3 = (1 << 3),
- EVS_MODE_4 = (1 << 4),
- EVS_MODE_5 = (1 << 5),
- EVS_MODE_6 = (1 << 6),
- EVS_MODE_7 = (1 << 7),
- EVS_MODE_8 = (1 << 8),
- EVS_MODE_9 = (1 << 9),
- EVS_MODE_10 = (1 << 10),
- EVS_MODE_11 = (1 << 11),
- EVS_MODE_12 = (1 << 12),
- EVS_MODE_13 = (1 << 13),
- EVS_MODE_14 = (1 << 14),
- EVS_MODE_15 = (1 << 15),
- EVS_MODE_16 = (1 << 16),
- EVS_MODE_17 = (1 << 17),
- EVS_MODE_18 = (1 << 18),
- EVS_MODE_19 = (1 << 19),
- EVS_MODE_20 = (1 << 20),
+ EVS_MODE_0 = (1 << 0) /* 1 */,
+ EVS_MODE_1 = (1 << 1) /* 2 */,
+ EVS_MODE_2 = (1 << 2) /* 4 */,
+ EVS_MODE_3 = (1 << 3) /* 8 */,
+ EVS_MODE_4 = (1 << 4) /* 16 */,
+ EVS_MODE_5 = (1 << 5) /* 32 */,
+ EVS_MODE_6 = (1 << 6) /* 64 */,
+ EVS_MODE_7 = (1 << 7) /* 128 */,
+ EVS_MODE_8 = (1 << 8) /* 256 */,
+ EVS_MODE_9 = (1 << 9) /* 512 */,
+ EVS_MODE_10 = (1 << 10) /* 1024 */,
+ EVS_MODE_11 = (1 << 11) /* 2048 */,
+ EVS_MODE_12 = (1 << 12) /* 4096 */,
+ EVS_MODE_13 = (1 << 13) /* 8192 */,
+ EVS_MODE_14 = (1 << 14) /* 16384 */,
+ EVS_MODE_15 = (1 << 15) /* 32768 */,
+ EVS_MODE_16 = (1 << 16) /* 65536 */,
+ EVS_MODE_17 = (1 << 17) /* 131072 */,
+ EVS_MODE_18 = (1 << 18) /* 262144 */,
+ EVS_MODE_19 = (1 << 19) /* 524288 */,
+ EVS_MODE_20 = (1 << 20) /* 1048576 */,
}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/MediaDirection.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/MediaDirection.aidl
index d90b2a4..0e9eaee 100644
--- a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/MediaDirection.aidl
+++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/MediaDirection.aidl
@@ -35,8 +35,8 @@
@Backing(type="int") @VintfStability
enum MediaDirection {
NO_FLOW = 0,
- SEND_ONLY = 1,
- RECEIVE_ONLY = 2,
- SEND_RECEIVE = 3,
- INACTIVE = 4,
+ RTP_TX = (1 << 0) /* 1 */,
+ RTP_RX = (1 << 1) /* 2 */,
+ RTCP_TX = (1 << 2) /* 4 */,
+ RTCP_RX = (1 << 3) /* 8 */,
}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtcpXrReportBlockType.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtcpXrReportBlockType.aidl
index 0663754..289c810 100644
--- a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtcpXrReportBlockType.aidl
+++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtcpXrReportBlockType.aidl
@@ -35,11 +35,11 @@
@Backing(type="int") @VintfStability
enum RtcpXrReportBlockType {
RTCPXR_NONE = 0,
- RTCPXR_LOSS_RLE_REPORT_BLOCK = (1 << 0),
- RTCPXR_DUPLICATE_RLE_REPORT_BLOCK = (1 << 1),
- RTCPXR_PACKET_RECEIPT_TIMES_REPORT_BLOCK = (1 << 2),
- RTCPXR_RECEIVER_REFERENCE_TIME_REPORT_BLOCK = (1 << 3),
- RTCPXR_DLRR_REPORT_BLOCK = (1 << 4),
- RTCPXR_STATISTICS_SUMMARY_REPORT_BLOCK = (1 << 5),
- RTCPXR_VOIP_METRICS_REPORT_BLOCK = (1 << 6),
+ RTCPXR_LOSS_RLE_REPORT_BLOCK = (1 << 0) /* 1 */,
+ RTCPXR_DUPLICATE_RLE_REPORT_BLOCK = (1 << 1) /* 2 */,
+ RTCPXR_PACKET_RECEIPT_TIMES_REPORT_BLOCK = (1 << 2) /* 4 */,
+ RTCPXR_RECEIVER_REFERENCE_TIME_REPORT_BLOCK = (1 << 3) /* 8 */,
+ RTCPXR_DLRR_REPORT_BLOCK = (1 << 4) /* 16 */,
+ RTCPXR_STATISTICS_SUMMARY_REPORT_BLOCK = (1 << 5) /* 32 */,
+ RTCPXR_VOIP_METRICS_REPORT_BLOCK = (1 << 6) /* 64 */,
}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtpConfig.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtpConfig.aidl
index 1a8921e..8a826f6 100644
--- a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtpConfig.aidl
+++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtpConfig.aidl
@@ -34,7 +34,7 @@
package android.hardware.radio.ims.media;
@VintfStability
parcelable RtpConfig {
- android.hardware.radio.ims.media.MediaDirection direction;
+ int direction;
android.hardware.radio.AccessNetwork accessNetwork;
android.hardware.radio.ims.media.RtpAddress remoteAddress;
android.hardware.radio.ims.media.RtpSessionParams sessionParams;
diff --git a/radio/aidl/android/hardware/radio/ims/media/MediaDirection.aidl b/radio/aidl/android/hardware/radio/ims/media/MediaDirection.aidl
index 9f04d8e..e5c34c7 100644
--- a/radio/aidl/android/hardware/radio/ims/media/MediaDirection.aidl
+++ b/radio/aidl/android/hardware/radio/ims/media/MediaDirection.aidl
@@ -16,6 +16,17 @@
package android.hardware.radio.ims.media;
+/**
+ * Directions can be combined to meet various media direction
+ * requirements depending on the scenario.
+ *
+ * Examples:
+ * No Flow : NO_FLOW - eg. SRVCC.
+ * RTCP-only : RTCP_TX | RTCP_RX - eg. Local Hold or Dual Hold.
+ * Receive-Only : RTP_RX | RTCP_TX | RTCP_RX - eg. Remote Hold.
+ * Send-Receive : RTP_TX | RTP_RX | RTCP_TX | RTCP_RX - eg. Active call.
+ * Send-Only : RTP_TX | RTCP_TX | RTCP_RX - eg. Simplex call, voice mail, etc
+ */
@VintfStability
@Backing(type="int")
enum MediaDirection {
@@ -24,12 +35,16 @@
* may release the audio resource. Eg. SRVCC.
*/
NO_FLOW = 0,
- /** Device sends outgoing RTP and drops incoming RTP */
- SEND_ONLY = 1,
- /** Device receives the downlink RTP and does not transmit any uplink RTP */
- RECEIVE_ONLY = 2,
- /** Device sends and receive RTP in both directions */
- SEND_RECEIVE = 3,
- /** No RTP flow however RTCP continues to flow. Eg. HOLD */
- INACTIVE = 4,
+
+ /** Send RTP packets */
+ RTP_TX = 1 << 0,
+
+ /** Receive and processes RTP packets */
+ RTP_RX = 1 << 1,
+
+ /** Send RTCP packets */
+ RTCP_TX = 1 << 2,
+
+ /** Receive RTCP packets */
+ RTCP_RX = 1 << 3,
}
diff --git a/radio/aidl/android/hardware/radio/ims/media/RtpConfig.aidl b/radio/aidl/android/hardware/radio/ims/media/RtpConfig.aidl
index f6696f7..f93b112 100644
--- a/radio/aidl/android/hardware/radio/ims/media/RtpConfig.aidl
+++ b/radio/aidl/android/hardware/radio/ims/media/RtpConfig.aidl
@@ -18,15 +18,14 @@
import android.hardware.radio.AccessNetwork;
import android.hardware.radio.ims.media.AnbrMode;
-import android.hardware.radio.ims.media.MediaDirection;
import android.hardware.radio.ims.media.RtcpConfig;
import android.hardware.radio.ims.media.RtpAddress;
import android.hardware.radio.ims.media.RtpSessionParams;
@VintfStability
parcelable RtpConfig {
- /** Media flow direction */
- MediaDirection direction;
+ /** Media flow direction. The bitfield of MediaDirection(s) */
+ int direction;
/** Radio Access Network */
AccessNetwork accessNetwork;
/** IP address and port number of the other party for RTP media */
diff --git a/radio/aidl/vts/radio_imsmedia_test.cpp b/radio/aidl/vts/radio_imsmedia_test.cpp
index d9e57c9..2b6f5ef 100644
--- a/radio/aidl/vts/radio_imsmedia_test.cpp
+++ b/radio/aidl/vts/radio_imsmedia_test.cpp
@@ -14,6 +14,7 @@
* limitations under the License.
*/
+#include <aidl/android/hardware/radio/ims/media/MediaDirection.h>
#include <android-base/logging.h>
#include <android/binder_auto_utils.h>
#include <android/binder_manager.h>
@@ -44,8 +45,10 @@
int32_t sessionId = 1;
RtpConfig modifyRtpConfig;
- modifyRtpConfig.direction =
- ::aidl::android::hardware::radio::ims::media::MediaDirection::SEND_RECEIVE;
+ modifyRtpConfig.direction = static_cast<int32_t>(MediaDirection::RTP_TX) |
+ static_cast<int32_t>(MediaDirection::RTP_RX) |
+ static_cast<int32_t>(MediaDirection::RTCP_TX) |
+ static_cast<int32_t>(MediaDirection::RTCP_RX);
modifyRtpConfig.remoteAddress.ipAddress = "122.22.22.33";
modifyRtpConfig.remoteAddress.portNumber = 1234;
@@ -90,8 +93,10 @@
int32_t duration = 200;
RtpConfig modifyRtpConfig;
- modifyRtpConfig.direction =
- ::aidl::android::hardware::radio::ims::media::MediaDirection::SEND_RECEIVE;
+ modifyRtpConfig.direction = static_cast<int32_t>(MediaDirection::RTP_TX) |
+ static_cast<int32_t>(MediaDirection::RTP_RX) |
+ static_cast<int32_t>(MediaDirection::RTCP_TX) |
+ static_cast<int32_t>(MediaDirection::RTCP_RX);
modifyRtpConfig.remoteAddress.ipAddress = "122.22.22.33";
modifyRtpConfig.remoteAddress.portNumber = 1234;
@@ -143,8 +148,10 @@
std::vector<RtpHeaderExtension> extensions;
RtpConfig modifyRtpConfig;
- modifyRtpConfig.direction =
- ::aidl::android::hardware::radio::ims::media::MediaDirection::SEND_RECEIVE;
+ modifyRtpConfig.direction = static_cast<int32_t>(MediaDirection::RTP_TX) |
+ static_cast<int32_t>(MediaDirection::RTP_RX) |
+ static_cast<int32_t>(MediaDirection::RTCP_TX) |
+ static_cast<int32_t>(MediaDirection::RTCP_RX);
modifyRtpConfig.remoteAddress.ipAddress = "122.22.22.33";
modifyRtpConfig.remoteAddress.portNumber = 1234;
@@ -190,8 +197,10 @@
MediaQualityThreshold threshold;
RtpConfig modifyRtpConfig;
- modifyRtpConfig.direction =
- ::aidl::android::hardware::radio::ims::media::MediaDirection::SEND_RECEIVE;
+ modifyRtpConfig.direction = static_cast<int32_t>(MediaDirection::RTP_TX) |
+ static_cast<int32_t>(MediaDirection::RTP_RX) |
+ static_cast<int32_t>(MediaDirection::RTCP_TX) |
+ static_cast<int32_t>(MediaDirection::RTCP_RX);
modifyRtpConfig.remoteAddress.ipAddress = "122.22.22.33";
modifyRtpConfig.remoteAddress.portNumber = 1234;
@@ -243,13 +252,14 @@
localEndPoint.rtcpFd = ndk::ScopedFileDescriptor(mRtcpSocketFd);
localEndPoint.modemId = 1;
- rtpConfig.direction =
- ::aidl::android::hardware::radio::ims::media::MediaDirection::SEND_RECEIVE;
+ rtpConfig.direction = static_cast<int32_t>(MediaDirection::RTP_TX) |
+ static_cast<int32_t>(MediaDirection::RTP_RX) |
+ static_cast<int32_t>(MediaDirection::RTCP_TX) |
+ static_cast<int32_t>(MediaDirection::RTCP_RX);
rtpConfig.remoteAddress.ipAddress = "122.22.22.22";
rtpConfig.remoteAddress.portNumber = 2222;
result = radio_imsmedia->openSession(sessionId, localEndPoint, rtpConfig);
-
return result;
}
diff --git a/tv/tuner/1.0/default/Dvr.cpp b/tv/tuner/1.0/default/Dvr.cpp
index 40879f2..9d6d86d 100644
--- a/tv/tuner/1.0/default/Dvr.cpp
+++ b/tv/tuner/1.0/default/Dvr.cpp
@@ -164,7 +164,7 @@
return false;
}
- mDvrMQ = move(tmpDvrMQ);
+ mDvrMQ = std::move(tmpDvrMQ);
if (EventFlag::createEventFlag(mDvrMQ->getEventFlagWord(), &mDvrEventFlag) != OK) {
return false;
diff --git a/tv/tuner/1.1/default/Dvr.cpp b/tv/tuner/1.1/default/Dvr.cpp
index fdb66c1..8262b4d 100644
--- a/tv/tuner/1.1/default/Dvr.cpp
+++ b/tv/tuner/1.1/default/Dvr.cpp
@@ -183,7 +183,7 @@
return false;
}
- mDvrMQ = move(tmpDvrMQ);
+ mDvrMQ = std::move(tmpDvrMQ);
if (EventFlag::createEventFlag(mDvrMQ->getEventFlagWord(), &mDvrEventFlag) != OK) {
return false;
diff --git a/usb/gadget/1.1/default/lib/MonitorFfs.cpp b/usb/gadget/1.1/default/lib/MonitorFfs.cpp
index 0cdf038..6d09a8a 100644
--- a/usb/gadget/1.1/default/lib/MonitorFfs.cpp
+++ b/usb/gadget/1.1/default/lib/MonitorFfs.cpp
@@ -59,9 +59,9 @@
if (addEpollFd(epollFd, eventFd) == -1) abort();
- mEpollFd = move(epollFd);
- mInotifyFd = move(inotifyFd);
- mEventFd = move(eventFd);
+ mEpollFd = std::move(epollFd);
+ mInotifyFd = std::move(inotifyFd);
+ mEventFd = std::move(eventFd);
gadgetPullup = false;
}
diff --git a/usb/gadget/1.2/default/lib/MonitorFfs.cpp b/usb/gadget/1.2/default/lib/MonitorFfs.cpp
index 0cdf038..6d09a8a 100644
--- a/usb/gadget/1.2/default/lib/MonitorFfs.cpp
+++ b/usb/gadget/1.2/default/lib/MonitorFfs.cpp
@@ -59,9 +59,9 @@
if (addEpollFd(epollFd, eventFd) == -1) abort();
- mEpollFd = move(epollFd);
- mInotifyFd = move(inotifyFd);
- mEventFd = move(eventFd);
+ mEpollFd = std::move(epollFd);
+ mInotifyFd = std::move(inotifyFd);
+ mEventFd = std::move(eventFd);
gadgetPullup = false;
}
diff --git a/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorStatusCodes.aidl b/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorStatusCodes.aidl
index 2f534df..768ef8c 100644
--- a/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorStatusCodes.aidl
+++ b/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorStatusCodes.aidl
@@ -36,4 +36,5 @@
enum UwbVendorStatusCodes {
STATUS_ERROR_CCC_SE_BUSY = 80,
STATUS_ERROR_CCC_LIFECYCLE = 81,
+ STATUS_REGULATION_UWB_OFF = 82,
}
diff --git a/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorStatusCodes.aidl b/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorStatusCodes.aidl
index 8505b8a..f1eea9d 100644
--- a/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorStatusCodes.aidl
+++ b/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorStatusCodes.aidl
@@ -33,4 +33,6 @@
STATUS_ERROR_CCC_SE_BUSY = 0x50,
/** CCC Lifecycle error */
STATUS_ERROR_CCC_LIFECYCLE = 0x51,
+ /** UWB Regulation Off */
+ STATUS_REGULATION_UWB_OFF = 0x52,
}
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 8171572..e72c940 100644
--- a/wifi/aidl/android/hardware/wifi/NanBootstrappingConfirmInd.aidl
+++ b/wifi/aidl/android/hardware/wifi/NanBootstrappingConfirmInd.aidl
@@ -16,7 +16,6 @@
package android.hardware.wifi;
-import android.hardware.wifi.NanBootstrappingMethod;
import android.hardware.wifi.NanBootstrappingResponseCode;
import android.hardware.wifi.NanStatus;
@@ -47,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/NanBootstrappingRequest.aidl b/wifi/aidl/android/hardware/wifi/NanBootstrappingRequest.aidl
index d386f21..4836612 100644
--- a/wifi/aidl/android/hardware/wifi/NanBootstrappingRequest.aidl
+++ b/wifi/aidl/android/hardware/wifi/NanBootstrappingRequest.aidl
@@ -42,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/NanBootstrappingResponse.aidl b/wifi/aidl/android/hardware/wifi/NanBootstrappingResponse.aidl
index 1fec6b5..dbe8923 100644
--- a/wifi/aidl/android/hardware/wifi/NanBootstrappingResponse.aidl
+++ b/wifi/aidl/android/hardware/wifi/NanBootstrappingResponse.aidl
@@ -16,8 +16,6 @@
package android.hardware.wifi;
-import android.hardware.wifi.NanBootstrappingMethod;
-
/**
* See Wi-Fi Aware R4.0 section 9.5.21.7
*/
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/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 fd84505..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;
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;
}