Merge "Graphics interface libraries only exist for linux/Android" into main
diff --git a/audio/aidl/TEST_MAPPING b/audio/aidl/TEST_MAPPING
index e325001..26f4b3a 100644
--- a/audio/aidl/TEST_MAPPING
+++ b/audio/aidl/TEST_MAPPING
@@ -72,12 +72,7 @@
"name": "audiosystem_tests"
},
{
- "name": "CtsVirtualDevicesTestCases",
- "options" : [
- {
- "include-filter": "android.virtualdevice.cts.VirtualAudioTest"
- }
- ]
+ "name": "CtsVirtualDevicesAudioTestCases"
}
]
}
diff --git a/audio/aidl/default/Android.bp b/audio/aidl/default/Android.bp
index f51f65e..d47b0b1 100644
--- a/audio/aidl/default/Android.bp
+++ b/audio/aidl/default/Android.bp
@@ -77,6 +77,7 @@
"r_submix/ModuleRemoteSubmix.cpp",
"r_submix/SubmixRoute.cpp",
"r_submix/StreamRemoteSubmix.cpp",
+ "stub/DriverStubImpl.cpp",
"stub/ModuleStub.cpp",
"stub/StreamStub.cpp",
"usb/ModuleUsb.cpp",
diff --git a/audio/aidl/default/Configuration.cpp b/audio/aidl/default/Configuration.cpp
index 54e2d18..0ff8eb4 100644
--- a/audio/aidl/default/Configuration.cpp
+++ b/audio/aidl/default/Configuration.cpp
@@ -324,9 +324,9 @@
//
// Mix ports:
// * "r_submix output", maximum 10 opened streams, maximum 10 active streams
-// - profile PCM 16-bit; STEREO; 8000, 11025, 16000, 32000, 44100, 48000
+// - profile PCM 16-bit; STEREO; 8000, 11025, 16000, 32000, 44100, 48000, 192000
// * "r_submix input", maximum 10 opened streams, maximum 10 active streams
-// - profile PCM 16-bit; STEREO; 8000, 11025, 16000, 32000, 44100, 48000
+// - profile PCM 16-bit; STEREO; 8000, 11025, 16000, 32000, 44100, 48000, 192000
//
// Routes:
// "r_submix output" -> "Remote Submix Out"
@@ -337,7 +337,7 @@
Configuration c;
const std::vector<AudioProfile> remoteSubmixPcmAudioProfiles{
createProfile(PcmType::INT_16_BIT, {AudioChannelLayout::LAYOUT_STEREO},
- {8000, 11025, 16000, 32000, 44100, 48000})};
+ {8000, 11025, 16000, 32000, 44100, 48000, 192000})};
// Device ports
diff --git a/audio/aidl/default/EffectContext.cpp b/audio/aidl/default/EffectContext.cpp
index 5539177..26c88b2 100644
--- a/audio/aidl/default/EffectContext.cpp
+++ b/audio/aidl/default/EffectContext.cpp
@@ -63,13 +63,18 @@
}
void EffectContext::dupeFmqWithReopen(IEffect::OpenEffectReturn* effectRet) {
+ const size_t inBufferSizeInFloat = mCommon.input.frameCount * mInputFrameSize / sizeof(float);
+ const size_t outBufferSizeInFloat =
+ mCommon.output.frameCount * mOutputFrameSize / sizeof(float);
+ const size_t bufferSize = std::max(inBufferSizeInFloat, outBufferSizeInFloat);
if (!mInputMQ) {
- mInputMQ = std::make_shared<DataMQ>(mCommon.input.frameCount * mInputFrameSize /
- sizeof(float));
+ mInputMQ = std::make_shared<DataMQ>(inBufferSizeInFloat);
}
if (!mOutputMQ) {
- mOutputMQ = std::make_shared<DataMQ>(mCommon.output.frameCount * mOutputFrameSize /
- sizeof(float));
+ mOutputMQ = std::make_shared<DataMQ>(outBufferSizeInFloat);
+ }
+ if (mWorkBuffer.size() != bufferSize) {
+ mWorkBuffer.resize(bufferSize);
}
dupeFmq(effectRet);
}
@@ -222,8 +227,6 @@
}
if (needUpdateMq) {
- mWorkBuffer.resize(std::max(common.input.frameCount * mInputFrameSize / sizeof(float),
- common.output.frameCount * mOutputFrameSize / sizeof(float)));
return notifyDataMqUpdate();
}
return RetCode::SUCCESS;
diff --git a/audio/aidl/default/Module.cpp b/audio/aidl/default/Module.cpp
index c14d06e..45ce5ef 100644
--- a/audio/aidl/default/Module.cpp
+++ b/audio/aidl/default/Module.cpp
@@ -47,6 +47,7 @@
using aidl::android::media::audio::common::AudioDeviceType;
using aidl::android::media::audio::common::AudioFormatDescription;
using aidl::android::media::audio::common::AudioFormatType;
+using aidl::android::media::audio::common::AudioGainConfig;
using aidl::android::media::audio::common::AudioInputFlags;
using aidl::android::media::audio::common::AudioIoFlags;
using aidl::android::media::audio::common::AudioMMapPolicy;
@@ -1200,7 +1201,9 @@
}
if (in_requested.gain.has_value()) {
- // Let's pretend that gain can always be applied.
+ if (!setAudioPortConfigGain(*portIt, in_requested.gain.value())) {
+ return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT);
+ }
out_suggested->gain = in_requested.gain.value();
}
@@ -1242,6 +1245,52 @@
return ndk::ScopedAStatus::ok();
}
+bool Module::setAudioPortConfigGain(const AudioPort& port, const AudioGainConfig& gainRequested) {
+ auto& ports = getConfig().ports;
+ if (gainRequested.index < 0 || gainRequested.index >= (int)port.gains.size()) {
+ LOG(ERROR) << __func__ << ": gains for port " << port.id << " is undefined";
+ return false;
+ }
+ int stepValue = port.gains[gainRequested.index].stepValue;
+ if (stepValue == 0) {
+ LOG(ERROR) << __func__ << ": port gain step value is 0";
+ return false;
+ }
+ int minValue = port.gains[gainRequested.index].minValue;
+ int maxValue = port.gains[gainRequested.index].maxValue;
+ if (gainRequested.values[0] > maxValue || gainRequested.values[0] < minValue) {
+ LOG(ERROR) << __func__ << ": gain value " << gainRequested.values[0]
+ << " out of range of min and max gain config";
+ return false;
+ }
+ int gainIndex = (gainRequested.values[0] - minValue) / stepValue;
+ int totalSteps = (maxValue - minValue) / stepValue;
+ if (totalSteps == 0) {
+ LOG(ERROR) << __func__ << ": difference between port gain min value " << minValue
+ << " and max value " << maxValue << " is less than step value " << stepValue;
+ return false;
+ }
+ // Root-power quantities are used in curve:
+ // 10^((minMb / 100 + (maxMb / 100 - minMb / 100) * gainIndex / totalSteps) / (10 * 2))
+ // where 100 is the conversion from mB to dB, 10 comes from the log 10 conversion from power
+ // ratios, and 2 means are the square of amplitude.
+ float gain =
+ pow(10, (minValue + (maxValue - minValue) * (gainIndex / (float)totalSteps)) / 2000);
+ if (gain < 0) {
+ LOG(ERROR) << __func__ << ": gain " << gain << " is less than 0";
+ return false;
+ }
+ for (const auto& route : getConfig().routes) {
+ if (route.sinkPortId != port.id) {
+ continue;
+ }
+ for (const auto sourcePortId : route.sourcePortIds) {
+ mStreams.setGain(sourcePortId, gain);
+ }
+ }
+ return true;
+}
+
ndk::ScopedAStatus Module::resetAudioPatch(int32_t in_patchId) {
auto& patches = getConfig().patches;
auto patchIt = findById<AudioPatch>(patches, in_patchId);
diff --git a/audio/aidl/default/Stream.cpp b/audio/aidl/default/Stream.cpp
index eecc972..de66293 100644
--- a/audio/aidl/default/Stream.cpp
+++ b/audio/aidl/default/Stream.cpp
@@ -47,6 +47,17 @@
namespace aidl::android::hardware::audio::core {
+namespace {
+
+template <typename MQTypeError>
+auto fmqErrorHandler(const char* mqName) {
+ return [m = std::string(mqName)](MQTypeError fmqError, std::string&& errorMessage) {
+ CHECK_EQ(fmqError, MQTypeError::NONE) << m << ": " << errorMessage;
+ };
+}
+
+} // namespace
+
void StreamContext::fillDescriptor(StreamDescriptor* desc) {
if (mCommandMQ) {
desc->command = mCommandMQ->dupeDesc();
@@ -332,11 +343,7 @@
bool StreamInWorkerLogic::read(size_t clientSize, StreamDescriptor::Reply* reply) {
ATRACE_CALL();
StreamContext::DataMQ* const dataMQ = mContext->getDataMQ();
- StreamContext::DataMQ::Error fmqError = StreamContext::DataMQ::Error::NONE;
- std::string fmqErrorMsg;
- const size_t byteCount = std::min(
- {clientSize, dataMQ->availableToWrite(&fmqError, &fmqErrorMsg), mDataBufferSize});
- CHECK(fmqError == StreamContext::DataMQ::Error::NONE) << fmqErrorMsg;
+ const size_t byteCount = std::min({clientSize, dataMQ->availableToWrite(), mDataBufferSize});
const bool isConnected = mIsConnected;
const size_t frameSize = mContext->getFrameSize();
size_t actualFrameCount = 0;
@@ -612,10 +619,7 @@
bool StreamOutWorkerLogic::write(size_t clientSize, StreamDescriptor::Reply* reply) {
ATRACE_CALL();
StreamContext::DataMQ* const dataMQ = mContext->getDataMQ();
- StreamContext::DataMQ::Error fmqError = StreamContext::DataMQ::Error::NONE;
- std::string fmqErrorMsg;
- const size_t readByteCount = dataMQ->availableToRead(&fmqError, &fmqErrorMsg);
- CHECK(fmqError == StreamContext::DataMQ::Error::NONE) << fmqErrorMsg;
+ const size_t readByteCount = dataMQ->availableToRead();
const size_t frameSize = mContext->getFrameSize();
bool fatal = false;
int32_t latency = mContext->getNominalLatencyMs();
@@ -719,6 +723,14 @@
LOG(WARNING) << __func__ << ": invalid worker tid: " << workerTid;
}
}
+ getContext().getCommandMQ()->setErrorHandler(
+ fmqErrorHandler<StreamContext::CommandMQ::Error>("CommandMQ"));
+ getContext().getReplyMQ()->setErrorHandler(
+ fmqErrorHandler<StreamContext::ReplyMQ::Error>("ReplyMQ"));
+ if (getContext().getDataMQ() != nullptr) {
+ getContext().getDataMQ()->setErrorHandler(
+ fmqErrorHandler<StreamContext::DataMQ::Error>("DataMQ"));
+ }
return ndk::ScopedAStatus::ok();
}
@@ -843,6 +855,11 @@
return ndk::ScopedAStatus::ok();
}
+ndk::ScopedAStatus StreamCommonImpl::setGain(float gain) {
+ LOG(DEBUG) << __func__ << ": gain " << gain;
+ return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
+}
+
ndk::ScopedAStatus StreamCommonImpl::bluetoothParametersUpdated() {
LOG(DEBUG) << __func__;
return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
diff --git a/audio/aidl/default/StreamSwitcher.cpp b/audio/aidl/default/StreamSwitcher.cpp
index 8ba15a8..0052889 100644
--- a/audio/aidl/default/StreamSwitcher.cpp
+++ b/audio/aidl/default/StreamSwitcher.cpp
@@ -260,4 +260,12 @@
return mStream->bluetoothParametersUpdated();
}
+ndk::ScopedAStatus StreamSwitcher::setGain(float gain) {
+ if (mStream == nullptr) {
+ LOG(ERROR) << __func__ << ": stream was closed";
+ return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_STATE);
+ }
+ return mStream->setGain(gain);
+}
+
} // namespace aidl::android::hardware::audio::core
diff --git a/audio/aidl/default/alsa/StreamAlsa.cpp b/audio/aidl/default/alsa/StreamAlsa.cpp
index 372e38a..c77bfca 100644
--- a/audio/aidl/default/alsa/StreamAlsa.cpp
+++ b/audio/aidl/default/alsa/StreamAlsa.cpp
@@ -117,6 +117,7 @@
mReadWriteRetries);
maxLatency = proxy_get_latency(mAlsaDeviceProxies[0].get());
} else {
+ alsa::applyGain(buffer, mGain, bytesToTransfer, mConfig.value().format, mConfig->channels);
for (auto& proxy : mAlsaDeviceProxies) {
proxy_write_with_retries(proxy.get(), buffer, bytesToTransfer, mReadWriteRetries);
maxLatency = std::max(maxLatency, proxy_get_latency(proxy.get()));
@@ -166,4 +167,9 @@
mAlsaDeviceProxies.clear();
}
+ndk::ScopedAStatus StreamAlsa::setGain(float gain) {
+ mGain = gain;
+ return ndk::ScopedAStatus::ok();
+}
+
} // namespace aidl::android::hardware::audio::core
diff --git a/audio/aidl/default/alsa/Utils.cpp b/audio/aidl/default/alsa/Utils.cpp
index 8eaf162..10374f2 100644
--- a/audio/aidl/default/alsa/Utils.cpp
+++ b/audio/aidl/default/alsa/Utils.cpp
@@ -22,6 +22,8 @@
#include <aidl/android/media/audio/common/AudioFormatType.h>
#include <aidl/android/media/audio/common/PcmType.h>
#include <android-base/logging.h>
+#include <audio_utils/primitives.h>
+#include <cutils/compiler.h>
#include "Utils.h"
#include "core-impl/utils.h"
@@ -343,4 +345,68 @@
return findValueOrDefault(getAudioFormatDescriptorToPcmFormatMap(), aidl, PCM_FORMAT_INVALID);
}
+void applyGain(void* buffer, float gain, size_t bytesToTransfer, enum pcm_format pcmFormat,
+ int channelCount) {
+ if (channelCount != 1 && channelCount != 2) {
+ LOG(WARNING) << __func__ << ": unsupported channel count " << channelCount;
+ return;
+ }
+ if (!getPcmFormatToAudioFormatDescMap().contains(pcmFormat)) {
+ LOG(WARNING) << __func__ << ": unsupported pcm format " << pcmFormat;
+ return;
+ }
+ const float unityGainFloat = 1.0f;
+ if (std::abs(gain - unityGainFloat) < 1e-6) {
+ return;
+ }
+ int numFrames;
+ switch (pcmFormat) {
+ case PCM_FORMAT_S16_LE: {
+ const uint16_t unityGainQ4_12 = u4_12_from_float(unityGainFloat);
+ const uint16_t vl = u4_12_from_float(gain);
+ const uint32_t vrl = (vl << 16) | vl;
+ if (channelCount == 2) {
+ numFrames = bytesToTransfer / sizeof(uint32_t);
+ uint32_t* intBuffer = (uint32_t*)buffer;
+ if (CC_UNLIKELY(vl > unityGainQ4_12)) {
+ // volume is boosted, so we might need to clamp even though
+ // we process only one track.
+ do {
+ int32_t l = mulRL(1, *intBuffer, vrl) >> 12;
+ int32_t r = mulRL(0, *intBuffer, vrl) >> 12;
+ l = clamp16(l);
+ r = clamp16(r);
+ *intBuffer++ = (r << 16) | (l & 0xFFFF);
+ } while (--numFrames);
+ } else {
+ do {
+ int32_t l = mulRL(1, *intBuffer, vrl) >> 12;
+ int32_t r = mulRL(0, *intBuffer, vrl) >> 12;
+ *intBuffer++ = (r << 16) | (l & 0xFFFF);
+ } while (--numFrames);
+ }
+ } else {
+ numFrames = bytesToTransfer / sizeof(uint16_t);
+ int16_t* intBuffer = (int16_t*)buffer;
+ if (CC_UNLIKELY(vl > unityGainQ4_12)) {
+ // volume is boosted, so we might need to clamp even though
+ // we process only one track.
+ do {
+ int32_t mono = mulRL(1, *intBuffer, vrl) >> 12;
+ *intBuffer++ = clamp16(mono);
+ } while (--numFrames);
+ } else {
+ do {
+ int32_t mono = mulRL(1, *intBuffer, vrl) >> 12;
+ *intBuffer++ = static_cast<int16_t>(mono & 0xFFFF);
+ } while (--numFrames);
+ }
+ }
+ } break;
+ default:
+ // TODO(336370745): Implement gain for other supported formats
+ break;
+ }
+}
+
} // namespace aidl::android::hardware::audio::core::alsa
diff --git a/audio/aidl/default/alsa/Utils.h b/audio/aidl/default/alsa/Utils.h
index 980f685..a97ea10 100644
--- a/audio/aidl/default/alsa/Utils.h
+++ b/audio/aidl/default/alsa/Utils.h
@@ -59,6 +59,8 @@
AlsaProxy mProxy;
};
+void applyGain(void* buffer, float gain, size_t bytesToTransfer, enum pcm_format pcmFormat,
+ int channelCount);
::aidl::android::media::audio::common::AudioChannelLayout getChannelLayoutMaskFromChannelCount(
unsigned int channelCount, int isInput);
::aidl::android::media::audio::common::AudioChannelLayout getChannelIndexMaskFromChannelCount(
diff --git a/audio/aidl/default/config/audioPolicy/api/current.txt b/audio/aidl/default/config/audioPolicy/api/current.txt
index 3547f54..e57c108 100644
--- a/audio/aidl/default/config/audioPolicy/api/current.txt
+++ b/audio/aidl/default/config/audioPolicy/api/current.txt
@@ -191,6 +191,7 @@
enum_constant public static final android.audio.policy.configuration.AudioFormat AUDIO_FORMAT_AAC_XHE;
enum_constant public static final android.audio.policy.configuration.AudioFormat AUDIO_FORMAT_AC3;
enum_constant public static final android.audio.policy.configuration.AudioFormat AUDIO_FORMAT_AC4;
+ enum_constant public static final android.audio.policy.configuration.AudioFormat AUDIO_FORMAT_AC4_L4;
enum_constant public static final android.audio.policy.configuration.AudioFormat AUDIO_FORMAT_ALAC;
enum_constant public static final android.audio.policy.configuration.AudioFormat AUDIO_FORMAT_AMR_NB;
enum_constant public static final android.audio.policy.configuration.AudioFormat AUDIO_FORMAT_AMR_WB;
diff --git a/audio/aidl/default/config/audioPolicy/audio_policy_configuration.xsd b/audio/aidl/default/config/audioPolicy/audio_policy_configuration.xsd
index d93f697..108a6a3 100644
--- a/audio/aidl/default/config/audioPolicy/audio_policy_configuration.xsd
+++ b/audio/aidl/default/config/audioPolicy/audio_policy_configuration.xsd
@@ -389,6 +389,7 @@
<xs:enumeration value="AUDIO_FORMAT_APTX"/>
<xs:enumeration value="AUDIO_FORMAT_APTX_HD"/>
<xs:enumeration value="AUDIO_FORMAT_AC4"/>
+ <xs:enumeration value="AUDIO_FORMAT_AC4_L4"/>
<xs:enumeration value="AUDIO_FORMAT_LDAC"/>
<xs:enumeration value="AUDIO_FORMAT_MAT"/>
<xs:enumeration value="AUDIO_FORMAT_MAT_1_0"/>
diff --git a/audio/aidl/default/include/core-impl/DriverStubImpl.h b/audio/aidl/default/include/core-impl/DriverStubImpl.h
new file mode 100644
index 0000000..40a9fea
--- /dev/null
+++ b/audio/aidl/default/include/core-impl/DriverStubImpl.h
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2024 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#include "core-impl/Stream.h"
+
+namespace aidl::android::hardware::audio::core {
+
+class DriverStubImpl : virtual public DriverInterface {
+ public:
+ explicit DriverStubImpl(const StreamContext& context);
+
+ ::android::status_t init() override;
+ ::android::status_t drain(StreamDescriptor::DrainMode) override;
+ ::android::status_t flush() override;
+ ::android::status_t pause() override;
+ ::android::status_t standby() override;
+ ::android::status_t start() override;
+ ::android::status_t transfer(void* buffer, size_t frameCount, size_t* actualFrameCount,
+ int32_t* latencyMs) override;
+ void shutdown() override;
+
+ private:
+ const size_t mBufferSizeFrames;
+ const size_t mFrameSizeBytes;
+ const int mSampleRate;
+ const bool mIsAsynchronous;
+ const bool mIsInput;
+ bool mIsInitialized = false; // Used for validating the state machine logic.
+ bool mIsStandby = true; // Used for validating the state machine logic.
+ int64_t mStartTimeNs = 0;
+ long mFramesSinceStart = 0;
+};
+
+} // namespace aidl::android::hardware::audio::core
diff --git a/audio/aidl/default/include/core-impl/Module.h b/audio/aidl/default/include/core-impl/Module.h
index 00eeb4e..8548aff 100644
--- a/audio/aidl/default/include/core-impl/Module.h
+++ b/audio/aidl/default/include/core-impl/Module.h
@@ -263,6 +263,9 @@
::aidl::android::media::audio::common::AudioPortConfig* out_suggested, bool* applied);
ndk::ScopedAStatus updateStreamsConnectedState(const AudioPatch& oldPatch,
const AudioPatch& newPatch);
+ bool setAudioPortConfigGain(
+ const ::aidl::android::media::audio::common::AudioPort& port,
+ const ::aidl::android::media::audio::common::AudioGainConfig& gainRequested);
};
std::ostream& operator<<(std::ostream& os, Module::Type t);
diff --git a/audio/aidl/default/include/core-impl/Stream.h b/audio/aidl/default/include/core-impl/Stream.h
index 100b4c8..f7b9269 100644
--- a/audio/aidl/default/include/core-impl/Stream.h
+++ b/audio/aidl/default/include/core-impl/Stream.h
@@ -38,6 +38,7 @@
#include <aidl/android/media/audio/common/AudioIoFlags.h>
#include <aidl/android/media/audio/common/AudioOffloadInfo.h>
#include <aidl/android/media/audio/common/MicrophoneInfo.h>
+#include <android-base/thread_annotations.h>
#include <error/expected_utils.h>
#include <fmq/AidlMessageQueue.h>
#include <system/thread_defs.h>
@@ -132,6 +133,9 @@
ReplyMQ* getReplyMQ() const { return mReplyMQ.get(); }
int getTransientStateDelayMs() const { return mDebugParameters.transientStateDelayMs; }
int getSampleRate() const { return mSampleRate; }
+ bool isInput() const {
+ return mFlags.getTag() == ::aidl::android::media::audio::common::AudioIoFlags::input;
+ }
bool isValid() const;
// 'reset' is called on a Binder thread when closing the stream. Does not use
// locking because it only cleans MQ pointers which were also set on the Binder thread.
@@ -342,6 +346,7 @@
virtual ndk::ScopedAStatus setConnectedDevices(
const std::vector<::aidl::android::media::audio::common::AudioDevice>& devices) = 0;
virtual ndk::ScopedAStatus bluetoothParametersUpdated() = 0;
+ virtual ndk::ScopedAStatus setGain(float gain) = 0;
};
// This is equivalent to automatically generated 'IStreamCommonDelegator' but uses
@@ -443,6 +448,7 @@
const std::vector<::aidl::android::media::audio::common::AudioDevice>& devices)
override;
ndk::ScopedAStatus bluetoothParametersUpdated() override;
+ ndk::ScopedAStatus setGain(float gain) override;
protected:
static StreamWorkerInterface::CreateInstance getDefaultInWorkerCreator() {
@@ -609,6 +615,12 @@
return ndk::ScopedAStatus::ok();
}
+ ndk::ScopedAStatus setGain(float gain) {
+ auto s = mStream.lock();
+ if (s) return s->setGain(gain);
+ return ndk::ScopedAStatus::ok();
+ }
+
private:
std::weak_ptr<StreamCommonInterface> mStream;
ndk::SpAIBinder mStreamBinder;
@@ -644,6 +656,12 @@
return isOk ? ndk::ScopedAStatus::ok()
: ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
}
+ ndk::ScopedAStatus setGain(int32_t portId, float gain) {
+ if (auto it = mStreams.find(portId); it != mStreams.end()) {
+ return it->second.setGain(gain);
+ }
+ return ndk::ScopedAStatus::ok();
+ }
private:
// Maps port ids and port config ids to streams. Multimap because a port
diff --git a/audio/aidl/default/include/core-impl/StreamAlsa.h b/audio/aidl/default/include/core-impl/StreamAlsa.h
index 0356946..8bdf208 100644
--- a/audio/aidl/default/include/core-impl/StreamAlsa.h
+++ b/audio/aidl/default/include/core-impl/StreamAlsa.h
@@ -45,6 +45,7 @@
int32_t* latencyMs) override;
::android::status_t refinePosition(StreamDescriptor::Position* position) override;
void shutdown() override;
+ ndk::ScopedAStatus setGain(float gain) override;
protected:
// Called from 'start' to initialize 'mAlsaDeviceProxies', the vector must be non-empty.
@@ -58,6 +59,9 @@
const int mReadWriteRetries;
// All fields below are only used on the worker thread.
std::vector<alsa::DeviceProxy> mAlsaDeviceProxies;
+
+ private:
+ std::atomic<float> mGain = 1.0;
};
} // namespace aidl::android::hardware::audio::core
diff --git a/audio/aidl/default/include/core-impl/StreamPrimary.h b/audio/aidl/default/include/core-impl/StreamPrimary.h
index 600c377..4f19a46 100644
--- a/audio/aidl/default/include/core-impl/StreamPrimary.h
+++ b/audio/aidl/default/include/core-impl/StreamPrimary.h
@@ -16,25 +16,39 @@
#pragma once
+#include <mutex>
#include <vector>
+#include <android-base/thread_annotations.h>
+
+#include "DriverStubImpl.h"
#include "StreamAlsa.h"
-#include "StreamSwitcher.h"
+#include "primary/PrimaryMixer.h"
namespace aidl::android::hardware::audio::core {
class StreamPrimary : public StreamAlsa {
public:
- StreamPrimary(StreamContext* context, const Metadata& metadata,
- const std::vector<::aidl::android::media::audio::common::AudioDevice>& devices);
+ StreamPrimary(StreamContext* context, const Metadata& metadata);
+ // Methods of 'DriverInterface'.
+ ::android::status_t init() override;
+ ::android::status_t drain(StreamDescriptor::DrainMode mode) override;
+ ::android::status_t flush() override;
+ ::android::status_t pause() override;
+ ::android::status_t standby() override;
::android::status_t start() override;
::android::status_t transfer(void* buffer, size_t frameCount, size_t* actualFrameCount,
int32_t* latencyMs) override;
::android::status_t refinePosition(StreamDescriptor::Position* position) override;
+ void shutdown() override;
+
+ // Overridden methods of 'StreamCommonImpl', called on a Binder thread.
+ ndk::ScopedAStatus setConnectedDevices(const ConnectedDevices& devices) override;
protected:
std::vector<alsa::DeviceProfile> getDeviceProfiles() override;
+ bool isStubStream();
const bool mIsAsynchronous;
int64_t mStartTimeNs = 0;
@@ -42,12 +56,29 @@
bool mSkipNextTransfer = false;
private:
- static std::pair<int, int> getCardAndDeviceId(
+ using AlsaDeviceId = std::pair<int, int>;
+
+ static constexpr StreamPrimary::AlsaDeviceId kDefaultCardAndDeviceId{
+ primary::PrimaryMixer::kAlsaCard, primary::PrimaryMixer::kAlsaDevice};
+ static constexpr StreamPrimary::AlsaDeviceId kStubDeviceId{
+ primary::PrimaryMixer::kInvalidAlsaCard, primary::PrimaryMixer::kInvalidAlsaDevice};
+
+ static AlsaDeviceId getCardAndDeviceId(
const std::vector<::aidl::android::media::audio::common::AudioDevice>& devices);
- const std::pair<int, int> mCardAndDeviceId;
+ static bool useStubStream(bool isInput,
+ const ::aidl::android::media::audio::common::AudioDevice& device);
+
+ bool isStubStreamOnWorker() const { return mCurrAlsaDeviceId == kStubDeviceId; }
+
+ DriverStubImpl mStubDriver;
+ mutable std::mutex mLock;
+ AlsaDeviceId mAlsaDeviceId GUARDED_BY(mLock) = kStubDeviceId;
+
+ // Used by the worker thread only.
+ AlsaDeviceId mCurrAlsaDeviceId = kStubDeviceId;
};
-class StreamInPrimary final : public StreamIn, public StreamSwitcher, public StreamInHwGainHelper {
+class StreamInPrimary final : public StreamIn, public StreamPrimary, public StreamInHwGainHelper {
public:
friend class ndk::SharedRefBase;
StreamInPrimary(
@@ -56,14 +87,6 @@
const std::vector<::aidl::android::media::audio::common::MicrophoneInfo>& microphones);
private:
- static bool useStubStream(const ::aidl::android::media::audio::common::AudioDevice& device);
-
- DeviceSwitchBehavior switchCurrentStream(
- const std::vector<::aidl::android::media::audio::common::AudioDevice>& devices)
- override;
- std::unique_ptr<StreamCommonInterfaceEx> createNewStream(
- const std::vector<::aidl::android::media::audio::common::AudioDevice>& devices,
- StreamContext* context, const Metadata& metadata) override;
void onClose(StreamDescriptor::State) override { defaultOnClose(); }
ndk::ScopedAStatus getHwGain(std::vector<float>* _aidl_return) override;
@@ -71,7 +94,7 @@
};
class StreamOutPrimary final : public StreamOut,
- public StreamSwitcher,
+ public StreamPrimary,
public StreamOutHwVolumeHelper {
public:
friend class ndk::SharedRefBase;
@@ -81,22 +104,10 @@
offloadInfo);
private:
- static bool useStubStream(const ::aidl::android::media::audio::common::AudioDevice& device);
-
- DeviceSwitchBehavior switchCurrentStream(
- const std::vector<::aidl::android::media::audio::common::AudioDevice>& devices)
- override;
- std::unique_ptr<StreamCommonInterfaceEx> createNewStream(
- const std::vector<::aidl::android::media::audio::common::AudioDevice>& devices,
- StreamContext* context, const Metadata& metadata) override;
void onClose(StreamDescriptor::State) override { defaultOnClose(); }
ndk::ScopedAStatus getHwVolume(std::vector<float>* _aidl_return) override;
ndk::ScopedAStatus setHwVolume(const std::vector<float>& in_channelVolumes) override;
-
- ndk::ScopedAStatus setConnectedDevices(
- const std::vector<::aidl::android::media::audio::common::AudioDevice>& devices)
- override;
};
} // namespace aidl::android::hardware::audio::core
diff --git a/audio/aidl/default/include/core-impl/StreamRemoteSubmix.h b/audio/aidl/default/include/core-impl/StreamRemoteSubmix.h
index 6ea7968..e78e8b7 100644
--- a/audio/aidl/default/include/core-impl/StreamRemoteSubmix.h
+++ b/audio/aidl/default/include/core-impl/StreamRemoteSubmix.h
@@ -16,19 +16,18 @@
#pragma once
+#include <atomic>
+#include <mutex>
#include <vector>
#include "core-impl/Stream.h"
-#include "core-impl/StreamSwitcher.h"
#include "r_submix/SubmixRoute.h"
namespace aidl::android::hardware::audio::core {
class StreamRemoteSubmix : public StreamCommonImpl {
public:
- StreamRemoteSubmix(
- StreamContext* context, const Metadata& metadata,
- const ::aidl::android::media::audio::common::AudioDeviceAddress& deviceAddress);
+ StreamRemoteSubmix(StreamContext* context, const Metadata& metadata);
~StreamRemoteSubmix();
// Methods of 'DriverInterface'.
@@ -45,17 +44,18 @@
// Overridden methods of 'StreamCommonImpl', called on a Binder thread.
ndk::ScopedAStatus prepareToClose() override;
+ ndk::ScopedAStatus setConnectedDevices(const ConnectedDevices& devices) override;
private:
long getDelayInUsForFrameCount(size_t frameCount);
+ ::aidl::android::media::audio::common::AudioDeviceAddress getDeviceAddress() const {
+ std::lock_guard guard(mLock);
+ return mDeviceAddress;
+ }
size_t getStreamPipeSizeInFrames();
- ::android::status_t outWrite(void* buffer, size_t frameCount, size_t* actualFrameCount);
::android::status_t inRead(void* buffer, size_t frameCount, size_t* actualFrameCount);
-
- const ::aidl::android::media::audio::common::AudioDeviceAddress mDeviceAddress;
- const bool mIsInput;
- r_submix::AudioConfig mStreamConfig;
- std::shared_ptr<r_submix::SubmixRoute> mCurrentRoute = nullptr;
+ ::android::status_t outWrite(void* buffer, size_t frameCount, size_t* actualFrameCount);
+ ::android::status_t setCurrentRoute();
// Limit for the number of error log entries to avoid spamming the logs.
static constexpr int kMaxErrorLogs = 5;
@@ -66,6 +66,15 @@
// 5ms between two read attempts when pipe is empty
static constexpr int kReadAttemptSleepUs = 5000;
+ const bool mIsInput;
+ const r_submix::AudioConfig mStreamConfig;
+
+ mutable std::mutex mLock;
+ ::aidl::android::media::audio::common::AudioDeviceAddress mDeviceAddress GUARDED_BY(mLock);
+ std::atomic<bool> mDeviceAddressUpdated = false;
+
+ // Used by the worker thread only.
+ std::shared_ptr<r_submix::SubmixRoute> mCurrentRoute = nullptr;
int64_t mStartTimeNs = 0;
long mFramesSinceStart = 0;
int mReadErrorCount = 0;
@@ -73,7 +82,7 @@
int mWriteShutdownCount = 0;
};
-class StreamInRemoteSubmix final : public StreamIn, public StreamSwitcher {
+class StreamInRemoteSubmix final : public StreamIn, public StreamRemoteSubmix {
public:
friend class ndk::SharedRefBase;
StreamInRemoteSubmix(
@@ -82,19 +91,13 @@
const std::vector<::aidl::android::media::audio::common::MicrophoneInfo>& microphones);
private:
- DeviceSwitchBehavior switchCurrentStream(
- const std::vector<::aidl::android::media::audio::common::AudioDevice>& devices)
- override;
- std::unique_ptr<StreamCommonInterfaceEx> createNewStream(
- const std::vector<::aidl::android::media::audio::common::AudioDevice>& devices,
- StreamContext* context, const Metadata& metadata) override;
void onClose(StreamDescriptor::State) override { defaultOnClose(); }
ndk::ScopedAStatus getActiveMicrophones(
std::vector<::aidl::android::media::audio::common::MicrophoneDynamicInfo>* _aidl_return)
override;
};
-class StreamOutRemoteSubmix final : public StreamOut, public StreamSwitcher {
+class StreamOutRemoteSubmix final : public StreamOut, public StreamRemoteSubmix {
public:
friend class ndk::SharedRefBase;
StreamOutRemoteSubmix(
@@ -104,12 +107,6 @@
offloadInfo);
private:
- DeviceSwitchBehavior switchCurrentStream(
- const std::vector<::aidl::android::media::audio::common::AudioDevice>& devices)
- override;
- std::unique_ptr<StreamCommonInterfaceEx> createNewStream(
- const std::vector<::aidl::android::media::audio::common::AudioDevice>& devices,
- StreamContext* context, const Metadata& metadata) override;
void onClose(StreamDescriptor::State) override { defaultOnClose(); }
};
diff --git a/audio/aidl/default/include/core-impl/StreamStub.h b/audio/aidl/default/include/core-impl/StreamStub.h
index 22b2020..cee44db 100644
--- a/audio/aidl/default/include/core-impl/StreamStub.h
+++ b/audio/aidl/default/include/core-impl/StreamStub.h
@@ -16,38 +16,15 @@
#pragma once
+#include "core-impl/DriverStubImpl.h"
#include "core-impl/Stream.h"
namespace aidl::android::hardware::audio::core {
-class StreamStub : public StreamCommonImpl {
+class StreamStub : public StreamCommonImpl, public DriverStubImpl {
public:
StreamStub(StreamContext* context, const Metadata& metadata);
~StreamStub();
-
- // Methods of 'DriverInterface'.
- ::android::status_t init() override;
- ::android::status_t drain(StreamDescriptor::DrainMode) override;
- ::android::status_t flush() override;
- ::android::status_t pause() override;
- ::android::status_t standby() override;
- ::android::status_t start() override;
- ::android::status_t transfer(void* buffer, size_t frameCount, size_t* actualFrameCount,
- int32_t* latencyMs) override;
- void shutdown() override;
-
- private:
- const size_t mBufferSizeFrames;
- const size_t mFrameSizeBytes;
- const int mSampleRate;
- const bool mIsAsynchronous;
- const bool mIsInput;
- bool mIsInitialized = false; // Used for validating the state machine logic.
- bool mIsStandby = true; // Used for validating the state machine logic.
-
- // Used by the worker thread.
- int64_t mStartTimeNs = 0;
- long mFramesSinceStart = 0;
};
class StreamInStub final : public StreamIn, public StreamStub {
diff --git a/audio/aidl/default/include/core-impl/StreamSwitcher.h b/audio/aidl/default/include/core-impl/StreamSwitcher.h
index 5764ad6..2d75e85 100644
--- a/audio/aidl/default/include/core-impl/StreamSwitcher.h
+++ b/audio/aidl/default/include/core-impl/StreamSwitcher.h
@@ -130,6 +130,7 @@
const std::vector<::aidl::android::media::audio::common::AudioDevice>& devices)
override;
ndk::ScopedAStatus bluetoothParametersUpdated() override;
+ ndk::ScopedAStatus setGain(float gain) override;
protected:
// Since switching a stream requires closing down the current stream, StreamSwitcher
diff --git a/audio/aidl/default/primary/PrimaryMixer.h b/audio/aidl/default/primary/PrimaryMixer.h
index 3806428..760d42f 100644
--- a/audio/aidl/default/primary/PrimaryMixer.h
+++ b/audio/aidl/default/primary/PrimaryMixer.h
@@ -16,20 +16,14 @@
#pragma once
-#include <map>
-#include <memory>
-#include <mutex>
-#include <vector>
-
-#include <android-base/thread_annotations.h>
-#include <android/binder_auto_utils.h>
-
#include "alsa/Mixer.h"
namespace aidl::android::hardware::audio::core::primary {
class PrimaryMixer : public alsa::Mixer {
public:
+ static constexpr int kInvalidAlsaCard = -1;
+ static constexpr int kInvalidAlsaDevice = -1;
static constexpr int kAlsaCard = 0;
static constexpr int kAlsaDevice = 0;
diff --git a/audio/aidl/default/primary/StreamPrimary.cpp b/audio/aidl/default/primary/StreamPrimary.cpp
index 801bbb8..1176d05 100644
--- a/audio/aidl/default/primary/StreamPrimary.cpp
+++ b/audio/aidl/default/primary/StreamPrimary.cpp
@@ -25,9 +25,7 @@
#include <error/Result.h>
#include <error/expected_utils.h>
-#include "PrimaryMixer.h"
#include "core-impl/StreamPrimary.h"
-#include "core-impl/StreamStub.h"
using aidl::android::hardware::audio::common::SinkMetadata;
using aidl::android::hardware::audio::common::SourceMetadata;
@@ -41,19 +39,49 @@
namespace aidl::android::hardware::audio::core {
-const static constexpr std::pair<int, int> kDefaultCardAndDeviceId = {
- primary::PrimaryMixer::kAlsaCard, primary::PrimaryMixer::kAlsaDevice};
-
-StreamPrimary::StreamPrimary(
- StreamContext* context, const Metadata& metadata,
- const std::vector<::aidl::android::media::audio::common::AudioDevice>& devices)
+StreamPrimary::StreamPrimary(StreamContext* context, const Metadata& metadata)
: StreamAlsa(context, metadata, 3 /*readWriteRetries*/),
mIsAsynchronous(!!getContext().getAsyncCallback()),
- mCardAndDeviceId(getCardAndDeviceId(devices)) {
+ mStubDriver(getContext()) {
context->startStreamDataProcessor();
}
+::android::status_t StreamPrimary::init() {
+ RETURN_STATUS_IF_ERROR(mStubDriver.init());
+ return StreamAlsa::init();
+}
+
+::android::status_t StreamPrimary::drain(StreamDescriptor::DrainMode mode) {
+ return isStubStreamOnWorker() ? mStubDriver.drain(mode) : StreamAlsa::drain(mode);
+}
+
+::android::status_t StreamPrimary::flush() {
+ return isStubStreamOnWorker() ? mStubDriver.flush() : StreamAlsa::flush();
+}
+
+::android::status_t StreamPrimary::pause() {
+ return isStubStreamOnWorker() ? mStubDriver.pause() : StreamAlsa::pause();
+}
+
+::android::status_t StreamPrimary::standby() {
+ return isStubStreamOnWorker() ? mStubDriver.standby() : StreamAlsa::standby();
+}
+
::android::status_t StreamPrimary::start() {
+ bool isStub = true, shutdownAlsaStream = false;
+ {
+ std::lock_guard l(mLock);
+ isStub = mAlsaDeviceId == kStubDeviceId;
+ shutdownAlsaStream =
+ mCurrAlsaDeviceId != mAlsaDeviceId && mCurrAlsaDeviceId != kStubDeviceId;
+ mCurrAlsaDeviceId = mAlsaDeviceId;
+ }
+ if (shutdownAlsaStream) {
+ StreamAlsa::shutdown(); // Close currently opened ALSA devices.
+ }
+ if (isStub) {
+ return mStubDriver.start();
+ }
RETURN_STATUS_IF_ERROR(StreamAlsa::start());
mStartTimeNs = ::android::uptimeNanos();
mFramesSinceStart = 0;
@@ -63,6 +91,9 @@
::android::status_t StreamPrimary::transfer(void* buffer, size_t frameCount,
size_t* actualFrameCount, int32_t* latencyMs) {
+ if (isStubStreamOnWorker()) {
+ return mStubDriver.transfer(buffer, frameCount, actualFrameCount, latencyMs);
+ }
// This is a workaround for the emulator implementation which has a host-side buffer
// and is not being able to achieve real-time behavior similar to ADSPs (b/302587331).
if (!mSkipNextTransfer) {
@@ -102,19 +133,52 @@
return ::android::OK;
}
+void StreamPrimary::shutdown() {
+ StreamAlsa::shutdown();
+ mStubDriver.shutdown();
+}
+
+ndk::ScopedAStatus StreamPrimary::setConnectedDevices(const ConnectedDevices& devices) {
+ LOG(DEBUG) << __func__ << ": " << ::android::internal::ToString(devices);
+ if (devices.size() > 1) {
+ LOG(ERROR) << __func__ << ": primary stream can only be connected to one device, got: "
+ << devices.size();
+ return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
+ }
+ {
+ const bool useStubDriver = devices.empty() || useStubStream(mIsInput, devices[0]);
+ std::lock_guard l(mLock);
+ mAlsaDeviceId = useStubDriver ? kStubDeviceId : getCardAndDeviceId(devices);
+ }
+ if (!devices.empty()) {
+ auto streamDataProcessor = getContext().getStreamDataProcessor().lock();
+ if (streamDataProcessor != nullptr) {
+ streamDataProcessor->setAudioDevice(devices[0]);
+ }
+ }
+ return StreamAlsa::setConnectedDevices(devices);
+}
+
std::vector<alsa::DeviceProfile> StreamPrimary::getDeviceProfiles() {
- return {alsa::DeviceProfile{.card = mCardAndDeviceId.first,
- .device = mCardAndDeviceId.second,
+ return {alsa::DeviceProfile{.card = mCurrAlsaDeviceId.first,
+ .device = mCurrAlsaDeviceId.second,
.direction = mIsInput ? PCM_IN : PCM_OUT,
.isExternal = false}};
}
-std::pair<int, int> StreamPrimary::getCardAndDeviceId(const std::vector<AudioDevice>& devices) {
+bool StreamPrimary::isStubStream() {
+ std::lock_guard l(mLock);
+ return mAlsaDeviceId == kStubDeviceId;
+}
+
+// static
+StreamPrimary::AlsaDeviceId StreamPrimary::getCardAndDeviceId(
+ const std::vector<AudioDevice>& devices) {
if (devices.empty() || devices[0].address.getTag() != AudioDeviceAddress::id) {
return kDefaultCardAndDeviceId;
}
std::string deviceAddress = devices[0].address.get<AudioDeviceAddress::id>();
- std::pair<int, int> cardAndDeviceId;
+ AlsaDeviceId cardAndDeviceId;
if (const size_t suffixPos = deviceAddress.rfind("CARD_");
suffixPos == std::string::npos ||
sscanf(deviceAddress.c_str() + suffixPos, "CARD_%d_DEV_%d", &cardAndDeviceId.first,
@@ -126,48 +190,28 @@
return cardAndDeviceId;
}
+// static
+bool StreamPrimary::useStubStream(
+ bool isInput, const ::aidl::android::media::audio::common::AudioDevice& device) {
+ static const bool kSimulateInput =
+ GetBoolProperty("ro.boot.audio.tinyalsa.simulate_input", false);
+ static const bool kSimulateOutput =
+ GetBoolProperty("ro.boot.audio.tinyalsa.ignore_output", false);
+ if (isInput) {
+ return kSimulateInput || device.type.type == AudioDeviceType::IN_TELEPHONY_RX ||
+ device.type.type == AudioDeviceType::IN_FM_TUNER ||
+ device.type.connection == AudioDeviceDescription::CONNECTION_BUS /*deprecated */;
+ }
+ return kSimulateOutput || device.type.type == AudioDeviceType::OUT_TELEPHONY_TX ||
+ device.type.connection == AudioDeviceDescription::CONNECTION_BUS /*deprecated*/;
+}
+
StreamInPrimary::StreamInPrimary(StreamContext&& context, const SinkMetadata& sinkMetadata,
const std::vector<MicrophoneInfo>& microphones)
: StreamIn(std::move(context), microphones),
- StreamSwitcher(&mContextInstance, sinkMetadata),
+ StreamPrimary(&mContextInstance, sinkMetadata),
StreamInHwGainHelper(&mContextInstance) {}
-bool StreamInPrimary::useStubStream(const AudioDevice& device) {
- static const bool kSimulateInput =
- GetBoolProperty("ro.boot.audio.tinyalsa.simulate_input", false);
- return kSimulateInput || device.type.type == AudioDeviceType::IN_TELEPHONY_RX ||
- device.type.type == AudioDeviceType::IN_FM_TUNER ||
- device.type.connection == AudioDeviceDescription::CONNECTION_BUS /*deprecated */;
-}
-
-StreamSwitcher::DeviceSwitchBehavior StreamInPrimary::switchCurrentStream(
- const std::vector<::aidl::android::media::audio::common::AudioDevice>& devices) {
- LOG(DEBUG) << __func__;
- if (devices.size() > 1) {
- LOG(ERROR) << __func__ << ": primary stream can only be connected to one device, got: "
- << devices.size();
- return DeviceSwitchBehavior::UNSUPPORTED_DEVICES;
- }
- if (devices.empty() || useStubStream(devices[0]) == isStubStream()) {
- return DeviceSwitchBehavior::USE_CURRENT_STREAM;
- }
- return DeviceSwitchBehavior::CREATE_NEW_STREAM;
-}
-
-std::unique_ptr<StreamCommonInterfaceEx> StreamInPrimary::createNewStream(
- const std::vector<::aidl::android::media::audio::common::AudioDevice>& devices,
- StreamContext* context, const Metadata& metadata) {
- if (devices.empty()) {
- LOG(FATAL) << __func__ << ": called with empty devices"; // see 'switchCurrentStream'
- }
- if (useStubStream(devices[0])) {
- return std::unique_ptr<StreamCommonInterfaceEx>(
- new InnerStreamWrapper<StreamStub>(context, metadata));
- }
- return std::unique_ptr<StreamCommonInterfaceEx>(
- new InnerStreamWrapper<StreamPrimary>(context, metadata, devices));
-}
-
ndk::ScopedAStatus StreamInPrimary::getHwGain(std::vector<float>* _aidl_return) {
if (isStubStream()) {
return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
@@ -201,44 +245,9 @@
StreamOutPrimary::StreamOutPrimary(StreamContext&& context, const SourceMetadata& sourceMetadata,
const std::optional<AudioOffloadInfo>& offloadInfo)
: StreamOut(std::move(context), offloadInfo),
- StreamSwitcher(&mContextInstance, sourceMetadata),
+ StreamPrimary(&mContextInstance, sourceMetadata),
StreamOutHwVolumeHelper(&mContextInstance) {}
-bool StreamOutPrimary::useStubStream(const AudioDevice& device) {
- static const bool kSimulateOutput =
- GetBoolProperty("ro.boot.audio.tinyalsa.ignore_output", false);
- return kSimulateOutput || device.type.type == AudioDeviceType::OUT_TELEPHONY_TX ||
- device.type.connection == AudioDeviceDescription::CONNECTION_BUS /*deprecated*/;
-}
-
-StreamSwitcher::DeviceSwitchBehavior StreamOutPrimary::switchCurrentStream(
- const std::vector<::aidl::android::media::audio::common::AudioDevice>& devices) {
- LOG(DEBUG) << __func__;
- if (devices.size() > 1) {
- LOG(ERROR) << __func__ << ": primary stream can only be connected to one device, got: "
- << devices.size();
- return DeviceSwitchBehavior::UNSUPPORTED_DEVICES;
- }
- if (devices.empty() || useStubStream(devices[0]) == isStubStream()) {
- return DeviceSwitchBehavior::USE_CURRENT_STREAM;
- }
- return DeviceSwitchBehavior::CREATE_NEW_STREAM;
-}
-
-std::unique_ptr<StreamCommonInterfaceEx> StreamOutPrimary::createNewStream(
- const std::vector<::aidl::android::media::audio::common::AudioDevice>& devices,
- StreamContext* context, const Metadata& metadata) {
- if (devices.empty()) {
- LOG(FATAL) << __func__ << ": called with empty devices"; // see 'switchCurrentStream'
- }
- if (useStubStream(devices[0])) {
- return std::unique_ptr<StreamCommonInterfaceEx>(
- new InnerStreamWrapper<StreamStub>(context, metadata));
- }
- return std::unique_ptr<StreamCommonInterfaceEx>(
- new InnerStreamWrapper<StreamPrimary>(context, metadata, devices));
-}
-
ndk::ScopedAStatus StreamOutPrimary::getHwVolume(std::vector<float>* _aidl_return) {
if (isStubStream()) {
return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
@@ -264,15 +273,4 @@
return ndk::ScopedAStatus::ok();
}
-ndk::ScopedAStatus StreamOutPrimary::setConnectedDevices(
- const std::vector<::aidl::android::media::audio::common::AudioDevice>& devices) {
- if (!devices.empty()) {
- auto streamDataProcessor = mContextInstance.getStreamDataProcessor().lock();
- if (streamDataProcessor != nullptr) {
- streamDataProcessor->setAudioDevice(devices[0]);
- }
- }
- return StreamSwitcher::setConnectedDevices(devices);
-}
-
} // namespace aidl::android::hardware::audio::core
diff --git a/audio/aidl/default/r_submix/StreamRemoteSubmix.cpp b/audio/aidl/default/r_submix/StreamRemoteSubmix.cpp
index db105b6..93fe028 100644
--- a/audio/aidl/default/r_submix/StreamRemoteSubmix.cpp
+++ b/audio/aidl/default/r_submix/StreamRemoteSubmix.cpp
@@ -26,128 +26,106 @@
using aidl::android::hardware::audio::common::SourceMetadata;
using aidl::android::hardware::audio::core::r_submix::SubmixRoute;
using aidl::android::media::audio::common::AudioDeviceAddress;
+using aidl::android::media::audio::common::AudioDeviceType;
using aidl::android::media::audio::common::AudioOffloadInfo;
using aidl::android::media::audio::common::MicrophoneDynamicInfo;
using aidl::android::media::audio::common::MicrophoneInfo;
namespace aidl::android::hardware::audio::core {
-StreamRemoteSubmix::StreamRemoteSubmix(StreamContext* context, const Metadata& metadata,
- const AudioDeviceAddress& deviceAddress)
+StreamRemoteSubmix::StreamRemoteSubmix(StreamContext* context, const Metadata& metadata)
: StreamCommonImpl(context, metadata),
- mDeviceAddress(deviceAddress),
- mIsInput(isInput(metadata)) {
- mStreamConfig.frameSize = context->getFrameSize();
- mStreamConfig.format = context->getFormat();
- mStreamConfig.channelLayout = context->getChannelLayout();
- mStreamConfig.sampleRate = context->getSampleRate();
-}
+ mIsInput(isInput(metadata)),
+ mStreamConfig{.sampleRate = context->getSampleRate(),
+ .format = context->getFormat(),
+ .channelLayout = context->getChannelLayout(),
+ .frameSize = context->getFrameSize()} {}
StreamRemoteSubmix::~StreamRemoteSubmix() {
cleanupWorker();
}
::android::status_t StreamRemoteSubmix::init() {
- mCurrentRoute = SubmixRoute::findOrCreateRoute(mDeviceAddress, mStreamConfig);
- if (mCurrentRoute == nullptr) {
- return ::android::NO_INIT;
- }
- if (!mCurrentRoute->isStreamConfigValid(mIsInput, mStreamConfig)) {
- LOG(ERROR) << __func__ << ": invalid stream config";
- return ::android::NO_INIT;
- }
- sp<MonoPipe> sink = mCurrentRoute->getSink();
- if (sink == nullptr) {
- LOG(ERROR) << __func__ << ": nullptr sink when opening stream";
- return ::android::NO_INIT;
- }
- if ((!mIsInput || mCurrentRoute->isStreamInOpen()) && sink->isShutdown()) {
- LOG(DEBUG) << __func__ << ": Shut down sink when opening stream";
- if (::android::OK != mCurrentRoute->resetPipe()) {
- LOG(ERROR) << __func__ << ": reset pipe failed";
- return ::android::NO_INIT;
- }
- }
- mCurrentRoute->openStream(mIsInput);
return ::android::OK;
}
::android::status_t StreamRemoteSubmix::drain(StreamDescriptor::DrainMode) {
- usleep(1000);
return ::android::OK;
}
::android::status_t StreamRemoteSubmix::flush() {
- usleep(1000);
return ::android::OK;
}
::android::status_t StreamRemoteSubmix::pause() {
- usleep(1000);
return ::android::OK;
}
::android::status_t StreamRemoteSubmix::standby() {
- mCurrentRoute->standby(mIsInput);
+ if (mCurrentRoute) mCurrentRoute->standby(mIsInput);
return ::android::OK;
}
::android::status_t StreamRemoteSubmix::start() {
- mCurrentRoute->exitStandby(mIsInput);
+ if (mDeviceAddressUpdated.load(std::memory_order_acquire)) {
+ LOG(DEBUG) << __func__ << ": device address updated, reset current route";
+ shutdown();
+ mDeviceAddressUpdated.store(false, std::memory_order_release);
+ }
+ if (!mCurrentRoute) {
+ RETURN_STATUS_IF_ERROR(setCurrentRoute());
+ LOG(DEBUG) << __func__ << ": have current route? " << (mCurrentRoute != nullptr);
+ }
+ if (mCurrentRoute) mCurrentRoute->exitStandby(mIsInput);
mStartTimeNs = ::android::uptimeNanos();
mFramesSinceStart = 0;
return ::android::OK;
}
-ndk::ScopedAStatus StreamRemoteSubmix::prepareToClose() {
- if (!mIsInput) {
- std::shared_ptr<SubmixRoute> route = SubmixRoute::findRoute(mDeviceAddress);
- if (route != nullptr) {
- sp<MonoPipe> sink = route->getSink();
- if (sink == nullptr) {
- ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_STATE);
- }
- LOG(DEBUG) << __func__ << ": shutting down MonoPipe sink";
-
- sink->shutdown(true);
- // The client already considers this stream as closed, release the output end.
- route->closeStream(mIsInput);
- } else {
- LOG(DEBUG) << __func__ << ": stream already closed.";
- ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_STATE);
- }
- }
- return ndk::ScopedAStatus::ok();
-}
-
// Remove references to the specified input and output streams. When the device no longer
// references input and output streams destroy the associated pipe.
void StreamRemoteSubmix::shutdown() {
+ if (!mCurrentRoute) return;
mCurrentRoute->closeStream(mIsInput);
// If all stream instances are closed, we can remove route information for this port.
if (!mCurrentRoute->hasAtleastOneStreamOpen()) {
mCurrentRoute->releasePipe();
LOG(DEBUG) << __func__ << ": pipe destroyed";
- SubmixRoute::removeRoute(mDeviceAddress);
+ SubmixRoute::removeRoute(getDeviceAddress());
}
mCurrentRoute.reset();
}
::android::status_t StreamRemoteSubmix::transfer(void* buffer, size_t frameCount,
size_t* actualFrameCount, int32_t* latencyMs) {
+ if (mDeviceAddressUpdated.load(std::memory_order_acquire)) {
+ // 'setConnectedDevices' was called. I/O will be restarted.
+ return ::android::OK;
+ }
+
*latencyMs = getDelayInUsForFrameCount(getStreamPipeSizeInFrames()) / 1000;
LOG(VERBOSE) << __func__ << ": Latency " << *latencyMs << "ms";
- mCurrentRoute->exitStandby(mIsInput);
- ::android::status_t status = mIsInput ? inRead(buffer, frameCount, actualFrameCount)
- : outWrite(buffer, frameCount, actualFrameCount);
- if ((status != ::android::OK && mIsInput) ||
- ((status != ::android::OK && status != ::android::DEAD_OBJECT) && !mIsInput)) {
- return status;
+ ::android::status_t status = ::android::OK;
+ if (mCurrentRoute) {
+ mCurrentRoute->exitStandby(mIsInput);
+ status = mIsInput ? inRead(buffer, frameCount, actualFrameCount)
+ : outWrite(buffer, frameCount, actualFrameCount);
+ if ((status != ::android::OK && mIsInput) ||
+ ((status != ::android::OK && status != ::android::DEAD_OBJECT) && !mIsInput)) {
+ return status;
+ }
+ } else {
+ LOG(WARNING) << __func__ << ": no current route";
+ if (mIsInput) {
+ memset(buffer, 0, mStreamConfig.frameSize * frameCount);
+ }
+ *actualFrameCount = frameCount;
}
mFramesSinceStart += *actualFrameCount;
- if (!mIsInput && status != ::android::DEAD_OBJECT) return ::android::OK;
- // Input streams always need to block, output streams need to block when there is no sink.
- // When the sink exists, more sophisticated blocking algorithm is implemented by MonoPipe.
+ // If there is no route, always block, otherwise:
+ // - Input streams always need to block, output streams need to block when there is no sink.
+ // - When the sink exists, more sophisticated blocking algorithm is implemented by MonoPipe.
+ if (mCurrentRoute && !mIsInput && status != ::android::DEAD_OBJECT) return ::android::OK;
const long bufferDurationUs =
(*actualFrameCount) * MICROS_PER_SECOND / mContext.getSampleRate();
const auto totalDurationUs = (::android::uptimeNanos() - mStartTimeNs) / NANOS_PER_MICROSECOND;
@@ -163,6 +141,10 @@
}
::android::status_t StreamRemoteSubmix::refinePosition(StreamDescriptor::Position* position) {
+ if (!mCurrentRoute) {
+ RETURN_STATUS_IF_ERROR(setCurrentRoute());
+ if (!mCurrentRoute) return ::android::OK;
+ }
sp<MonoPipeReader> source = mCurrentRoute->getSource();
if (source == nullptr) {
return ::android::NO_INIT;
@@ -186,6 +168,7 @@
// Calculate the maximum size of the pipe buffer in frames for the specified stream.
size_t StreamRemoteSubmix::getStreamPipeSizeInFrames() {
+ if (!mCurrentRoute) return r_submix::kDefaultPipeSizeInFrames;
auto pipeConfig = mCurrentRoute->getPipeConfig();
const size_t maxFrameSize = std::max(mStreamConfig.frameSize, pipeConfig.frameSize);
return (pipeConfig.frameCount * pipeConfig.frameSize) / maxFrameSize;
@@ -209,7 +192,7 @@
}
mWriteShutdownCount = 0;
- LOG(VERBOSE) << __func__ << ": " << mDeviceAddress.toString() << ", " << frameCount
+ LOG(VERBOSE) << __func__ << ": " << getDeviceAddress().toString() << ", " << frameCount
<< " frames";
const bool shouldBlockWrite = mCurrentRoute->shouldBlockWrite();
@@ -283,8 +266,9 @@
}
mReadErrorCount = 0;
- LOG(VERBOSE) << __func__ << ": " << mDeviceAddress.toString() << ", " << frameCount
+ LOG(VERBOSE) << __func__ << ": " << getDeviceAddress().toString() << ", " << frameCount
<< " frames";
+
// read the data from the pipe
char* buff = (char*)buffer;
size_t actuallyRead = 0;
@@ -324,10 +308,91 @@
return ::android::OK;
}
+::android::status_t StreamRemoteSubmix::setCurrentRoute() {
+ const auto address = getDeviceAddress();
+ if (address == AudioDeviceAddress{}) {
+ return ::android::OK;
+ }
+ mCurrentRoute = SubmixRoute::findOrCreateRoute(address, mStreamConfig);
+ if (mCurrentRoute == nullptr) {
+ return ::android::NO_INIT;
+ }
+ if (!mCurrentRoute->isStreamConfigValid(mIsInput, mStreamConfig)) {
+ LOG(ERROR) << __func__ << ": invalid stream config";
+ return ::android::NO_INIT;
+ }
+ sp<MonoPipe> sink = mCurrentRoute->getSink();
+ if (sink == nullptr) {
+ LOG(ERROR) << __func__ << ": nullptr sink when opening stream";
+ return ::android::NO_INIT;
+ }
+ if ((!mIsInput || mCurrentRoute->isStreamInOpen()) && sink->isShutdown()) {
+ LOG(DEBUG) << __func__ << ": Shut down sink when opening stream";
+ if (::android::OK != mCurrentRoute->resetPipe()) {
+ LOG(ERROR) << __func__ << ": reset pipe failed";
+ return ::android::NO_INIT;
+ }
+ }
+ mCurrentRoute->openStream(mIsInput);
+ return ::android::OK;
+}
+
+ndk::ScopedAStatus StreamRemoteSubmix::prepareToClose() {
+ if (!mIsInput) {
+ const auto address = getDeviceAddress();
+ if (address == AudioDeviceAddress{}) return ndk::ScopedAStatus::ok();
+ std::shared_ptr<SubmixRoute> route = SubmixRoute::findRoute(address);
+ if (route != nullptr) {
+ sp<MonoPipe> sink = route->getSink();
+ if (sink == nullptr) {
+ ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_STATE);
+ }
+ LOG(DEBUG) << __func__ << ": shutting down MonoPipe sink";
+
+ sink->shutdown(true);
+ // The client already considers this stream as closed, release the output end.
+ route->closeStream(mIsInput);
+ } else {
+ LOG(DEBUG) << __func__ << ": stream already closed.";
+ ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_STATE);
+ }
+ }
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus StreamRemoteSubmix::setConnectedDevices(const ConnectedDevices& devices) {
+ if (devices.size() > 1) {
+ LOG(ERROR) << __func__ << ": Only single device supported, got " << devices.size();
+ return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
+ }
+ AudioDeviceAddress newAddress;
+ if (!devices.empty()) {
+ if (auto deviceDesc = devices.front().type;
+ (mIsInput && deviceDesc.type != AudioDeviceType::IN_SUBMIX) ||
+ (!mIsInput && deviceDesc.type != AudioDeviceType::OUT_SUBMIX)) {
+ LOG(ERROR) << __func__ << ": Device type " << toString(deviceDesc.type)
+ << " not supported";
+ return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
+ }
+ newAddress = devices.front().address;
+ LOG(DEBUG) << __func__ << ": connected to " << newAddress.toString();
+ } else {
+ LOG(DEBUG) << __func__ << ": disconnected";
+ }
+ RETURN_STATUS_IF_ERROR(StreamCommonImpl::setConnectedDevices(devices));
+ std::lock_guard guard(mLock);
+ if (mDeviceAddress != newAddress) {
+ mDeviceAddress = newAddress;
+ mDeviceAddressUpdated.store(true, std::memory_order_release);
+ }
+ return ndk::ScopedAStatus::ok();
+}
+
StreamInRemoteSubmix::StreamInRemoteSubmix(StreamContext&& context,
const SinkMetadata& sinkMetadata,
const std::vector<MicrophoneInfo>& microphones)
- : StreamIn(std::move(context), microphones), StreamSwitcher(&mContextInstance, sinkMetadata) {}
+ : StreamIn(std::move(context), microphones),
+ StreamRemoteSubmix(&mContextInstance, sinkMetadata) {}
ndk::ScopedAStatus StreamInRemoteSubmix::getActiveMicrophones(
std::vector<MicrophoneDynamicInfo>* _aidl_return) {
@@ -336,66 +401,10 @@
return ndk::ScopedAStatus::ok();
}
-StreamSwitcher::DeviceSwitchBehavior StreamInRemoteSubmix::switchCurrentStream(
- const std::vector<::aidl::android::media::audio::common::AudioDevice>& devices) {
- // This implementation effectively postpones stream creation until
- // receiving the first call to 'setConnectedDevices' with a non-empty list.
- if (isStubStream()) {
- if (devices.size() == 1) {
- auto deviceDesc = devices.front().type;
- if (deviceDesc.type ==
- ::aidl::android::media::audio::common::AudioDeviceType::IN_SUBMIX) {
- return DeviceSwitchBehavior::CREATE_NEW_STREAM;
- }
- LOG(ERROR) << __func__ << ": Device type " << toString(deviceDesc.type)
- << " not supported";
- } else {
- LOG(ERROR) << __func__ << ": Only single device supported.";
- }
- return DeviceSwitchBehavior::UNSUPPORTED_DEVICES;
- }
- return DeviceSwitchBehavior::USE_CURRENT_STREAM;
-}
-
-std::unique_ptr<StreamCommonInterfaceEx> StreamInRemoteSubmix::createNewStream(
- const std::vector<::aidl::android::media::audio::common::AudioDevice>& devices,
- StreamContext* context, const Metadata& metadata) {
- return std::unique_ptr<StreamCommonInterfaceEx>(
- new InnerStreamWrapper<StreamRemoteSubmix>(context, metadata, devices.front().address));
-}
-
StreamOutRemoteSubmix::StreamOutRemoteSubmix(StreamContext&& context,
const SourceMetadata& sourceMetadata,
const std::optional<AudioOffloadInfo>& offloadInfo)
: StreamOut(std::move(context), offloadInfo),
- StreamSwitcher(&mContextInstance, sourceMetadata) {}
-
-StreamSwitcher::DeviceSwitchBehavior StreamOutRemoteSubmix::switchCurrentStream(
- const std::vector<::aidl::android::media::audio::common::AudioDevice>& devices) {
- // This implementation effectively postpones stream creation until
- // receiving the first call to 'setConnectedDevices' with a non-empty list.
- if (isStubStream()) {
- if (devices.size() == 1) {
- auto deviceDesc = devices.front().type;
- if (deviceDesc.type ==
- ::aidl::android::media::audio::common::AudioDeviceType::OUT_SUBMIX) {
- return DeviceSwitchBehavior::CREATE_NEW_STREAM;
- }
- LOG(ERROR) << __func__ << ": Device type " << toString(deviceDesc.type)
- << " not supported";
- } else {
- LOG(ERROR) << __func__ << ": Only single device supported.";
- }
- return DeviceSwitchBehavior::UNSUPPORTED_DEVICES;
- }
- return DeviceSwitchBehavior::USE_CURRENT_STREAM;
-}
-
-std::unique_ptr<StreamCommonInterfaceEx> StreamOutRemoteSubmix::createNewStream(
- const std::vector<::aidl::android::media::audio::common::AudioDevice>& devices,
- StreamContext* context, const Metadata& metadata) {
- return std::unique_ptr<StreamCommonInterfaceEx>(
- new InnerStreamWrapper<StreamRemoteSubmix>(context, metadata, devices.front().address));
-}
+ StreamRemoteSubmix(&mContextInstance, sourceMetadata) {}
} // namespace aidl::android::hardware::audio::core
diff --git a/audio/aidl/default/r_submix/SubmixRoute.h b/audio/aidl/default/r_submix/SubmixRoute.h
index 5425f12..0097f39 100644
--- a/audio/aidl/default/r_submix/SubmixRoute.h
+++ b/audio/aidl/default/r_submix/SubmixRoute.h
@@ -25,10 +25,12 @@
#include <media/nbaio/MonoPipe.h>
#include <media/nbaio/MonoPipeReader.h>
+#include <Utils.h>
#include <aidl/android/media/audio/common/AudioChannelLayout.h>
#include <aidl/android/media/audio/common/AudioDeviceAddress.h>
#include <aidl/android/media/audio/common/AudioFormatDescription.h>
+using aidl::android::hardware::audio::common::getFrameSizeInBytes;
using aidl::android::media::audio::common::AudioChannelLayout;
using aidl::android::media::audio::common::AudioFormatDescription;
using aidl::android::media::audio::common::AudioFormatType;
@@ -56,8 +58,8 @@
AudioChannelLayout channelLayout =
AudioChannelLayout::make<AudioChannelLayout::Tag::layoutMask>(
AudioChannelLayout::LAYOUT_STEREO);
- size_t frameSize;
- size_t frameCount;
+ size_t frameSize = getFrameSizeInBytes(format, channelLayout);
+ size_t frameCount = 0;
};
class SubmixRoute {
diff --git a/audio/aidl/default/stub/DriverStubImpl.cpp b/audio/aidl/default/stub/DriverStubImpl.cpp
new file mode 100644
index 0000000..beb0114
--- /dev/null
+++ b/audio/aidl/default/stub/DriverStubImpl.cpp
@@ -0,0 +1,126 @@
+/*
+ * Copyright (C) 2024 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <cmath>
+
+#define LOG_TAG "AHAL_Stream"
+#include <android-base/logging.h>
+#include <audio_utils/clock.h>
+
+#include "core-impl/DriverStubImpl.h"
+
+namespace aidl::android::hardware::audio::core {
+
+DriverStubImpl::DriverStubImpl(const StreamContext& context)
+ : mBufferSizeFrames(context.getBufferSizeInFrames()),
+ mFrameSizeBytes(context.getFrameSize()),
+ mSampleRate(context.getSampleRate()),
+ mIsAsynchronous(!!context.getAsyncCallback()),
+ mIsInput(context.isInput()) {}
+
+::android::status_t DriverStubImpl::init() {
+ mIsInitialized = true;
+ return ::android::OK;
+}
+
+::android::status_t DriverStubImpl::drain(StreamDescriptor::DrainMode) {
+ if (!mIsInitialized) {
+ LOG(FATAL) << __func__ << ": must not happen for an uninitialized driver";
+ }
+ if (!mIsInput) {
+ if (!mIsAsynchronous) {
+ static constexpr float kMicrosPerSecond = MICROS_PER_SECOND;
+ const size_t delayUs = static_cast<size_t>(
+ std::roundf(mBufferSizeFrames * kMicrosPerSecond / mSampleRate));
+ usleep(delayUs);
+ } else {
+ usleep(500);
+ }
+ }
+ return ::android::OK;
+}
+
+::android::status_t DriverStubImpl::flush() {
+ if (!mIsInitialized) {
+ LOG(FATAL) << __func__ << ": must not happen for an uninitialized driver";
+ }
+ return ::android::OK;
+}
+
+::android::status_t DriverStubImpl::pause() {
+ if (!mIsInitialized) {
+ LOG(FATAL) << __func__ << ": must not happen for an uninitialized driver";
+ }
+ return ::android::OK;
+}
+
+::android::status_t DriverStubImpl::standby() {
+ if (!mIsInitialized) {
+ LOG(FATAL) << __func__ << ": must not happen for an uninitialized driver";
+ }
+ mIsStandby = true;
+ return ::android::OK;
+}
+
+::android::status_t DriverStubImpl::start() {
+ if (!mIsInitialized) {
+ LOG(FATAL) << __func__ << ": must not happen for an uninitialized driver";
+ }
+ mIsStandby = false;
+ mStartTimeNs = ::android::uptimeNanos();
+ mFramesSinceStart = 0;
+ return ::android::OK;
+}
+
+::android::status_t DriverStubImpl::transfer(void* buffer, size_t frameCount,
+ size_t* actualFrameCount, int32_t*) {
+ if (!mIsInitialized) {
+ LOG(FATAL) << __func__ << ": must not happen for an uninitialized driver";
+ }
+ if (mIsStandby) {
+ LOG(FATAL) << __func__ << ": must not happen while in standby";
+ }
+ *actualFrameCount = frameCount;
+ if (mIsAsynchronous) {
+ usleep(500);
+ } else {
+ mFramesSinceStart += *actualFrameCount;
+ const long bufferDurationUs = (*actualFrameCount) * MICROS_PER_SECOND / mSampleRate;
+ const auto totalDurationUs =
+ (::android::uptimeNanos() - mStartTimeNs) / NANOS_PER_MICROSECOND;
+ const long totalOffsetUs =
+ mFramesSinceStart * MICROS_PER_SECOND / mSampleRate - totalDurationUs;
+ LOG(VERBOSE) << __func__ << ": totalOffsetUs " << totalOffsetUs;
+ if (totalOffsetUs > 0) {
+ const long sleepTimeUs = std::min(totalOffsetUs, bufferDurationUs);
+ LOG(VERBOSE) << __func__ << ": sleeping for " << sleepTimeUs << " us";
+ usleep(sleepTimeUs);
+ }
+ }
+ if (mIsInput) {
+ uint8_t* byteBuffer = static_cast<uint8_t*>(buffer);
+ for (size_t i = 0; i < frameCount * mFrameSizeBytes; ++i) {
+ byteBuffer[i] = std::rand() % 255;
+ }
+ }
+ return ::android::OK;
+}
+
+void DriverStubImpl::shutdown() {
+ mIsInitialized = false;
+}
+
+} // namespace aidl::android::hardware::audio::core
diff --git a/audio/aidl/default/stub/StreamStub.cpp b/audio/aidl/default/stub/StreamStub.cpp
index a3d99a8..f6c87e1 100644
--- a/audio/aidl/default/stub/StreamStub.cpp
+++ b/audio/aidl/default/stub/StreamStub.cpp
@@ -32,110 +32,12 @@
namespace aidl::android::hardware::audio::core {
StreamStub::StreamStub(StreamContext* context, const Metadata& metadata)
- : StreamCommonImpl(context, metadata),
- mBufferSizeFrames(getContext().getBufferSizeInFrames()),
- mFrameSizeBytes(getContext().getFrameSize()),
- mSampleRate(getContext().getSampleRate()),
- mIsAsynchronous(!!getContext().getAsyncCallback()),
- mIsInput(isInput(metadata)) {}
+ : StreamCommonImpl(context, metadata), DriverStubImpl(getContext()) {}
StreamStub::~StreamStub() {
cleanupWorker();
}
-::android::status_t StreamStub::init() {
- mIsInitialized = true;
- return ::android::OK;
-}
-
-::android::status_t StreamStub::drain(StreamDescriptor::DrainMode) {
- if (!mIsInitialized) {
- LOG(FATAL) << __func__ << ": must not happen for an uninitialized driver";
- }
- if (!mIsInput) {
- if (!mIsAsynchronous) {
- static constexpr float kMicrosPerSecond = MICROS_PER_SECOND;
- const size_t delayUs = static_cast<size_t>(
- std::roundf(mBufferSizeFrames * kMicrosPerSecond / mSampleRate));
- usleep(delayUs);
- } else {
- usleep(500);
- }
- }
- return ::android::OK;
-}
-
-::android::status_t StreamStub::flush() {
- if (!mIsInitialized) {
- LOG(FATAL) << __func__ << ": must not happen for an uninitialized driver";
- }
- return ::android::OK;
-}
-
-::android::status_t StreamStub::pause() {
- if (!mIsInitialized) {
- LOG(FATAL) << __func__ << ": must not happen for an uninitialized driver";
- }
- return ::android::OK;
-}
-
-::android::status_t StreamStub::standby() {
- if (!mIsInitialized) {
- LOG(FATAL) << __func__ << ": must not happen for an uninitialized driver";
- }
- mIsStandby = true;
- return ::android::OK;
-}
-
-::android::status_t StreamStub::start() {
- if (!mIsInitialized) {
- LOG(FATAL) << __func__ << ": must not happen for an uninitialized driver";
- }
- mIsStandby = false;
- mStartTimeNs = ::android::uptimeNanos();
- mFramesSinceStart = 0;
- return ::android::OK;
-}
-
-::android::status_t StreamStub::transfer(void* buffer, size_t frameCount, size_t* actualFrameCount,
- int32_t*) {
- if (!mIsInitialized) {
- LOG(FATAL) << __func__ << ": must not happen for an uninitialized driver";
- }
- if (mIsStandby) {
- LOG(FATAL) << __func__ << ": must not happen while in standby";
- }
- *actualFrameCount = frameCount;
- if (mIsAsynchronous) {
- usleep(500);
- } else {
- mFramesSinceStart += *actualFrameCount;
- const long bufferDurationUs =
- (*actualFrameCount) * MICROS_PER_SECOND / mContext.getSampleRate();
- const auto totalDurationUs =
- (::android::uptimeNanos() - mStartTimeNs) / NANOS_PER_MICROSECOND;
- const long totalOffsetUs =
- mFramesSinceStart * MICROS_PER_SECOND / mContext.getSampleRate() - totalDurationUs;
- LOG(VERBOSE) << __func__ << ": totalOffsetUs " << totalOffsetUs;
- if (totalOffsetUs > 0) {
- const long sleepTimeUs = std::min(totalOffsetUs, bufferDurationUs);
- LOG(VERBOSE) << __func__ << ": sleeping for " << sleepTimeUs << " us";
- usleep(sleepTimeUs);
- }
- }
- if (mIsInput) {
- uint8_t* byteBuffer = static_cast<uint8_t*>(buffer);
- for (size_t i = 0; i < frameCount * mFrameSizeBytes; ++i) {
- byteBuffer[i] = std::rand() % 255;
- }
- }
- return ::android::OK;
-}
-
-void StreamStub::shutdown() {
- mIsInitialized = false;
-}
-
StreamInStub::StreamInStub(StreamContext&& context, const SinkMetadata& sinkMetadata,
const std::vector<MicrophoneInfo>& microphones)
: StreamIn(std::move(context), microphones), StreamStub(&mContextInstance, sinkMetadata) {}
diff --git a/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp b/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp
index 2bf70c7..9fe5801 100644
--- a/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp
+++ b/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp
@@ -87,6 +87,7 @@
using aidl::android::media::audio::common::AudioDeviceType;
using aidl::android::media::audio::common::AudioDualMonoMode;
using aidl::android::media::audio::common::AudioFormatType;
+using aidl::android::media::audio::common::AudioGainConfig;
using aidl::android::media::audio::common::AudioInputFlags;
using aidl::android::media::audio::common::AudioIoFlags;
using aidl::android::media::audio::common::AudioLatencyMode;
@@ -450,6 +451,7 @@
// This is implemented by the 'StreamFixture' utility class.
static constexpr int kNegativeTestBufferSizeFrames = 256;
static constexpr int kDefaultLargeBufferSizeFrames = 48000;
+ static constexpr int32_t kAidlVersion3 = 3;
void SetUpImpl(const std::string& moduleName, bool setUpDebug = true) {
ASSERT_NO_FATAL_FAILURE(ConnectToService(moduleName, setUpDebug));
@@ -478,6 +480,7 @@
if (setUpDebug) {
ASSERT_NO_FATAL_FAILURE(SetUpDebug());
}
+ ASSERT_TRUE(module->getInterfaceVersion(&aidlVersion).isOk());
}
void RestartService() {
@@ -490,6 +493,7 @@
if (setUpDebug) {
ASSERT_NO_FATAL_FAILURE(SetUpDebug());
}
+ ASSERT_TRUE(module->getInterfaceVersion(&aidlVersion).isOk());
}
void SetUpDebug() {
@@ -577,6 +581,7 @@
std::unique_ptr<WithDebugFlags> debug;
std::vector<AudioPort> initialPorts;
std::vector<AudioRoute> initialRoutes;
+ int32_t aidlVersion;
};
class WithDevicePortConnectedState {
@@ -1821,6 +1826,46 @@
}
}
+TEST_P(AudioCoreModule, SetAudioPortConfigInvalidPortAudioGain) {
+ if (aidlVersion < kAidlVersion3) {
+ GTEST_SKIP() << "Skip for audio HAL version lower than " << kAidlVersion3;
+ }
+ std::vector<AudioPort> ports;
+ ASSERT_IS_OK(module->getAudioPorts(&ports));
+ bool atLeastOnePortWithNonemptyGain = false;
+ for (const auto port : ports) {
+ AudioPortConfig portConfig;
+ portConfig.portId = port.id;
+ if (port.gains.empty()) {
+ continue;
+ }
+ atLeastOnePortWithNonemptyGain = true;
+ int index = 0;
+ ASSERT_NE(0, port.gains[index].stepValue) << "Invalid audio port config gain step 0";
+ portConfig.gain->index = index;
+ AudioGainConfig invalidGainConfig;
+
+ int invalidGain = port.gains[index].maxValue + port.gains[index].stepValue;
+ invalidGainConfig.values.push_back(invalidGain);
+ portConfig.gain.emplace(invalidGainConfig);
+ bool applied = true;
+ AudioPortConfig suggestedConfig;
+ EXPECT_STATUS(EX_ILLEGAL_ARGUMENT,
+ module->setAudioPortConfig(portConfig, &suggestedConfig, &applied))
+ << "invalid port gain " << invalidGain << " lower than min gain";
+
+ invalidGain = port.gains[index].minValue - port.gains[index].stepValue;
+ invalidGainConfig.values[0] = invalidGain;
+ portConfig.gain.emplace(invalidGainConfig);
+ EXPECT_STATUS(EX_ILLEGAL_ARGUMENT,
+ module->setAudioPortConfig(portConfig, &suggestedConfig, &applied))
+ << "invalid port gain " << invalidGain << "higher than max gain";
+ }
+ if (!atLeastOnePortWithNonemptyGain) {
+ GTEST_SKIP() << "No audio port contains non-empty gain configuration";
+ }
+}
+
TEST_P(AudioCoreModule, TryConnectMissingDevice) {
// Limit checks to connection types that are known to be detectable by HAL implementations.
static const std::set<std::string> kCheckedConnectionTypes{
diff --git a/audio/aidl/vts/VtsHalVisualizerTargetTest.cpp b/audio/aidl/vts/VtsHalVisualizerTargetTest.cpp
index c77a228..f89cb40 100644
--- a/audio/aidl/vts/VtsHalVisualizerTargetTest.cpp
+++ b/audio/aidl/vts/VtsHalVisualizerTargetTest.cpp
@@ -191,6 +191,7 @@
}
TEST_P(VisualizerParamTest, testCaptureSampleBufferSizeAndOutput) {
+ SKIP_TEST_IF_DATA_UNSUPPORTED(mDescriptor.common.flags);
ASSERT_NO_FATAL_FAILURE(addCaptureSizeParam(mCaptureSize));
ASSERT_NO_FATAL_FAILURE(addScalingModeParam(mScalingMode));
ASSERT_NO_FATAL_FAILURE(addMeasurementModeParam(mMeasurementMode));
diff --git a/automotive/ivn_android_device/impl/default/src/IvnAndroidDeviceService.cpp b/automotive/ivn_android_device/impl/default/src/IvnAndroidDeviceService.cpp
index 81f18b2..b284205 100644
--- a/automotive/ivn_android_device/impl/default/src/IvnAndroidDeviceService.cpp
+++ b/automotive/ivn_android_device/impl/default/src/IvnAndroidDeviceService.cpp
@@ -24,6 +24,7 @@
#include <json/json.h>
#include <fstream>
+#include <string>
namespace android {
namespace hardware {
@@ -48,7 +49,8 @@
}
bool IvnAndroidDeviceService::init() {
- std::ifstream configStream(mConfigPath);
+ std::string configPathStr(mConfigPath);
+ std::ifstream configStream(configPathStr);
if (!configStream) {
LOG(ERROR) << "couldn't open " << mConfigPath << " for parsing.";
return false;
diff --git a/automotive/vehicle/aidl/emu_metadata/android.hardware.automotive.vehicle-types-meta.json b/automotive/vehicle/aidl/emu_metadata/android.hardware.automotive.vehicle-types-meta.json
index de0e398..8ef440d 100644
--- a/automotive/vehicle/aidl/emu_metadata/android.hardware.automotive.vehicle-types-meta.json
+++ b/automotive/vehicle/aidl/emu_metadata/android.hardware.automotive.vehicle-types-meta.json
@@ -501,7 +501,7 @@
{
"name": "AP_POWER_STATE_REQ",
"value": 289475072,
- "description": "Property to control power state of application processor\nIt is assumed that AP's power state is controlled by a separate power controller.\nFor configuration information, VehiclePropConfig.configArray must have bit flag combining values in VehicleApPowerStateConfigFlag.\nint32Values[0] : VehicleApPowerStateReq enum value int32Values[1] : additional parameter relevant for each state, 0 if not used."
+ "description": "Property to control power state of application processor\nIt is assumed that AP's power state is controlled by a separate power controller.\nFor configuration information, VehiclePropConfig.configArray must have bit flag combining values in VehicleApPowerStateConfigFlag.\nconfigArray[0] : Bit flag combining values in VehicleApPowerStateConfigFlag, 0x0 if not used, 0x1 for enabling suspend to ram, 0x2 for supporting powering on AP from off state after timeout. 0x4 for enabling suspend to disk,\nint32Values[0] : VehicleApPowerStateReq enum value int32Values[1] : additional parameter relevant for each state, 0 if not used."
},
{
"name": "AP_POWER_STATE_REPORT",
diff --git a/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/test/Android.bp b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/test/Android.bp
index abf15c5..90ea027 100644
--- a/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/test/Android.bp
+++ b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/test/Android.bp
@@ -27,8 +27,6 @@
"VehicleHalJsonConfigLoader",
"VehicleHalUtils",
"libgtest",
- ],
- shared_libs: [
"libjsoncpp",
],
defaults: ["VehicleHalDefaults"],
@@ -43,8 +41,6 @@
"VehicleHalJsonConfigLoaderEnableTestProperties",
"VehicleHalUtils",
"libgtest",
- ],
- shared_libs: [
"libjsoncpp",
],
defaults: ["VehicleHalDefaults"],
diff --git a/automotive/vehicle/aidl/impl/default_config/test/Android.bp b/automotive/vehicle/aidl/impl/default_config/test/Android.bp
index 52014fb..a88913e 100644
--- a/automotive/vehicle/aidl/impl/default_config/test/Android.bp
+++ b/automotive/vehicle/aidl/impl/default_config/test/Android.bp
@@ -29,13 +29,11 @@
"VehicleHalUtils",
"libgmock",
"libgtest",
+ "libjsoncpp",
],
header_libs: [
"IVehicleGeneratedHeaders-V4",
],
- shared_libs: [
- "libjsoncpp",
- ],
data: [
":VehicleHalDefaultProperties_JSON",
],
@@ -52,6 +50,7 @@
"VehicleHalUtils",
"libgmock",
"libgtest",
+ "libjsoncpp",
],
cflags: [
"-DENABLE_VEHICLE_HAL_TEST_PROPERTIES",
@@ -59,9 +58,6 @@
header_libs: [
"IVehicleGeneratedHeaders-V4",
],
- shared_libs: [
- "libjsoncpp",
- ],
data: [
":VehicleHalDefaultProperties_JSON",
":VehicleHalTestProperties_JSON",
diff --git a/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/test/Android.bp b/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/test/Android.bp
index 4bc0b12..0d814ea 100644
--- a/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/test/Android.bp
+++ b/automotive/vehicle/aidl/impl/fake_impl/GeneratorHub/test/Android.bp
@@ -28,8 +28,6 @@
"VehicleHalUtils",
"FakeVehicleHalValueGenerators",
"FakeObd2Frame",
- ],
- shared_libs: [
"libjsoncpp",
],
data: [
diff --git a/automotive/vehicle/aidl/impl/fake_impl/hardware/include/FakeVehicleHardware.h b/automotive/vehicle/aidl/impl/fake_impl/hardware/include/FakeVehicleHardware.h
index ad14a9b..5916307 100644
--- a/automotive/vehicle/aidl/impl/fake_impl/hardware/include/FakeVehicleHardware.h
+++ b/automotive/vehicle/aidl/impl/fake_impl/hardware/include/FakeVehicleHardware.h
@@ -49,11 +49,6 @@
class FakeVehicleHardware : public IVehicleHardware {
public:
- // Supports Suspend_to_ram.
- static constexpr int32_t SUPPORT_S2R = 0x1;
- // Supports Suspend_to_disk.
- static constexpr int32_t SUPPORT_S2D = 0x4;
-
using ValueResultType = VhalResult<VehiclePropValuePool::RecyclableType>;
FakeVehicleHardware();
@@ -61,6 +56,13 @@
FakeVehicleHardware(std::string defaultConfigDir, std::string overrideConfigDir,
bool forceOverride);
+ // s2rS2dConfig is the config for whether S2R or S2D is supported, must be a bit flag combining
+ // values from VehicleApPowerStateConfigFlag.
+ // The default implementation is reading this from system property:
+ // "ro.vendor.fake_vhal.ap_power_state_req.config".
+ FakeVehicleHardware(std::string defaultConfigDir, std::string overrideConfigDir,
+ bool forceOverride, int32_t s2rS2dConfig);
+
~FakeVehicleHardware();
// Get all the property configs.
@@ -122,12 +124,6 @@
bool UseOverrideConfigDir();
- // Gets the config whether S2R or S2D is supported, must returns a bit flag made up of
- // SUPPORT_S2R and SUPPORT_S2D, for example, 0x0 means no support, 0x5 means support both.
- // The default implementation is reading this from system property:
- // "ro.vendor.fake_vhal.ap_power_state_req.config".
- int32_t getS2rS2dConfig();
-
private:
// Expose private methods to unit test.
friend class FakeVehicleHardwareTestHelper;
@@ -204,7 +200,7 @@
// provides power controlling related properties.
std::string mPowerControllerServiceAddress = "";
- void init();
+ void init(int32_t s2rS2dConfig);
// Stores the initial value to property store.
void storePropInitialValue(const ConfigDeclaration& config);
// The callback that would be called when a vehicle property value change happens.
diff --git a/automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp b/automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp
index 80c9620..a6247a7 100644
--- a/automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp
+++ b/automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp
@@ -348,6 +348,13 @@
FakeVehicleHardware::FakeVehicleHardware(std::string defaultConfigDir,
std::string overrideConfigDir, bool forceOverride)
+ : FakeVehicleHardware(defaultConfigDir, overrideConfigDir, forceOverride,
+ /*s2rS2dConfig=*/
+ GetIntProperty(POWER_STATE_REQ_CONFIG_PROPERTY, /*default_value=*/0)) {}
+
+FakeVehicleHardware::FakeVehicleHardware(std::string defaultConfigDir,
+ std::string overrideConfigDir, bool forceOverride,
+ int32_t s2rS2dConfig)
: mValuePool(std::make_unique<VehiclePropValuePool>()),
mServerSidePropStore(new VehiclePropertyStore(mValuePool)),
mDefaultConfigDir(defaultConfigDir),
@@ -360,7 +367,7 @@
mPendingGetValueRequests(this),
mPendingSetValueRequests(this),
mForceOverride(forceOverride) {
- init();
+ init(s2rS2dConfig);
}
FakeVehicleHardware::~FakeVehicleHardware() {
@@ -388,7 +395,7 @@
return configsByPropId;
}
-void FakeVehicleHardware::init() {
+void FakeVehicleHardware::init(int32_t s2rS2dConfig) {
maybeGetGrpcServiceInfo(&mPowerControllerServiceAddress);
for (auto& [_, configDeclaration] : loadConfigDeclarations()) {
@@ -396,7 +403,7 @@
VehiclePropertyStore::TokenFunction tokenFunction = nullptr;
if (cfg.prop == toInt(VehicleProperty::AP_POWER_STATE_REQ)) {
- cfg.configArray[0] = getS2rS2dConfig();
+ cfg.configArray[0] = s2rS2dConfig;
} else if (cfg.prop == OBD2_FREEZE_FRAME) {
tokenFunction = [](const VehiclePropValue& propValue) { return propValue.timestamp; };
}
@@ -425,10 +432,6 @@
});
}
-int32_t FakeVehicleHardware::getS2rS2dConfig() {
- return GetIntProperty(POWER_STATE_REQ_CONFIG_PROPERTY, /*default_value=*/0);
-}
-
std::vector<VehiclePropConfig> FakeVehicleHardware::getAllPropertyConfigs() const {
std::vector<VehiclePropConfig> allConfigs = mServerSidePropStore->getAllConfigs();
if (mAddExtraTestVendorConfigs) {
@@ -535,6 +538,9 @@
<< getErrorMsg(writeResult);
}
break;
+ case toInt(VehicleApPowerStateReport::ON):
+ ALOGI("Received VehicleApPowerStateReport::ON, entering normal operating state");
+ break;
default:
ALOGE("Unknown VehicleApPowerStateReport: %d", state);
break;
diff --git a/automotive/vehicle/aidl/impl/fake_impl/hardware/test/Android.bp b/automotive/vehicle/aidl/impl/fake_impl/hardware/test/Android.bp
index 9f002dd..62c1147 100644
--- a/automotive/vehicle/aidl/impl/fake_impl/hardware/test/Android.bp
+++ b/automotive/vehicle/aidl/impl/fake_impl/hardware/test/Android.bp
@@ -40,10 +40,10 @@
"FakeUserHal",
"libgtest",
"libgmock",
+ "libjsoncpp",
],
shared_libs: [
"libgrpc++",
- "libjsoncpp",
"libprotobuf-cpp-full",
],
data: [
diff --git a/automotive/vehicle/aidl/impl/fake_impl/hardware/test/FakeVehicleHardwareTest.cpp b/automotive/vehicle/aidl/impl/fake_impl/hardware/test/FakeVehicleHardwareTest.cpp
index 95647df..f6098ca 100644
--- a/automotive/vehicle/aidl/impl/fake_impl/hardware/test/FakeVehicleHardwareTest.cpp
+++ b/automotive/vehicle/aidl/impl/fake_impl/hardware/test/FakeVehicleHardwareTest.cpp
@@ -20,6 +20,7 @@
#include <FakeUserHal.h>
#include <PropertyUtils.h>
+#include <aidl/android/hardware/automotive/vehicle/VehicleApPowerStateConfigFlag.h>
#include <aidl/android/hardware/automotive/vehicle/VehicleApPowerStateShutdownParam.h>
#include <android/hardware/automotive/vehicle/TestVendorProperty.h>
@@ -73,6 +74,7 @@
using ::aidl::android::hardware::automotive::vehicle::SetValueResult;
using ::aidl::android::hardware::automotive::vehicle::StatusCode;
using ::aidl::android::hardware::automotive::vehicle::SubscribeOptions;
+using ::aidl::android::hardware::automotive::vehicle::VehicleApPowerStateConfigFlag;
using ::aidl::android::hardware::automotive::vehicle::VehicleApPowerStateReport;
using ::aidl::android::hardware::automotive::vehicle::VehicleApPowerStateReq;
using ::aidl::android::hardware::automotive::vehicle::VehicleApPowerStateShutdownParam;
@@ -3863,6 +3865,25 @@
}
}
+TEST_F(FakeVehicleHardwareTest, testOverrideApPowerStateReqConfig) {
+ auto hardware = std::make_unique<FakeVehicleHardware>(
+ android::base::GetExecutableDirectory(),
+ /*overrideConfigDir=*/"",
+ /*forceOverride=*/false,
+ toInt(VehicleApPowerStateConfigFlag::ENABLE_DEEP_SLEEP_FLAG) |
+ toInt(VehicleApPowerStateConfigFlag::ENABLE_HIBERNATION_FLAG));
+
+ std::vector<VehiclePropConfig> configs = hardware->getAllPropertyConfigs();
+
+ for (const auto& config : configs) {
+ if (config.prop != toInt(VehicleProperty::AP_POWER_STATE_REQ)) {
+ continue;
+ }
+ ASSERT_EQ(config.configArray[0], 0x5);
+ break;
+ }
+}
+
} // namespace fake
} // namespace vehicle
} // namespace automotive
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 0863adf..e5c09b0 100644
--- a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl
+++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl
@@ -1677,6 +1677,12 @@
* For configuration information, VehiclePropConfig.configArray must have bit flag combining
* values in VehicleApPowerStateConfigFlag.
*
+ * configArray[0] : Bit flag combining values in VehicleApPowerStateConfigFlag,
+ * 0x0 if not used,
+ * 0x1 for enabling suspend to ram,
+ * 0x2 for supporting powering on AP from off state after timeout.
+ * 0x4 for enabling suspend to disk,
+ *
* int32Values[0] : VehicleApPowerStateReq enum value
* int32Values[1] : additional parameter relevant for each state,
* 0 if not used.
diff --git a/biometrics/common/config/include/config/Config.h b/biometrics/common/config/include/config/Config.h
index 0367832..b1affdc 100644
--- a/biometrics/common/config/include/config/Config.h
+++ b/biometrics/common/config/include/config/Config.h
@@ -100,7 +100,11 @@
} else if (std::holds_alternative<OptIntVec>(v)) {
for (auto x : std::get<OptIntVec>(v))
if (x.has_value()) os << x.value() << " ";
+ } else if (std::holds_alternative<OptString>(v)) {
+ OptString ov = std::get<OptString>(v);
+ if (ov.has_value()) os << ov.value();
}
+
return os.str();
}
std::string toString() const {
diff --git a/biometrics/face/aidl/Android.bp b/biometrics/face/aidl/Android.bp
index fadcde7..54d01a7 100644
--- a/biometrics/face/aidl/Android.bp
+++ b/biometrics/face/aidl/Android.bp
@@ -11,7 +11,7 @@
name: "android.hardware.biometrics.face",
vendor_available: true,
srcs: [
- "android/hardware/biometrics/face/**/*.aidl",
+ "android/hardware/biometrics/face/*.aidl",
],
imports: [
"android.hardware.biometrics.common-V4",
@@ -36,6 +36,10 @@
additional_shared_libraries: [
"libnativewindow",
],
+ apex_available: [
+ "//apex_available:platform",
+ "com.android.hardware.biometrics.face.virtual",
+ ],
},
},
versions_with_info: [
@@ -74,5 +78,39 @@
],
frozen: true,
+}
+aidl_interface {
+ name: "android.hardware.biometrics.face.virtualhal",
+ srcs: [
+ "android/hardware/biometrics/face/virtualhal/*.aidl",
+ ],
+ imports: [
+ "android.hardware.biometrics.common-V4",
+ "android.hardware.keymaster-V4",
+ "android.hardware.biometrics.face-V4",
+ ],
+ vendor_available: true,
+ unstable: true,
+ backend: {
+ java: {
+ platform_apis: true,
+ },
+ rust: {
+ enabled: false,
+ },
+ cpp: {
+ enabled: false,
+ },
+ ndk: {
+ additional_shared_libraries: [
+ "libnativewindow",
+ ],
+ apex_available: [
+ "com.android.hardware.biometrics.face.virtual",
+ "//apex_available:platform",
+ ],
+ },
+ },
+ frozen: false,
}
diff --git a/biometrics/face/aidl/android/hardware/biometrics/face/ISession.aidl b/biometrics/face/aidl/android/hardware/biometrics/face/ISession.aidl
index 26cb361..0dbf052 100644
--- a/biometrics/face/aidl/android/hardware/biometrics/face/ISession.aidl
+++ b/biometrics/face/aidl/android/hardware/biometrics/face/ISession.aidl
@@ -73,7 +73,7 @@
* Note that this interface allows multiple in-flight challenges. Invoking generateChallenge
* twice does not invalidate the first challenge. The challenge is invalidated only when:
* 1) Its lifespan exceeds the challenge timeout defined in the TEE.
- * 2) IFingerprint#revokeChallenge is invoked
+ * 2) IFace#revokeChallenge is invoked
*
* For example, the following is a possible table of valid challenges:
* ----------------------------------------------
diff --git a/biometrics/face/aidl/android/hardware/biometrics/face/virtualhal/AcquiredInfoAndVendorCode.aidl b/biometrics/face/aidl/android/hardware/biometrics/face/virtualhal/AcquiredInfoAndVendorCode.aidl
new file mode 100644
index 0000000..a254120
--- /dev/null
+++ b/biometrics/face/aidl/android/hardware/biometrics/face/virtualhal/AcquiredInfoAndVendorCode.aidl
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2024 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.biometrics.face.virtualhal;
+
+import android.hardware.biometrics.face.AcquiredInfo;
+
+/**
+ * @hide
+ */
+union AcquiredInfoAndVendorCode {
+ /**
+ * Acquired info as specified in AcqauiredInfo.aidl
+ */
+ AcquiredInfo acquiredInfo = AcquiredInfo.UNKNOWN;
+
+ /**
+ * Vendor specific code
+ */
+ int vendorCode;
+}
diff --git a/biometrics/face/aidl/android/hardware/biometrics/face/virtualhal/EnrollmentProgressStep.aidl b/biometrics/face/aidl/android/hardware/biometrics/face/virtualhal/EnrollmentProgressStep.aidl
new file mode 100644
index 0000000..7fbcf5d
--- /dev/null
+++ b/biometrics/face/aidl/android/hardware/biometrics/face/virtualhal/EnrollmentProgressStep.aidl
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2024 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.biometrics.face.virtualhal;
+
+import android.hardware.biometrics.face.virtualhal.AcquiredInfoAndVendorCode;
+
+/**
+ * @hide
+ */
+parcelable EnrollmentProgressStep {
+ /**
+ * The duration of the enrollment step in milli-seconds
+ */
+ int durationMs;
+
+ /**
+ * The sequence of acquired info and vendor code to be issued by HAL during the step.
+ * The codes are evenly spread over the duration
+ */
+ AcquiredInfoAndVendorCode[] acquiredInfoAndVendorCodes;
+}
diff --git a/biometrics/face/aidl/android/hardware/biometrics/face/virtualhal/IVirtualHal.aidl b/biometrics/face/aidl/android/hardware/biometrics/face/virtualhal/IVirtualHal.aidl
new file mode 100644
index 0000000..1d3d934
--- /dev/null
+++ b/biometrics/face/aidl/android/hardware/biometrics/face/virtualhal/IVirtualHal.aidl
@@ -0,0 +1,297 @@
+/*
+ * Copyright (C) 2024 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.biometrics.face.virtualhal;
+
+import android.hardware.biometrics.common.SensorStrength;
+import android.hardware.biometrics.face.FaceSensorType;
+import android.hardware.biometrics.face.IFace;
+import android.hardware.biometrics.face.virtualhal.AcquiredInfoAndVendorCode;
+import android.hardware.biometrics.face.virtualhal.NextEnrollment;
+
+/**
+ * @hide
+ */
+interface IVirtualHal {
+ /**
+ * The operation failed due to invalid input parameters, the error messages should
+ * gives more details
+ */
+ const int STATUS_INVALID_PARAMETER = 1;
+
+ /**
+ * Set Face Virtual HAL behavior parameters
+ */
+
+ /**
+ * setEnrollments
+ *
+ * Set the ids of the faces that were currently enrolled in the Virtual HAL,
+ *
+ * @param ids ids can contain 1 or more ids, each must be larger than 0
+ */
+ void setEnrollments(in int[] id);
+
+ /**
+ * setEnrollmentHit
+ *
+ * Set current face enrollment ids in Face Virtual HAL,
+ *
+ * @param ids ids can contain 1 or more ids, each must be larger than 0
+ */
+ void setEnrollmentHit(in int hit_id);
+
+ /**
+ * setNextEnrollment
+ *
+ * Set the next enrollment behavior
+ *
+ * @param next_enrollment specifies enrollment id, progress stages and final result
+ */
+ void setNextEnrollment(in NextEnrollment next_enrollment);
+
+ /**
+ * setAuthenticatorId
+ *
+ * Set authenticator id in virtual HAL, the id is returned in ISession#AuthenticatorId() call
+ *
+ * @param id authenticator id value, only applied to the sensor with SensorStrength::STRONG.
+ */
+ void setAuthenticatorId(in long id);
+
+ /**
+ * setChallenge
+ *
+ * Set the challenge generated by the virtual HAL, which is returned in
+ * ISessionCallback#onChallengeGenerated()
+ *
+ * @param challenge
+ */
+ void setChallenge(in long challenge);
+
+ /**
+ * setOperationAuthenticateFails
+ *
+ * Set whether to force authentication to fail. If true, the virtual hal will report failure on
+ * authentication attempt until it is set to false
+ *
+ * @param fail if true, then the next authentication will fail
+ */
+ void setOperationAuthenticateFails(in boolean fail);
+
+ /**
+ * setOperationAuthenticateLatency
+ *
+ * Set authentication latency in the virtual hal in a fixed value (single element) or random
+ * values (two elements representing the bound values)
+ * The latency simulates the delay from the time framework requesting HAL to authetication to
+ * the time when HAL is ready to perform authentication operations.
+ *
+ * This method fails with STATUS_INVALID_PARAMETERS if the passed-in array falls in any of
+ * the following conditions
+ * 1. the array contains no element
+ * 2. the array contains more than two elements
+ * 3. the array contains any negative value
+ * The accompanying error message gives more detail
+ *
+ * @param latencyMs[] value(s) are in milli-seconds
+ */
+ void setOperationAuthenticateLatency(in int[] latencyMs);
+
+ /**
+ * setOperationAuthenticateDuration
+ *
+ * Set authentication duration covering the HAL authetication from start to end, including
+ * face capturing, and matching, acquired info reporting. In case a sequence of acquired
+ * info code are specified via setOperationAuthenticateAcquired(), the reporting is evenly
+ * distributed over the duration.
+ *
+ * This method fails with STATUS_INVALID_PARAMETERS if the passed-in value is negative
+ *
+ * @param duration value is in milli-seconds
+ */
+ void setOperationAuthenticateDuration(in int durationMs);
+
+ /**
+ * setOperationAuthenticateError
+ *
+ * Force authentication to error out for non-zero error
+ * Check
+ * hardware/interfaces/biometrics/face/aidl/default/aidl/android/hardware/biometrics/face/Error.aidl
+ * for valid error codes
+ *
+ * @param error if error < 1000
+ * non-vendor error
+ * else
+ * vendor error
+ */
+ void setOperationAuthenticateError(in int error);
+
+ /**
+ * setOperationAuthenticateAcquired
+ *
+ * Set one of more acquired info codes for the virtual hal to report during authentication
+ * Check
+ * hardware/interfaces/biometrics/face/aidl/aidl/android/hardware/biometrics/face/AcquiredInfo.aidl
+ * for valid acquired info codes
+ *
+ * @param acquired[], one or more acquired info codes
+ */
+ void setOperationAuthenticateAcquired(in AcquiredInfoAndVendorCode[] acquired);
+
+ /**
+ * setOperationEnrollLatency
+ *
+ * Set enrollment latency in the virtual hal in a fixed value (single element) or random
+ * values (two elements representing the bound values)
+ * The latency simulates the delay from the time framework requesting HAL to enroll to the
+ * time when HAL is ready to perform enrollment operations.
+ *
+ * This method fails with STATUS_INVALID_PARAMETERS if the passed-in array falls in any of
+ * the following conditions
+ * 1. the array contains no element
+ * 2. the array contains more than two elements
+ * 3. the array contains any negative value
+ * The accompanying error message gives more detail
+ *
+ * @param latencyMs[] value(s) are in milli-seconds
+ */
+ void setOperationEnrollLatency(in int[] latencyMs);
+
+ /**
+ * setOperationDetectInteractionLatency
+ *
+ * Set detect interaction latency in the virtual hal in a fixed value (single element) or random
+ * values (two elements representing the bound values)
+ * The latency simulates the delay from the time framework requesting HAL to detect interaction
+ * to the time when HAL is ready to perform detect interaction operations.
+ *
+ * This method fails with STATUS_INVALID_PARAMETERS if the passed-in array falls in any of
+ * the following conditions
+ * 1. the array contains no element
+ * 2. the array contains more than two elements
+ * 3. the array contains any negative value
+ * The accompanying error message gives more detail
+ *
+ * @param latencyMs[] value(s) are in milli-seconds
+ */
+ void setOperationDetectInteractionLatency(in int[] latencyMs);
+
+ /**
+ * setOperationDetectInteractionFails
+ *
+ * Force detect interaction operation to fail
+ */
+ void setOperationDetectInteractionFails(in boolean error);
+
+ /**
+ * setLockout
+ *
+ * Whether to force to lockout on authentcation operation. If true, the virtual hal will report
+ * permanent lockout in processing authentication requrest, regardless of whether
+ * setLockoutEnable(true) is called or not.
+ *
+ * @param lockout, set to true if lockout is desired
+ */
+ void setLockout(in boolean lockout);
+
+ /**
+ * setLockoutEnable
+ *
+ * Whether to enable authentication-fail-based lockout tracking or not. The lock tracking
+ * includes both timed-based (aka temporary) lockout and permanent lockout.
+ *
+ * @param enable, set true to enable the lockout tracking
+ */
+ void setLockoutEnable(in boolean enable);
+
+ /**
+ * setLockoutTimedEnable
+ *
+ * Whether to enable authentication-fail-based time-based-lockout tracking or not.
+ *
+ * @param enable, set true to enable the time-basedlockout tracking
+ */
+ void setLockoutTimedEnable(in boolean enable);
+
+ /**
+ * setLockoutTimedThreshold
+ *
+ * Set the number of consecutive authentication failures that triggers the timed-based lock to
+ * occur
+ *
+ * This method fails with STATUS_INVALID_PARAMETERS if the passed-in value is negative
+ *
+ * @param threshold, the number of consecutive failures
+ */
+ void setLockoutTimedThreshold(in int threshold);
+
+ /**
+ * setLockoutTimedDuration
+ *
+ * Set the duration to expire timed-based lock during which there is no authentication failure
+ *
+ * This method fails with STATUS_INVALID_PARAMETERS if the passed-in value is negative
+ *
+ * @param duration, in milli-seconds
+ */
+ void setLockoutTimedDuration(in int durationMs);
+
+ /**
+ * setLockoutPermanentThreshold
+ *
+ * Set the number of consecutive authentication failures that triggers the permanent lock to
+ * occur
+ *
+ * This method fails with STATUS_INVALID_PARAMETERS if the passed-in value is negative
+ *
+ * @param threshold, the number of consecutive failures
+ */
+ void setLockoutPermanentThreshold(in int threshold);
+
+ /**
+ * resetConfigurations
+ *
+ * Reset all virtual hal configurations to default values
+ */
+ void resetConfigurations();
+
+ /**
+ * setType
+ *
+ * Configure virtual face sensor type
+ *
+ * @param type, sensor type as specified in FaceSensorType.aidl
+ *
+ */
+ void setType(in FaceSensorType type);
+
+ /**
+ * setSensorStrength
+ *
+ * Configure virtual face sensor strength
+ *
+ * @param sensor strength as specified in common/SensorStrength.aidl
+ */
+ void setSensorStrength(in SensorStrength strength);
+
+ /**
+ * getFaceHal
+ *
+ * @return IFace interface associated with IVirtualHal instance
+ */
+ IFace getFaceHal();
+}
diff --git a/biometrics/face/aidl/android/hardware/biometrics/face/virtualhal/NextEnrollment.aidl b/biometrics/face/aidl/android/hardware/biometrics/face/virtualhal/NextEnrollment.aidl
new file mode 100644
index 0000000..d3547a8
--- /dev/null
+++ b/biometrics/face/aidl/android/hardware/biometrics/face/virtualhal/NextEnrollment.aidl
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2024 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.biometrics.face.virtualhal;
+
+/**
+ * @hide
+ */
+parcelable NextEnrollment {
+ /**
+ * Identifier of the next enrollment if successful
+ */
+ int id;
+
+ /**
+ * Specification of the progress steps of the next enrollment, each step consists of duration
+ * and sequence of acquired info codes to be generated by HAL.
+ * See EnrollmentProgressStep.aidl for more details
+ */
+ android.hardware.biometrics.face.virtualhal.EnrollmentProgressStep[] progressSteps;
+
+ /**
+ * Success or failure of the next enrollment
+ */
+ boolean result = true;
+}
diff --git a/biometrics/face/aidl/android/hardware/biometrics/face/virtualhal/README.md b/biometrics/face/aidl/android/hardware/biometrics/face/virtualhal/README.md
new file mode 100644
index 0000000..bf1a4b1
--- /dev/null
+++ b/biometrics/face/aidl/android/hardware/biometrics/face/virtualhal/README.md
@@ -0,0 +1,3 @@
+The aidl files in this directory are used to control/configure face virtual hal
+via IVirtualHal interface
+
diff --git a/biometrics/face/aidl/default/Android.bp b/biometrics/face/aidl/default/Android.bp
index 685639c..bed0405 100644
--- a/biometrics/face/aidl/default/Android.bp
+++ b/biometrics/face/aidl/default/Android.bp
@@ -9,21 +9,13 @@
}
filegroup {
- name: "face-example.rc",
- srcs: ["face-example.rc"],
+ name: "face-virtual.rc",
+ srcs: ["face-virtual.rc"],
}
-filegroup {
- name: "face-example.xml",
- srcs: ["face-example.xml"],
-}
-
-cc_binary {
- name: "android.hardware.biometrics.face-service.example",
- relative_install_path: "hw",
- init_rc: [":face-example.rc"],
- vintf_fragments: [":face-example.xml"],
- vendor: true,
+cc_library_static {
+ name: "android.hardware.biometrics.face-service.lib",
+ vendor_available: true,
shared_libs: [
"libbinder_ndk",
@@ -32,32 +24,80 @@
],
srcs: [
"FakeLockoutTracker.cpp",
- "main.cpp",
"Face.cpp",
"FakeFaceEngine.cpp",
"Session.cpp",
+ "FaceConfig.cpp",
+ "VirtualHal.cpp",
+ "main.cpp",
],
include_dirs: [
"frameworks/native/aidl/gui",
],
stl: "c++_static",
- static_libs: [
+ whole_static_libs: [
"android.hardware.biometrics.common-V4-ndk",
+ "android.hardware.biometrics.common.config",
"android.hardware.biometrics.common.thread",
"android.hardware.biometrics.common.util",
+ "android.hardware.biometrics.face.virtualhal-ndk",
"android.hardware.biometrics.face-V4-ndk",
"android.hardware.common-V2-ndk",
"android.hardware.keymaster-V4-ndk",
"libandroid.hardware.biometrics.face.VirtualProps",
"libbase",
],
+ apex_available: [
+ "com.android.hardware.biometrics.face.virtual",
+ "//apex_available:platform",
+ ],
+}
+
+cc_binary {
+ name: "android.hardware.biometrics.face-service.example",
+ system_ext_specific: true,
+ relative_install_path: "hw",
+
+ shared_libs: [
+ "libbinder_ndk",
+ "liblog",
+ "libnativewindow",
+ ],
+ whole_static_libs: [
+ "android.hardware.biometrics.face-service.lib",
+ ],
+ installable: false, // install APEX instead
+ apex_available: [
+ "com.android.hardware.biometrics.face.virtual",
+ "//apex_available:platform",
+ ],
+}
+
+cc_binary {
+ name: "android.hardware.biometrics.face-service.default",
+ vendor: true,
+ relative_install_path: "hw",
+ init_rc: ["face-default.rc"],
+ vintf_fragments: ["face-default.xml"],
+ shared_libs: [
+ "libbinder_ndk",
+ "liblog",
+ "libnativewindow",
+ ],
+ whole_static_libs: [
+ "android.hardware.biometrics.face-service.lib",
+ ],
}
sysprop_library {
name: "android.hardware.biometrics.face.VirtualProps",
srcs: ["face.sysprop"],
- property_owner: "Vendor",
- vendor: true,
+ property_owner: "Platform",
+ vendor_available: true,
+ apex_available: [
+ "//apex_available:platform",
+ "com.android.hardware.biometrics.face.virtual",
+ ],
}
cc_test {
@@ -66,6 +106,7 @@
"tests/FakeFaceEngineTest.cpp",
"FakeFaceEngine.cpp",
"FakeLockoutTracker.cpp",
+ "FaceConfig.cpp",
],
shared_libs: [
"libbase",
@@ -81,6 +122,8 @@
"android.hardware.biometrics.common-V4-ndk",
"android.hardware.keymaster-V4-ndk",
"android.hardware.biometrics.common.util",
+ "android.hardware.biometrics.common.config",
+ "android.hardware.biometrics.common.thread",
],
vendor: true,
test_suites: ["general-tests"],
@@ -92,6 +135,7 @@
srcs: [
"tests/FakeLockoutTrackerTest.cpp",
"FakeLockoutTracker.cpp",
+ "FaceConfig.cpp",
],
shared_libs: [
"libbase",
@@ -107,8 +151,45 @@
"android.hardware.biometrics.common-V4-ndk",
"android.hardware.keymaster-V4-ndk",
"android.hardware.biometrics.common.util",
+ "android.hardware.biometrics.common.config",
+ "android.hardware.biometrics.common.thread",
],
vendor: true,
test_suites: ["general-tests"],
require_root: true,
}
+
+cc_test {
+ name: "android.hardware.biometrics.face.VirtualHalTest",
+ srcs: [
+ "tests/VirtualHalTest.cpp",
+ "FakeLockoutTracker.cpp",
+ "Face.cpp",
+ "FakeFaceEngine.cpp",
+ "Session.cpp",
+ "VirtualHal.cpp",
+ "FaceConfig.cpp",
+ ],
+ shared_libs: [
+ "libbase",
+ "libbinder_ndk",
+ "libnativewindow",
+ "liblog",
+ ],
+ include_dirs: [
+ "frameworks/native/aidl/gui",
+ ],
+ static_libs: [
+ "android.hardware.biometrics.common-V4-ndk",
+ "android.hardware.biometrics.common.config",
+ "android.hardware.biometrics.common.thread",
+ "android.hardware.biometrics.common.util",
+ "android.hardware.biometrics.face-V4-ndk",
+ "android.hardware.common-V2-ndk",
+ "android.hardware.keymaster-V4-ndk",
+ "libandroid.hardware.biometrics.face.VirtualProps",
+ "android.hardware.biometrics.face.virtualhal-ndk",
+ ],
+ test_suites: ["general-tests"],
+ require_root: true,
+}
diff --git a/biometrics/face/aidl/default/Face.cpp b/biometrics/face/aidl/default/Face.cpp
index 5ae0df6..1543007 100644
--- a/biometrics/face/aidl/default/Face.cpp
+++ b/biometrics/face/aidl/default/Face.cpp
@@ -34,9 +34,7 @@
namespace aidl::android::hardware::biometrics::face {
const int kSensorId = 4;
-const common::SensorStrength kSensorStrength = FakeFaceEngine::GetSensorStrength();
const int kMaxEnrollmentsPerUser = 5;
-const FaceSensorType kSensorType = FakeFaceEngine::GetSensorType();
const bool kHalControlsPreview = true;
const std::string kHwComponentId = "faceSensor";
const std::string kHardwareVersion = "vendor/model/revision";
@@ -62,13 +60,13 @@
common::CommonProps commonProps;
commonProps.sensorId = kSensorId;
- commonProps.sensorStrength = kSensorStrength;
+ commonProps.sensorStrength = FakeFaceEngine::GetSensorStrength();
commonProps.maxEnrollmentsPerUser = kMaxEnrollmentsPerUser;
commonProps.componentInfo = {std::move(hw_component_info), std::move(sw_component_info)};
SensorProps props;
props.commonProps = std::move(commonProps);
- props.sensorType = kSensorType;
+ props.sensorType = FakeFaceEngine::GetSensorType();
props.halControlsPreview = kHalControlsPreview;
props.enrollPreviewWidth = 1080;
props.enrollPreviewHeight = 1920;
@@ -141,6 +139,30 @@
return STATUS_OK;
}
+const char* Face::type2String(FaceSensorType type) {
+ switch (type) {
+ case FaceSensorType::RGB:
+ return "rgb";
+ case FaceSensorType::IR:
+ return "ir";
+ default:
+ return "unknown";
+ }
+}
+
+const char* Face::strength2String(common::SensorStrength strength) {
+ switch (strength) {
+ case common::SensorStrength::STRONG:
+ return "STRONG";
+ case common::SensorStrength::WEAK:
+ return "WEAK";
+ case common::SensorStrength::CONVENIENCE:
+ return "CONVENIENCE";
+ default:
+ return "unknown";
+ }
+}
+
void Face::onHelp(int fd) {
dprintf(fd, "Virtual Face HAL commands:\n");
dprintf(fd, " help: print this help\n");
@@ -167,7 +189,6 @@
RESET_CONFIG_O(lockout);
RESET_CONFIG_O(operation_authenticate_fails);
RESET_CONFIG_O(operation_detect_interaction_fails);
- RESET_CONFIG_O(operation_enroll_fails);
RESET_CONFIG_V(operation_authenticate_latency);
RESET_CONFIG_V(operation_detect_interaction_latency);
RESET_CONFIG_V(operation_enroll_latency);
diff --git a/biometrics/face/aidl/default/Face.h b/biometrics/face/aidl/default/Face.h
index 93fddb0..dbe6341 100644
--- a/biometrics/face/aidl/default/Face.h
+++ b/biometrics/face/aidl/default/Face.h
@@ -17,6 +17,7 @@
#pragma once
#include <aidl/android/hardware/biometrics/face/BnFace.h>
+#include "FaceConfig.h"
#include "Session.h"
namespace aidl::android::hardware::biometrics::face {
@@ -33,9 +34,20 @@
binder_status_t dump(int fd, const char** args, uint32_t numArgs);
binder_status_t handleShellCommand(int in, int out, int err, const char** argv, uint32_t argc);
+ static FaceConfig& cfg() {
+ static FaceConfig* cfg = nullptr;
+ if (cfg == nullptr) {
+ cfg = new FaceConfig();
+ cfg->init();
+ }
+ return *cfg;
+ }
+ void resetConfigToDefault();
+ static const char* type2String(FaceSensorType type);
+ static const char* strength2String(common::SensorStrength strength);
+
private:
std::shared_ptr<Session> mSession;
- void resetConfigToDefault();
void onHelp(int);
};
diff --git a/biometrics/face/aidl/default/FaceConfig.cpp b/biometrics/face/aidl/default/FaceConfig.cpp
new file mode 100644
index 0000000..a91d7cc
--- /dev/null
+++ b/biometrics/face/aidl/default/FaceConfig.cpp
@@ -0,0 +1,93 @@
+/*
+ * Copyright (C) 2024 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define LOG_TAG "FaceConfig"
+
+#include "FaceConfig.h"
+
+#include <android-base/logging.h>
+
+#include <face.sysprop.h>
+
+using namespace ::android::face::virt;
+
+namespace aidl::android::hardware::biometrics::face {
+
+// Wrapper to system property access functions
+#define CREATE_GETTER_SETTER_WRAPPER(_NAME_, _T_) \
+ ConfigValue _NAME_##Getter() { \
+ return FaceHalProperties::_NAME_(); \
+ } \
+ bool _NAME_##Setter(const ConfigValue& v) { \
+ return FaceHalProperties::_NAME_(std::get<_T_>(v)); \
+ }
+
+CREATE_GETTER_SETTER_WRAPPER(type, OptString)
+CREATE_GETTER_SETTER_WRAPPER(enrollments, OptIntVec)
+CREATE_GETTER_SETTER_WRAPPER(enrollment_hit, OptInt32)
+CREATE_GETTER_SETTER_WRAPPER(next_enrollment, OptString)
+CREATE_GETTER_SETTER_WRAPPER(authenticator_id, OptInt64)
+CREATE_GETTER_SETTER_WRAPPER(challenge, OptInt64)
+CREATE_GETTER_SETTER_WRAPPER(strength, OptString)
+CREATE_GETTER_SETTER_WRAPPER(operation_authenticate_fails, OptBool)
+CREATE_GETTER_SETTER_WRAPPER(operation_authenticate_latency, OptIntVec)
+CREATE_GETTER_SETTER_WRAPPER(operation_authenticate_duration, OptInt32)
+CREATE_GETTER_SETTER_WRAPPER(operation_authenticate_error, OptInt32)
+CREATE_GETTER_SETTER_WRAPPER(operation_authenticate_acquired, OptString)
+CREATE_GETTER_SETTER_WRAPPER(operation_enroll_latency, OptIntVec)
+CREATE_GETTER_SETTER_WRAPPER(operation_detect_interaction_fails, OptBool)
+CREATE_GETTER_SETTER_WRAPPER(operation_detect_interaction_latency, OptIntVec)
+CREATE_GETTER_SETTER_WRAPPER(lockout, OptBool)
+CREATE_GETTER_SETTER_WRAPPER(lockout_enable, OptBool)
+CREATE_GETTER_SETTER_WRAPPER(lockout_timed_enable, OptBool)
+CREATE_GETTER_SETTER_WRAPPER(lockout_timed_threshold, OptInt32)
+CREATE_GETTER_SETTER_WRAPPER(lockout_timed_duration, OptInt32)
+CREATE_GETTER_SETTER_WRAPPER(lockout_permanent_threshold, OptInt32)
+CREATE_GETTER_SETTER_WRAPPER(features, OptIntVec)
+
+// Name, Getter, Setter, Parser and default value
+#define NGS(_NAME_) #_NAME_, _NAME_##Getter, _NAME_##Setter
+static Config::Data configData[] = {
+ {NGS(type), &Config::parseString, "rgb"},
+ {NGS(enrollments), &Config::parseIntVec, ""},
+ {NGS(enrollment_hit), &Config::parseInt32, "0"},
+ {NGS(next_enrollment), &Config::parseString,
+ "1:1000-[21,7,1,1103],1500-[1108,1],2000-[1113,1],2500-[1118,1]:true"},
+ {NGS(authenticator_id), &Config::parseInt64, "0"},
+ {NGS(challenge), &Config::parseInt64, ""},
+ {NGS(strength), &Config::parseString, "strong"},
+ {NGS(operation_authenticate_fails), &Config::parseBool, "false"},
+ {NGS(operation_authenticate_latency), &Config::parseIntVec, ""},
+ {NGS(operation_authenticate_duration), &Config::parseInt32, "500"},
+ {NGS(operation_authenticate_error), &Config::parseInt32, "0"},
+ {NGS(operation_authenticate_acquired), &Config::parseString, ""},
+ {NGS(operation_enroll_latency), &Config::parseIntVec, ""},
+ {NGS(operation_detect_interaction_latency), &Config::parseIntVec, ""},
+ {NGS(operation_detect_interaction_fails), &Config::parseBool, "false"},
+ {NGS(lockout), &Config::parseBool, "false"},
+ {NGS(lockout_enable), &Config::parseBool, "false"},
+ {NGS(lockout_timed_enable), &Config::parseBool, "false"},
+ {NGS(lockout_timed_threshold), &Config::parseInt32, "3"},
+ {NGS(lockout_timed_duration), &Config::parseInt32, "10000"},
+ {NGS(lockout_permanent_threshold), &Config::parseInt32, "5"},
+ {NGS(features), &Config::parseIntVec, ""}};
+
+Config::Data* FaceConfig::getConfigData(int* size) {
+ *size = sizeof(configData) / sizeof(configData[0]);
+ return configData;
+}
+
+} // namespace aidl::android::hardware::biometrics::face
diff --git a/biometrics/face/aidl/default/FaceConfig.h b/biometrics/face/aidl/default/FaceConfig.h
new file mode 100644
index 0000000..64b62e0
--- /dev/null
+++ b/biometrics/face/aidl/default/FaceConfig.h
@@ -0,0 +1,27 @@
+/*
+ * Copyright (C) 2024 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#include "config/Config.h"
+
+namespace aidl::android::hardware::biometrics::face {
+
+class FaceConfig : public Config {
+ Config::Data* getConfigData(int* size) override;
+};
+
+} // namespace aidl::android::hardware::biometrics::face
diff --git a/biometrics/face/aidl/default/FakeFaceEngine.cpp b/biometrics/face/aidl/default/FakeFaceEngine.cpp
index bf75874..70d9f2d 100644
--- a/biometrics/face/aidl/default/FakeFaceEngine.cpp
+++ b/biometrics/face/aidl/default/FakeFaceEngine.cpp
@@ -23,6 +23,7 @@
#include <face.sysprop.h>
+#include "Face.h"
#include "util/CancellationSignal.h"
#include "util/Util.h"
@@ -31,23 +32,23 @@
namespace aidl::android::hardware::biometrics::face {
FaceSensorType FakeFaceEngine::GetSensorType() {
- std::string type = FaceHalProperties::type().value_or("");
+ std::string type = Face::cfg().get<std::string>("type");
if (type == "IR") {
return FaceSensorType::IR;
} else {
- FaceHalProperties::type("RGB");
+ Face::cfg().set<std::string>("type", "RGB");
return FaceSensorType::RGB;
}
}
common::SensorStrength FakeFaceEngine::GetSensorStrength() {
- std::string strength = FaceHalProperties::strength().value_or("");
+ std::string strength = Face::cfg().get<std::string>("strength");
if (strength == "convenience") {
return common::SensorStrength::CONVENIENCE;
} else if (strength == "weak") {
return common::SensorStrength::WEAK;
} else {
- FaceHalProperties::strength("strong");
+ // Face::cfg().set<std::string>("strength", "strong");
return common::SensorStrength::STRONG;
}
}
@@ -56,13 +57,13 @@
BEGIN_OP(0);
std::uniform_int_distribution<int64_t> dist;
auto challenge = dist(mRandom);
- FaceHalProperties::challenge(challenge);
+ Face::cfg().set<int64_t>("challenge", challenge);
cb->onChallengeGenerated(challenge);
}
void FakeFaceEngine::revokeChallengeImpl(ISessionCallback* cb, int64_t challenge) {
BEGIN_OP(0);
- FaceHalProperties::challenge({});
+ Face::cfg().set<int64_t>("challenge", 0);
cb->onChallengeRevoked(challenge);
}
void FakeFaceEngine::getEnrollmentConfigImpl(ISessionCallback* /*cb*/,
@@ -71,7 +72,7 @@
EnrollmentType /*enrollmentType*/,
const std::vector<Feature>& /*features*/,
const std::future<void>& cancel) {
- BEGIN_OP(getLatency(FaceHalProperties::operation_enroll_latency()));
+ BEGIN_OP(getLatency(Face::cfg().getopt<OptIntVec>("operation_enroll_latency")));
// Do proper HAT verification in the real implementation.
if (hat.mac.empty()) {
@@ -80,18 +81,19 @@
return;
}
- // Format: <id>:<progress_ms-[acquiredInfo,...],...:<success>
- // ------:-----------------------------------------:--------------
- // | | |--->enrollment success (true/false)
- // | |--> progress_steps
+ // Format:
+ // <id>:<progress_ms-[acquiredInfo,...],...:<success>
+ // -------:--------------------------------------------------:--------------
+ // | | |--->enrollment
+ // success (true/false) | |--> progress_steps
// |
// |-->enrollment id
//
//
- // progress_steps
+ // progress_steps:
// <progress_duration>-[acquiredInfo,...]+
// ---------------------------- ---------------------
- // | |-> sequence of acquiredInfo code
+ // | |-> sequence of acquiredInfo code
// | --> time duration of the step in ms
//
// E.g. 1:2000-[21,1108,5,6,1],1000-[1113,4,1]:true
@@ -101,7 +103,7 @@
//
std::string defaultNextEnrollment =
"1:1000-[21,7,1,1103],1500-[1108,1],2000-[1113,1],2500-[1118,1]:true";
- auto nextEnroll = FaceHalProperties::next_enrollment().value_or(defaultNextEnrollment);
+ auto nextEnroll = Face::cfg().get<std::string>("next_enrollment");
auto parts = Util::split(nextEnroll, ":");
if (parts.size() != 3) {
LOG(ERROR) << "Fail: invalid next_enrollment:" << nextEnroll;
@@ -137,19 +139,19 @@
if (left == 0 && !IS_TRUE(parts[2])) { // end and failed
LOG(ERROR) << "Fail: requested by caller: " << nextEnroll;
- FaceHalProperties::next_enrollment({});
+ Face::cfg().setopt<OptString>("next_enrollment", std::nullopt);
cb->onError(Error::UNABLE_TO_PROCESS, 0 /* vendorCode */);
} else { // progress and update props if last time
LOG(INFO) << "onEnroll: " << enrollmentId << " left: " << left;
if (left == 0) {
- auto enrollments = FaceHalProperties::enrollments();
+ auto enrollments = Face::cfg().getopt<OptIntVec>("enrollments");
enrollments.emplace_back(enrollmentId);
- FaceHalProperties::enrollments(enrollments);
- FaceHalProperties::next_enrollment({});
+ Face::cfg().setopt<OptIntVec>("enrollments", enrollments);
+ Face::cfg().setopt<OptString>("next_enrollment", std::nullopt);
// change authenticatorId after new enrollment
- auto id = FaceHalProperties::authenticator_id().value_or(0);
+ auto id = Face::cfg().get<std::int64_t>("authenticator_id");
auto newId = id + 1;
- FaceHalProperties::authenticator_id(newId);
+ Face::cfg().set<std::int64_t>("authenticator_id", newId);
LOG(INFO) << "Enrolled: " << enrollmentId;
}
cb->onEnrollmentProgress(enrollmentId, left);
@@ -159,10 +161,12 @@
void FakeFaceEngine::authenticateImpl(ISessionCallback* cb, int64_t /*operationId*/,
const std::future<void>& cancel) {
- BEGIN_OP(getLatency(FaceHalProperties::operation_authenticate_latency()));
+ BEGIN_OP(getLatency(Face::cfg().getopt<OptIntVec>("operation_authenticate_latency")));
- auto id = FaceHalProperties::enrollment_hit().value_or(0);
- auto enrolls = FaceHalProperties::enrollments();
+ // SLEEP_MS(3000); //emulate hw HAL
+
+ auto id = Face::cfg().get<std::int32_t>("enrollment_hit");
+ auto enrolls = Face::cfg().getopt<OptIntVec>("enrollments");
auto isEnrolled = std::find(enrolls.begin(), enrolls.end(), id) != enrolls.end();
auto vec2str = [](std::vector<AcquiredInfo> va) {
@@ -192,10 +196,12 @@
}
int64_t now = Util::getSystemNanoTime();
- int64_t duration =
- FaceHalProperties::operation_authenticate_duration().value_or(defaultAuthDuration);
- auto acquired =
- FaceHalProperties::operation_authenticate_acquired().value_or(defaultAcquiredInfo);
+ int64_t duration = Face::cfg().get<std::int32_t>("operation_authenticate_duration");
+ auto acquired = Face::cfg().get<std::string>("operation_authenticate_acquired");
+ if (acquired.empty()) {
+ Face::cfg().set<std::string>("operation_authenticate_acquired", defaultAcquiredInfo);
+ acquired = defaultAcquiredInfo;
+ }
auto acquiredInfos = Util::parseIntSequence(acquired);
int N = acquiredInfos.size();
@@ -211,21 +217,21 @@
int i = 0;
do {
- if (FaceHalProperties::lockout().value_or(false)) {
+ if (Face::cfg().get<bool>("lockout")) {
LOG(ERROR) << "Fail: lockout";
cb->onLockoutPermanent();
cb->onError(Error::HW_UNAVAILABLE, 0 /* vendorError */);
return;
}
- if (FaceHalProperties::operation_authenticate_fails().value_or(false)) {
+ if (Face::cfg().get<bool>("operation_authenticate_fails")) {
LOG(ERROR) << "Fail: operation_authenticate_fails";
mLockoutTracker.addFailedAttempt(cb);
cb->onAuthenticationFailed();
return;
}
- auto err = FaceHalProperties::operation_authenticate_error().value_or(0);
+ auto err = Face::cfg().get<std::int32_t>("operation_authenticate_error");
if (err != 0) {
LOG(ERROR) << "Fail: operation_authenticate_error";
auto ec = convertError(err);
@@ -249,6 +255,15 @@
LOG(INFO) << "AcquiredInfo:" << i << ": (" << (int)ac.first << "," << (int)ac.second
<< ")";
i++;
+
+ // the captured face id may change during authentication period
+ auto idnew = Face::cfg().get<std::int32_t>("enrollment_hit");
+ if (id != idnew) {
+ isEnrolled = std::find(enrolls.begin(), enrolls.end(), idnew) != enrolls.end();
+ LOG(INFO) << "enrollment_hit changed from " << id << " to " << idnew;
+ id = idnew;
+ break;
+ }
}
SLEEP_MS(duration / N);
@@ -292,9 +307,9 @@
}
void FakeFaceEngine::detectInteractionImpl(ISessionCallback* cb, const std::future<void>& cancel) {
- BEGIN_OP(getLatency(FaceHalProperties::operation_detect_interaction_latency()));
+ BEGIN_OP(getLatency(Face::cfg().getopt<OptIntVec>("operation_detect_interaction_latency")));
- if (FaceHalProperties::operation_detect_interaction_fails().value_or(false)) {
+ if (Face::cfg().get<bool>("operation_detect_interaction_fails")) {
LOG(ERROR) << "Fail: operation_detect_interaction_fails";
cb->onError(Error::VENDOR, 0 /* vendorError */);
return;
@@ -306,8 +321,8 @@
return;
}
- auto id = FaceHalProperties::enrollment_hit().value_or(0);
- auto enrolls = FaceHalProperties::enrollments();
+ auto id = Face::cfg().get<std::int32_t>("enrollment_hit");
+ auto enrolls = Face::cfg().getopt<OptIntVec>("enrollments");
auto isEnrolled = std::find(enrolls.begin(), enrolls.end(), id) != enrolls.end();
if (id <= 0 || !isEnrolled) {
LOG(ERROR) << "Fail: not enrolled";
@@ -321,7 +336,7 @@
void FakeFaceEngine::enumerateEnrollmentsImpl(ISessionCallback* cb) {
BEGIN_OP(0);
std::vector<int32_t> enrollments;
- for (const auto& enrollmentId : FaceHalProperties::enrollments()) {
+ for (const auto& enrollmentId : Face::cfg().getopt<OptIntVec>("enrollments")) {
if (enrollmentId) {
enrollments.push_back(*enrollmentId);
}
@@ -334,20 +349,20 @@
BEGIN_OP(0);
std::vector<std::optional<int32_t>> newEnrollments;
- for (const auto& enrollment : FaceHalProperties::enrollments()) {
+ for (const auto& enrollment : Face::cfg().getopt<OptIntVec>("enrollments")) {
auto id = enrollment.value_or(0);
if (std::find(enrollmentIds.begin(), enrollmentIds.end(), id) == enrollmentIds.end()) {
newEnrollments.emplace_back(id);
}
}
- FaceHalProperties::enrollments(newEnrollments);
+ Face::cfg().setopt<OptIntVec>("enrollments", newEnrollments);
cb->onEnrollmentsRemoved(enrollmentIds);
}
void FakeFaceEngine::getFeaturesImpl(ISessionCallback* cb) {
BEGIN_OP(0);
- if (FaceHalProperties::enrollments().empty()) {
+ if (Face::cfg().getopt<OptIntVec>("enrollments").empty()) {
cb->onError(Error::UNABLE_TO_PROCESS, 0 /* vendorCode */);
return;
}
@@ -365,7 +380,7 @@
Feature feature, bool enabled) {
BEGIN_OP(0);
- if (FaceHalProperties::enrollments().empty()) {
+ if (Face::cfg().getopt<OptIntVec>("enrollments").empty()) {
LOG(ERROR) << "Unable to set feature, enrollments are empty";
cb->onError(Error::UNABLE_TO_PROCESS, 0 /* vendorCode */);
return;
@@ -377,7 +392,7 @@
return;
}
- auto features = FaceHalProperties::features();
+ auto features = Face::cfg().getopt<OptIntVec>("features");
auto itr = std::find_if(features.begin(), features.end(), [feature](const auto& theFeature) {
return *theFeature == (int)feature;
@@ -389,7 +404,7 @@
features.push_back((int)feature);
}
- FaceHalProperties::features(features);
+ Face::cfg().setopt<OptIntVec>("features", features);
cb->onFeatureSet(feature);
}
@@ -399,22 +414,22 @@
if (GetSensorStrength() != common::SensorStrength::STRONG) {
cb->onAuthenticatorIdRetrieved(0);
} else {
- cb->onAuthenticatorIdRetrieved(FaceHalProperties::authenticator_id().value_or(0));
+ cb->onAuthenticatorIdRetrieved(Face::cfg().get<std::int64_t>("authenticator_id"));
}
}
void FakeFaceEngine::invalidateAuthenticatorIdImpl(ISessionCallback* cb) {
BEGIN_OP(0);
- int64_t authenticatorId = FaceHalProperties::authenticator_id().value_or(0);
+ int64_t authenticatorId = Face::cfg().get<std::int64_t>("authenticator_id");
int64_t newId = authenticatorId + 1;
- FaceHalProperties::authenticator_id(newId);
+ Face::cfg().set<std::int64_t>("authenticator_id", newId);
cb->onAuthenticatorIdInvalidated(newId);
}
void FakeFaceEngine::resetLockoutImpl(ISessionCallback* cb,
const keymaster::HardwareAuthToken& /*hat*/) {
BEGIN_OP(0);
- FaceHalProperties::lockout(false);
+ Face::cfg().set<bool>("lockout", false);
mLockoutTracker.reset();
cb->onLockoutCleared();
}
diff --git a/biometrics/face/aidl/default/FakeLockoutTracker.cpp b/biometrics/face/aidl/default/FakeLockoutTracker.cpp
index 70bf08e..35d7c28 100644
--- a/biometrics/face/aidl/default/FakeLockoutTracker.cpp
+++ b/biometrics/face/aidl/default/FakeLockoutTracker.cpp
@@ -19,6 +19,7 @@
#include "FakeLockoutTracker.h"
#include <android-base/logging.h>
#include <face.sysprop.h>
+#include "Face.h"
#include "util/Util.h"
using namespace ::android::face::virt;
@@ -36,15 +37,15 @@
}
void FakeLockoutTracker::addFailedAttempt(ISessionCallback* cb) {
- bool lockoutEnabled = FaceHalProperties::lockout_enable().value_or(false);
- bool timedLockoutenabled = FaceHalProperties::lockout_timed_enable().value_or(false);
+ bool lockoutEnabled = Face::cfg().get<bool>("lockout_enable");
+ bool timedLockoutenabled = Face::cfg().get<bool>("lockout_timed_enable");
if (lockoutEnabled) {
mFailedCount++;
mTimedFailedCount++;
mLastFailedTime = Util::getSystemNanoTime();
- int32_t lockoutTimedThreshold = FaceHalProperties::lockout_timed_threshold().value_or(3);
+ int32_t lockoutTimedThreshold = Face::cfg().get<std::int32_t>("lockout_timed_threshold");
int32_t lockoutPermanetThreshold =
- FaceHalProperties::lockout_permanent_threshold().value_or(5);
+ Face::cfg().get<std::int32_t>("lockout_permanent_threshold");
if (mFailedCount >= lockoutPermanetThreshold) {
mCurrentMode = LockoutMode::kPermanent;
LOG(ERROR) << "FakeLockoutTracker: lockoutPermanent";
@@ -68,7 +69,7 @@
}
int32_t FakeLockoutTracker::getTimedLockoutDuration() {
- return FaceHalProperties::lockout_timed_duration().value_or(10 * 1000);
+ return Face::cfg().get<std::int32_t>("lockout_timed_duration");
}
int64_t FakeLockoutTracker::getLockoutTimeLeft() {
diff --git a/biometrics/face/aidl/default/VirtualHal.cpp b/biometrics/face/aidl/default/VirtualHal.cpp
new file mode 100644
index 0000000..52ac23b
--- /dev/null
+++ b/biometrics/face/aidl/default/VirtualHal.cpp
@@ -0,0 +1,275 @@
+/*
+ * Copyright (C) 2024 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <unordered_map>
+
+#include "VirtualHal.h"
+
+#include <android-base/logging.h>
+
+#include "util/CancellationSignal.h"
+
+#undef LOG_TAG
+#define LOG_TAG "FaceVirtualHalAidl"
+
+namespace aidl::android::hardware::biometrics::face {
+using AcquiredInfoAndVendorCode = virtualhal::AcquiredInfoAndVendorCode;
+using Tag = AcquiredInfoAndVendorCode::Tag;
+
+::ndk::ScopedAStatus VirtualHal::setEnrollments(const std::vector<int32_t>& enrollments) {
+ Face::cfg().sourcedFromAidl();
+ Face::cfg().setopt<OptIntVec>("enrollments", intVec2OptIntVec(enrollments));
+ return ndk::ScopedAStatus::ok();
+}
+
+::ndk::ScopedAStatus VirtualHal::setEnrollmentHit(int32_t enrollment_hit) {
+ Face::cfg().sourcedFromAidl();
+ Face::cfg().set<std::int32_t>("enrollment_hit", enrollment_hit);
+ return ndk::ScopedAStatus::ok();
+}
+
+::ndk::ScopedAStatus VirtualHal::setNextEnrollment(
+ const ::aidl::android::hardware::biometrics::face::NextEnrollment& next_enrollment) {
+ Face::cfg().sourcedFromAidl();
+ std::ostringstream os;
+ os << next_enrollment.id << ":";
+
+ int stepSize = next_enrollment.progressSteps.size();
+ for (int i = 0; i < stepSize; i++) {
+ auto& step = next_enrollment.progressSteps[i];
+ os << step.durationMs;
+ int acSize = step.acquiredInfoAndVendorCodes.size();
+ for (int j = 0; j < acSize; j++) {
+ if (j == 0) os << "-[";
+ auto& acquiredInfoAndVendorCode = step.acquiredInfoAndVendorCodes[j];
+ if (acquiredInfoAndVendorCode.getTag() == AcquiredInfoAndVendorCode::vendorCode)
+ os << acquiredInfoAndVendorCode.get<Tag::vendorCode>();
+ else if (acquiredInfoAndVendorCode.getTag() == AcquiredInfoAndVendorCode::acquiredInfo)
+ os << (int)acquiredInfoAndVendorCode.get<Tag::acquiredInfo>();
+ else
+ LOG(FATAL) << "ERROR: wrong AcquiredInfoAndVendorCode union tag";
+ if (j == acSize - 1)
+ os << "]";
+ else
+ os << ",";
+ }
+ if (i == stepSize - 1)
+ os << ":";
+ else
+ os << ",";
+ }
+
+ os << (next_enrollment.result ? "true" : "false");
+ Face::cfg().set<std::string>("next_enrollment", os.str());
+ return ndk::ScopedAStatus::ok();
+}
+
+::ndk::ScopedAStatus VirtualHal::setAuthenticatorId(int64_t in_id) {
+ Face::cfg().sourcedFromAidl();
+ Face::cfg().set<int64_t>("authenticator_id", in_id);
+ return ndk::ScopedAStatus::ok();
+}
+
+::ndk::ScopedAStatus VirtualHal::setChallenge(int64_t in_challenge) {
+ Face::cfg().sourcedFromAidl();
+ Face::cfg().set<int64_t>("challenge", in_challenge);
+ return ndk::ScopedAStatus::ok();
+}
+
+::ndk::ScopedAStatus VirtualHal::setOperationAuthenticateFails(bool in_fail) {
+ Face::cfg().sourcedFromAidl();
+ Face::cfg().set<bool>("operation_authenticate_fails", in_fail);
+ return ndk::ScopedAStatus::ok();
+}
+
+::ndk::ScopedAStatus VirtualHal::setOperationAuthenticateLatency(
+ const std::vector<int32_t>& in_latency) {
+ ndk::ScopedAStatus status = sanityCheckLatency(in_latency);
+ if (!status.isOk()) {
+ return status;
+ }
+
+ Face::cfg().sourcedFromAidl();
+ Face::cfg().setopt<OptIntVec>("operation_authenticate_latency", intVec2OptIntVec(in_latency));
+ return ndk::ScopedAStatus::ok();
+}
+
+::ndk::ScopedAStatus VirtualHal::setOperationAuthenticateDuration(int32_t in_duration) {
+ if (in_duration < 0) {
+ return ndk::ScopedAStatus(AStatus_fromServiceSpecificErrorWithMessage(
+ IVirtualHal::STATUS_INVALID_PARAMETER, "Error: duration can not be negative"));
+ }
+ Face::cfg().sourcedFromAidl();
+ Face::cfg().set<int32_t>("operation_authenticate_duration", in_duration);
+ return ndk::ScopedAStatus::ok();
+}
+
+::ndk::ScopedAStatus VirtualHal::setOperationAuthenticateError(int32_t in_error) {
+ Face::cfg().sourcedFromAidl();
+ Face::cfg().set<int32_t>("operation_authenticate_error", in_error);
+ return ndk::ScopedAStatus::ok();
+}
+
+::ndk::ScopedAStatus VirtualHal::setOperationAuthenticateAcquired(
+ const std::vector<AcquiredInfoAndVendorCode>& in_acquired) {
+ Face::cfg().sourcedFromAidl();
+ Face::cfg().setopt<OptIntVec>("operation_authenticate_acquired",
+ acquiredInfoVec2OptIntVec(in_acquired));
+ return ndk::ScopedAStatus::ok();
+}
+
+::ndk::ScopedAStatus VirtualHal::setOperationEnrollLatency(const std::vector<int32_t>& in_latency) {
+ ndk::ScopedAStatus status = sanityCheckLatency(in_latency);
+ if (!status.isOk()) {
+ return status;
+ }
+ Face::cfg().sourcedFromAidl();
+ Face::cfg().setopt<OptIntVec>("operation_enroll_latency", intVec2OptIntVec(in_latency));
+ return ndk::ScopedAStatus::ok();
+}
+
+::ndk::ScopedAStatus VirtualHal::setOperationDetectInteractionLatency(
+ const std::vector<int32_t>& in_latency) {
+ ndk::ScopedAStatus status = sanityCheckLatency(in_latency);
+ if (!status.isOk()) {
+ return status;
+ }
+ Face::cfg().sourcedFromAidl();
+ Face::cfg().setopt<OptIntVec>("operation_detect_interact_latency",
+ intVec2OptIntVec(in_latency));
+ return ndk::ScopedAStatus::ok();
+}
+
+::ndk::ScopedAStatus VirtualHal::setOperationDetectInteractionFails(bool in_fails) {
+ Face::cfg().sourcedFromAidl();
+ Face::cfg().set<bool>("operation_detect_interaction_fails", in_fails);
+ return ndk::ScopedAStatus::ok();
+}
+
+::ndk::ScopedAStatus VirtualHal::setLockout(bool in_lockout) {
+ Face::cfg().sourcedFromAidl();
+ Face::cfg().set<bool>("lockout", in_lockout);
+ return ndk::ScopedAStatus::ok();
+}
+
+::ndk::ScopedAStatus VirtualHal::setLockoutEnable(bool in_enable) {
+ Face::cfg().sourcedFromAidl();
+ Face::cfg().set<bool>("lockout_enable", in_enable);
+ return ndk::ScopedAStatus::ok();
+}
+
+::ndk::ScopedAStatus VirtualHal::setLockoutTimedEnable(bool in_enable) {
+ Face::cfg().sourcedFromAidl();
+ Face::cfg().set<bool>("lockout_timed_enable", in_enable);
+ return ndk::ScopedAStatus::ok();
+}
+
+::ndk::ScopedAStatus VirtualHal::setLockoutTimedThreshold(int32_t in_threshold) {
+ if (in_threshold < 0) {
+ return ndk::ScopedAStatus(AStatus_fromServiceSpecificErrorWithMessage(
+ IVirtualHal::STATUS_INVALID_PARAMETER, "Error: threshold can not be negative"));
+ }
+ Face::cfg().sourcedFromAidl();
+ Face::cfg().set<int32_t>("lockout_timed_threshold", in_threshold);
+ return ndk::ScopedAStatus::ok();
+}
+
+::ndk::ScopedAStatus VirtualHal::setLockoutTimedDuration(int32_t in_duration) {
+ if (in_duration < 0) {
+ return ndk::ScopedAStatus(AStatus_fromServiceSpecificErrorWithMessage(
+ IVirtualHal::STATUS_INVALID_PARAMETER, "Error: duration can not be negative"));
+ }
+ Face::cfg().sourcedFromAidl();
+ Face::cfg().set<int32_t>("lockout_timed_duration", in_duration);
+ return ndk::ScopedAStatus::ok();
+}
+
+::ndk::ScopedAStatus VirtualHal::setLockoutPermanentThreshold(int32_t in_threshold) {
+ if (in_threshold < 0) {
+ return ndk::ScopedAStatus(AStatus_fromServiceSpecificErrorWithMessage(
+ IVirtualHal::STATUS_INVALID_PARAMETER, "Error: threshold can not be negative"));
+ }
+ Face::cfg().sourcedFromAidl();
+ Face::cfg().set<int32_t>("lockout_permanent_threshold", in_threshold);
+ return ndk::ScopedAStatus::ok();
+}
+
+::ndk::ScopedAStatus VirtualHal::resetConfigurations() {
+ Face::cfg().sourcedFromAidl();
+ Face::cfg().init();
+ return ndk::ScopedAStatus::ok();
+}
+
+::ndk::ScopedAStatus VirtualHal::setType(
+ ::aidl::android::hardware::biometrics::face::FaceSensorType in_type) {
+ Face::cfg().sourcedFromAidl();
+ Face::cfg().set<std::string>("type", Face::type2String(in_type));
+ return ndk::ScopedAStatus::ok();
+}
+
+::ndk::ScopedAStatus VirtualHal::setSensorStrength(common::SensorStrength in_strength) {
+ Face::cfg().sourcedFromAidl();
+ Face::cfg().set<std::string>("strength", Face::strength2String(in_strength));
+ return ndk::ScopedAStatus::ok();
+}
+
+OptIntVec VirtualHal::intVec2OptIntVec(const std::vector<int32_t>& in_vec) {
+ OptIntVec optIntVec;
+ std::transform(in_vec.begin(), in_vec.end(), std::back_inserter(optIntVec),
+ [](int value) { return std::optional<int>(value); });
+ return optIntVec;
+}
+
+OptIntVec VirtualHal::acquiredInfoVec2OptIntVec(
+ const std::vector<AcquiredInfoAndVendorCode>& in_vec) {
+ OptIntVec optIntVec;
+ std::transform(in_vec.begin(), in_vec.end(), std::back_inserter(optIntVec),
+ [](AcquiredInfoAndVendorCode ac) {
+ int value;
+ if (ac.getTag() == AcquiredInfoAndVendorCode::acquiredInfo)
+ value = (int)ac.get<Tag::acquiredInfo>();
+ else if (ac.getTag() == AcquiredInfoAndVendorCode::vendorCode)
+ value = ac.get<Tag::vendorCode>();
+ else
+ LOG(FATAL) << "ERROR: wrong AcquiredInfoAndVendorCode tag";
+ return std::optional<int>(value);
+ });
+ return optIntVec;
+}
+
+::ndk::ScopedAStatus VirtualHal::sanityCheckLatency(const std::vector<int32_t>& in_latency) {
+ if (in_latency.size() == 0 || in_latency.size() > 2) {
+ return ndk::ScopedAStatus(AStatus_fromServiceSpecificErrorWithMessage(
+ IVirtualHal::STATUS_INVALID_PARAMETER,
+ "Error: input input array must contain 1 or 2 elements"));
+ }
+
+ for (auto x : in_latency) {
+ if (x < 0) {
+ return ndk::ScopedAStatus(AStatus_fromServiceSpecificErrorWithMessage(
+ IVirtualHal::STATUS_INVALID_PARAMETER,
+ "Error: input data must not be negative"));
+ }
+ }
+
+ return ndk::ScopedAStatus::ok();
+}
+
+::ndk::ScopedAStatus VirtualHal::getFaceHal(std::shared_ptr<IFace>* pFace) {
+ *pFace = mFp;
+ return ndk::ScopedAStatus::ok();
+}
+} // namespace aidl::android::hardware::biometrics::face
diff --git a/biometrics/face/aidl/default/VirtualHal.h b/biometrics/face/aidl/default/VirtualHal.h
new file mode 100644
index 0000000..f2ac552
--- /dev/null
+++ b/biometrics/face/aidl/default/VirtualHal.h
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2024 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#include <aidl/android/hardware/biometrics/face/virtualhal/BnVirtualHal.h>
+
+#include "Face.h"
+
+namespace aidl::android::hardware::biometrics::face {
+using namespace virtualhal;
+class VirtualHal : public BnVirtualHal {
+ public:
+ VirtualHal(std::shared_ptr<Face> fp) : mFp(fp) {}
+
+ ::ndk::ScopedAStatus setEnrollments(const std::vector<int32_t>& in_id) override;
+ ::ndk::ScopedAStatus setEnrollmentHit(int32_t in_hit_id) override;
+ ::ndk::ScopedAStatus setNextEnrollment(
+ const ::aidl::android::hardware::biometrics::face::NextEnrollment& in_next_enrollment)
+ override;
+ ::ndk::ScopedAStatus setAuthenticatorId(int64_t in_id) override;
+ ::ndk::ScopedAStatus setChallenge(int64_t in_challenge) override;
+ ::ndk::ScopedAStatus setOperationAuthenticateFails(bool in_fail) override;
+ ::ndk::ScopedAStatus setOperationAuthenticateLatency(
+ const std::vector<int32_t>& in_latency) override;
+ ::ndk::ScopedAStatus setOperationAuthenticateDuration(int32_t in_duration) override;
+ ::ndk::ScopedAStatus setOperationAuthenticateError(int32_t in_error) override;
+ ::ndk::ScopedAStatus setOperationAuthenticateAcquired(
+ const std::vector<AcquiredInfoAndVendorCode>& in_acquired) override;
+ ::ndk::ScopedAStatus setOperationEnrollLatency(const std::vector<int32_t>& in_latency) override;
+ ::ndk::ScopedAStatus setOperationDetectInteractionLatency(
+ const std::vector<int32_t>& in_latency) override;
+ ::ndk::ScopedAStatus setOperationDetectInteractionFails(bool in_fails) override;
+ ::ndk::ScopedAStatus setLockout(bool in_lockout) override;
+ ::ndk::ScopedAStatus setLockoutEnable(bool in_enable) override;
+ ::ndk::ScopedAStatus setLockoutTimedEnable(bool in_enable) override;
+ ::ndk::ScopedAStatus setLockoutTimedThreshold(int32_t in_threshold) override;
+ ::ndk::ScopedAStatus setLockoutTimedDuration(int32_t in_duration) override;
+ ::ndk::ScopedAStatus setLockoutPermanentThreshold(int32_t in_threshold) override;
+ ::ndk::ScopedAStatus resetConfigurations() override;
+ ::ndk::ScopedAStatus setType(
+ ::aidl::android::hardware::biometrics::face::FaceSensorType in_type) override;
+ ::ndk::ScopedAStatus setSensorStrength(common::SensorStrength in_strength) override;
+ ::ndk::ScopedAStatus getFaceHal(std::shared_ptr<IFace>* _aidl_return);
+
+ private:
+ OptIntVec intVec2OptIntVec(const std::vector<int32_t>& intVec);
+ OptIntVec acquiredInfoVec2OptIntVec(const std::vector<AcquiredInfoAndVendorCode>& intVec);
+ ::ndk::ScopedAStatus sanityCheckLatency(const std::vector<int32_t>& in_latency);
+ std::shared_ptr<Face> mFp;
+};
+
+} // namespace aidl::android::hardware::biometrics::face
diff --git a/biometrics/face/aidl/default/apex/Android.bp b/biometrics/face/aidl/default/apex/Android.bp
index 86c4e12..c4632d4 100644
--- a/biometrics/face/aidl/default/apex/Android.bp
+++ b/biometrics/face/aidl/default/apex/Android.bp
@@ -23,7 +23,7 @@
key: "com.android.hardware.key",
certificate: ":com.android.hardware.certificate",
updatable: false,
- vendor: true,
+ system_ext_specific: true,
binaries: [
// hal
@@ -31,9 +31,7 @@
],
prebuilts: [
// init_rc
- "face-example-apex.rc",
- // vintf_fragment
- "face-example-apex.xml",
+ "face-virtual-apex.rc",
],
overrides: [
@@ -42,21 +40,7 @@
}
prebuilt_etc {
- name: "face-example-apex.rc",
- src: ":gen-face-example-apex.rc",
- installable: false,
-}
-
-genrule {
- name: "gen-face-example-apex.rc",
- srcs: [":face-example.rc"],
- out: ["face-example-apex.rc"],
- cmd: "sed -e 's@/vendor/bin/@/apex/com.android.hardware.biometrics.face.virtual/bin/@' $(in) > $(out)",
-}
-
-prebuilt_etc {
- name: "face-example-apex.xml",
- src: ":face-example.xml",
- sub_dir: "vintf",
+ name: "face-virtual-apex.rc",
+ src: ":face-virtual.rc",
installable: false,
}
diff --git a/biometrics/face/aidl/default/api/android.hardware.biometrics.face.VirtualProps-current.txt b/biometrics/face/aidl/default/api/android.hardware.biometrics.face.VirtualProps-current.txt
index e69de29..6ad579c 100644
--- a/biometrics/face/aidl/default/api/android.hardware.biometrics.face.VirtualProps-current.txt
+++ b/biometrics/face/aidl/default/api/android.hardware.biometrics.face.VirtualProps-current.txt
@@ -0,0 +1,133 @@
+props {
+ owner: Vendor
+ module: "android.face.virt.FaceHalProperties"
+ prop {
+ api_name: "authenticator_id"
+ type: Long
+ access: ReadWrite
+ prop_name: "vendor.face.virtual.authenticator_id"
+ }
+ prop {
+ api_name: "challenge"
+ type: Long
+ access: ReadWrite
+ prop_name: "vendor.face.virtual.challenge"
+ }
+ prop {
+ api_name: "enrollment_hit"
+ type: Integer
+ access: ReadWrite
+ prop_name: "vendor.face.virtual.enrollment_hit"
+ }
+ prop {
+ api_name: "enrollments"
+ type: IntegerList
+ access: ReadWrite
+ prop_name: "persist.vendor.face.virtual.enrollments"
+ }
+ prop {
+ api_name: "features"
+ type: IntegerList
+ access: ReadWrite
+ prop_name: "persist.vendor.face.virtual.features"
+ }
+ prop {
+ api_name: "lockout"
+ access: ReadWrite
+ prop_name: "vendor.face.virtual.lockout"
+ }
+ prop {
+ api_name: "lockout_enable"
+ access: ReadWrite
+ prop_name: "persist.vendor.face.virtual.lockout_enable"
+ }
+ prop {
+ api_name: "lockout_permanent_threshold"
+ type: Integer
+ access: ReadWrite
+ prop_name: "persist.vendor.face.virtual.lockout_permanent_threshold"
+ }
+ prop {
+ api_name: "lockout_timed_duration"
+ type: Integer
+ access: ReadWrite
+ prop_name: "persist.vendor.face.virtual.lockout_timed_duration"
+ }
+ prop {
+ api_name: "lockout_timed_enable"
+ access: ReadWrite
+ prop_name: "persist.vendor.face.virtual.lockout_timed_enable"
+ }
+ prop {
+ api_name: "lockout_timed_threshold"
+ type: Integer
+ access: ReadWrite
+ prop_name: "persist.vendor.face.virtual.lockout_timed_threshold"
+ }
+ prop {
+ api_name: "next_enrollment"
+ type: String
+ access: ReadWrite
+ prop_name: "vendor.face.virtual.next_enrollment"
+ }
+ prop {
+ api_name: "operation_authenticate_acquired"
+ type: String
+ access: ReadWrite
+ prop_name: "vendor.face.virtual.operation_authenticate_acquired"
+ }
+ prop {
+ api_name: "operation_authenticate_duration"
+ type: Integer
+ access: ReadWrite
+ prop_name: "vendor.face.virtual.operation_authenticate_duration"
+ }
+ prop {
+ api_name: "operation_authenticate_error"
+ type: Integer
+ access: ReadWrite
+ prop_name: "vendor.face.virtual.operation_authenticate_error"
+ }
+ prop {
+ api_name: "operation_authenticate_fails"
+ access: ReadWrite
+ prop_name: "vendor.face.virtual.operation_authenticate_fails"
+ }
+ prop {
+ api_name: "operation_authenticate_latency"
+ type: IntegerList
+ access: ReadWrite
+ prop_name: "vendor.face.virtual.operation_authenticate_latency"
+ }
+ prop {
+ api_name: "operation_detect_interaction_fails"
+ access: ReadWrite
+ prop_name: "vendor.face.virtual.operation_detect_interaction_fails"
+ }
+ prop {
+ api_name: "operation_detect_interaction_latency"
+ type: IntegerList
+ access: ReadWrite
+ prop_name: "vendor.face.virtual.operation_detect_interaction_latency"
+ }
+ prop {
+ api_name: "operation_enroll_latency"
+ type: IntegerList
+ access: ReadWrite
+ prop_name: "vendor.face.virtual.operation_enroll_latency"
+ }
+ prop {
+ api_name: "strength"
+ type: String
+ access: ReadWrite
+ prop_name: "persist.vendor.face.virtual.strength"
+ enum_values: "convenience|weak|strong"
+ }
+ prop {
+ api_name: "type"
+ type: String
+ access: ReadWrite
+ prop_name: "persist.vendor.face.virtual.type"
+ enum_values: "IR|RGB"
+ }
+}
diff --git a/biometrics/face/aidl/default/face-default.rc b/biometrics/face/aidl/default/face-default.rc
new file mode 100644
index 0000000..7ce4249
--- /dev/null
+++ b/biometrics/face/aidl/default/face-default.rc
@@ -0,0 +1,8 @@
+service vendor.face-default /vendor/bin/hw/android.hardware.biometrics.face-service.default default
+ class hal
+ user nobody
+ group nobody
+ interface aidl android.hardware.biometrics.face.IFace/default
+ oneshot
+ disabled
+
diff --git a/biometrics/face/aidl/default/face-example.xml b/biometrics/face/aidl/default/face-default.xml
similarity index 81%
rename from biometrics/face/aidl/default/face-example.xml
rename to biometrics/face/aidl/default/face-default.xml
index 2b39b3d..94569de 100644
--- a/biometrics/face/aidl/default/face-example.xml
+++ b/biometrics/face/aidl/default/face-default.xml
@@ -2,6 +2,6 @@
<hal format="aidl">
<name>android.hardware.biometrics.face</name>
<version>4</version>
- <fqname>IFace/virtual</fqname>
+ <fqname>IFace/default</fqname>
</hal>
</manifest>
diff --git a/biometrics/face/aidl/default/face-example.rc b/biometrics/face/aidl/default/face-example.rc
deleted file mode 100644
index b0d82c6..0000000
--- a/biometrics/face/aidl/default/face-example.rc
+++ /dev/null
@@ -1,8 +0,0 @@
-service vendor.face-example /vendor/bin/hw/android.hardware.biometrics.face-service.example
- class hal
- user nobody
- group nobody
- interface aidl android.hardware.biometrics.face.IFace/virtual
- oneshot
- disabled
-
diff --git a/biometrics/face/aidl/default/face-virtual.rc b/biometrics/face/aidl/default/face-virtual.rc
new file mode 100644
index 0000000..8fb0a7b
--- /dev/null
+++ b/biometrics/face/aidl/default/face-virtual.rc
@@ -0,0 +1,8 @@
+service face-virtual /apex/com.android.hardware.biometrics.face.virtual/bin/hw/android.hardware.biometrics.face-service.example virtual
+ class hal
+ user nobody
+ group nobody
+ interface aidl android.hardware.biometrics.face.virtualhal.IVirtualHal/virtual
+ oneshot
+ disabled
+
diff --git a/biometrics/face/aidl/default/face.sysprop b/biometrics/face/aidl/default/face.sysprop
index 997fd67..ec2b92b 100644
--- a/biometrics/face/aidl/default/face.sysprop
+++ b/biometrics/face/aidl/default/face.sysprop
@@ -7,7 +7,7 @@
prop {
prop_name: "persist.vendor.face.virtual.type"
type: String
- scope: Internal
+ scope: Public
access: ReadWrite
enum_values: "IR|RGB"
api_name: "type"
@@ -17,7 +17,7 @@
prop {
prop_name: "persist.vendor.face.virtual.strength"
type: String
- scope: Internal
+ scope: Public
access: ReadWrite
enum_values: "convenience|weak|strong"
api_name: "strength"
@@ -27,7 +27,7 @@
prop {
prop_name: "persist.vendor.face.virtual.enrollments"
type: IntegerList
- scope: Internal
+ scope: Public
access: ReadWrite
api_name: "enrollments"
}
@@ -36,7 +36,7 @@
prop {
prop_name: "persist.vendor.face.virtual.features"
type: IntegerList
- scope: Internal
+ scope: Public
access: ReadWrite
api_name: "features"
}
@@ -46,7 +46,7 @@
prop {
prop_name: "vendor.face.virtual.enrollment_hit"
type: Integer
- scope: Internal
+ scope: Public
access: ReadWrite
api_name: "enrollment_hit"
}
@@ -60,7 +60,7 @@
prop {
prop_name: "vendor.face.virtual.next_enrollment"
type: String
- scope: Internal
+ scope: Public
access: ReadWrite
api_name: "next_enrollment"
}
@@ -69,7 +69,7 @@
prop {
prop_name: "vendor.face.virtual.authenticator_id"
type: Long
- scope: Internal
+ scope: Public
access: ReadWrite
api_name: "authenticator_id"
}
@@ -78,7 +78,7 @@
prop {
prop_name: "vendor.face.virtual.challenge"
type: Long
- scope: Internal
+ scope: Public
access: ReadWrite
api_name: "challenge"
}
@@ -87,7 +87,7 @@
prop {
prop_name: "vendor.face.virtual.lockout"
type: Boolean
- scope: Internal
+ scope: Public
access: ReadWrite
api_name: "lockout"
}
@@ -96,7 +96,7 @@
prop {
prop_name: "vendor.face.virtual.operation_authenticate_fails"
type: Boolean
- scope: Internal
+ scope: Public
access: ReadWrite
api_name: "operation_authenticate_fails"
}
@@ -105,27 +105,18 @@
prop {
prop_name: "vendor.face.virtual.operation_detect_interaction_fails"
type: Boolean
- scope: Internal
+ scope: Public
access: ReadWrite
api_name: "operation_detect_interaction_fails"
}
-# force all enroll operations to fail
-prop {
- prop_name: "vendor.face.virtual.operation_enroll_fails"
- type: Boolean
- scope: Internal
- access: ReadWrite
- api_name: "operation_enroll_fails"
-}
-
# add a latency to authentication operations
# Note that this latency is the initial authentication latency that occurs before
# the HAL will send AcquiredInfo::START and AcquiredInfo::FIRST_FRAME_RECEIVED
prop {
prop_name: "vendor.face.virtual.operation_authenticate_latency"
type: IntegerList
- scope: Internal
+ scope: Public
access: ReadWrite
api_name: "operation_authenticate_latency"
}
@@ -134,7 +125,7 @@
prop {
prop_name: "vendor.face.virtual.operation_detect_interaction_latency"
type: IntegerList
- scope: Internal
+ scope: Public
access: ReadWrite
api_name: "operation_detect_interaction_latency"
}
@@ -143,7 +134,7 @@
prop {
prop_name: "vendor.face.virtual.operation_enroll_latency"
type: IntegerList
- scope: Internal
+ scope: Public
access: ReadWrite
api_name: "operation_enroll_latency"
}
@@ -153,7 +144,7 @@
prop {
prop_name: "vendor.face.virtual.operation_authenticate_duration"
type: Integer
- scope: Internal
+ scope: Public
access: ReadWrite
api_name: "operation_authenticate_duration"
}
@@ -162,7 +153,7 @@
prop {
prop_name: "vendor.face.virtual.operation_authenticate_error"
type: Integer
- scope: Internal
+ scope: Public
access: ReadWrite
api_name: "operation_authenticate_error"
}
@@ -171,7 +162,7 @@
prop {
prop_name: "vendor.face.virtual.operation_authenticate_acquired"
type: String
- scope: Internal
+ scope: Public
access: ReadWrite
api_name: "operation_authenticate_acquired"
}
@@ -180,7 +171,7 @@
prop {
prop_name: "persist.vendor.face.virtual.lockout_enable"
type: Boolean
- scope: Internal
+ scope: Public
access: ReadWrite
api_name: "lockout_enable"
}
@@ -189,7 +180,7 @@
prop {
prop_name: "persist.vendor.face.virtual.lockout_timed_enable"
type: Boolean
- scope: Internal
+ scope: Public
access: ReadWrite
api_name: "lockout_timed_enable"
}
@@ -198,7 +189,7 @@
prop {
prop_name: "persist.vendor.face.virtual.lockout_timed_threshold"
type: Integer
- scope: Internal
+ scope: Public
access: ReadWrite
api_name: "lockout_timed_threshold"
}
@@ -207,7 +198,7 @@
prop {
prop_name: "persist.vendor.face.virtual.lockout_timed_duration"
type: Integer
- scope: Internal
+ scope: Public
access: ReadWrite
api_name: "lockout_timed_duration"
}
@@ -216,7 +207,7 @@
prop {
prop_name: "persist.vendor.face.virtual.lockout_permanent_threshold"
type: Integer
- scope: Internal
+ scope: Public
access: ReadWrite
api_name: "lockout_permanent_threshold"
}
diff --git a/biometrics/face/aidl/default/main.cpp b/biometrics/face/aidl/default/main.cpp
index 38e1c63..75a4479 100644
--- a/biometrics/face/aidl/default/main.cpp
+++ b/biometrics/face/aidl/default/main.cpp
@@ -14,25 +14,49 @@
* limitations under the License.
*/
+#undef LOG_TAG
+#define LOG_TAG "FaceVirtualHal"
+
#include "Face.h"
+#include "VirtualHal.h"
#include <android-base/logging.h>
#include <android/binder_manager.h>
#include <android/binder_process.h>
using aidl::android::hardware::biometrics::face::Face;
+using aidl::android::hardware::biometrics::face::VirtualHal;
-int main() {
- LOG(INFO) << "Face HAL started";
+int main(int argc, char** argv) {
+ if (argc < 2) {
+ LOG(ERROR) << "Missing argument -> exiting, Valid arguments:[default|virtual]";
+ return EXIT_FAILURE;
+ }
+ LOG(INFO) << "Face HAL started: " << argv[1];
ABinderProcess_setThreadPoolMaxThreadCount(0);
std::shared_ptr<Face> hal = ndk::SharedRefBase::make<Face>();
+ std::shared_ptr<VirtualHal> hal_vhal = ndk::SharedRefBase::make<VirtualHal>(hal);
- const std::string instance = std::string(Face::descriptor) + "/virtual";
- binder_status_t status =
- AServiceManager_registerLazyService(hal->asBinder().get(), instance.c_str());
- CHECK_EQ(status, STATUS_OK);
+ if (strcmp(argv[1], "default") == 0) {
+ const std::string instance = std::string(Face::descriptor) + "/default";
+ auto binder = hal->asBinder();
+ binder_status_t status =
+ AServiceManager_registerLazyService(binder.get(), instance.c_str());
+ CHECK_EQ(status, STATUS_OK);
+ LOG(INFO) << "started IFace/default";
+ } else if (strcmp(argv[1], "virtual") == 0) {
+ const std::string instance = std::string(VirtualHal::descriptor) + "/virtual";
+ auto binder = hal_vhal->asBinder();
+ binder_status_t status =
+ AServiceManager_registerLazyService(binder.get(), instance.c_str());
+ CHECK_EQ(status, STATUS_OK);
+ LOG(INFO) << "started IVirtualHal/virtual";
+ } else {
+ LOG(ERROR) << "Unexpected argument: " << argv[1];
+ return EXIT_FAILURE;
+ }
AServiceManager_forceLazyServicesPersist(true);
ABinderProcess_joinThreadPool();
- return EXIT_FAILURE; // should not reach
+ return EXIT_FAILURE; // should not reach here
}
diff --git a/biometrics/face/aidl/default/tests/FakeFaceEngineTest.cpp b/biometrics/face/aidl/default/tests/FakeFaceEngineTest.cpp
index 8c39b58..d448532 100644
--- a/biometrics/face/aidl/default/tests/FakeFaceEngineTest.cpp
+++ b/biometrics/face/aidl/default/tests/FakeFaceEngineTest.cpp
@@ -21,6 +21,7 @@
#include <aidl/android/hardware/biometrics/face/BnSessionCallback.h>
#include <android-base/logging.h>
+#include "Face.h"
#include "FakeFaceEngine.h"
#include "util/Util.h"
@@ -141,12 +142,12 @@
}
void TearDown() override {
- FaceHalProperties::enrollments({});
- FaceHalProperties::challenge({});
- FaceHalProperties::features({});
- FaceHalProperties::authenticator_id({});
- FaceHalProperties::strength("");
- FaceHalProperties::operation_detect_interaction_latency({});
+ Face::cfg().setopt<OptIntVec>("enrollments", {});
+ Face::cfg().set<std::int64_t>("challenge", 0);
+ Face::cfg().setopt<OptIntVec>("features", {});
+ Face::cfg().set<std::int64_t>("authenticator_id", 0);
+ Face::cfg().set<std::string>("strength", "");
+ Face::cfg().setopt<OptIntVec>("operation_detect_interaction_latency", {});
}
FakeFaceEngine mEngine;
@@ -160,81 +161,83 @@
TEST_F(FakeFaceEngineTest, GenerateChallenge) {
mEngine.generateChallengeImpl(mCallback.get());
- ASSERT_EQ(FaceHalProperties::challenge().value(), mCallback->mLastChallenge);
+ ASSERT_EQ(Face::cfg().get<std::int64_t>("challenge"), mCallback->mLastChallenge);
}
TEST_F(FakeFaceEngineTest, RevokeChallenge) {
- auto challenge = FaceHalProperties::challenge().value_or(10);
+ auto challenge = Face::cfg().get<std::int64_t>("challenge");
mEngine.revokeChallengeImpl(mCallback.get(), challenge);
- ASSERT_FALSE(FaceHalProperties::challenge().has_value());
+ ASSERT_FALSE(Face::cfg().get<std::int64_t>("challenge"));
ASSERT_EQ(challenge, mCallback->mLastChallengeRevoked);
}
TEST_F(FakeFaceEngineTest, ResetLockout) {
- FaceHalProperties::lockout(true);
+ Face::cfg().set<bool>("lockout", true);
mEngine.resetLockoutImpl(mCallback.get(), {});
ASSERT_FALSE(mCallback->mLockoutPermanent);
- ASSERT_FALSE(FaceHalProperties::lockout().value_or(true));
+ ASSERT_FALSE(Face::cfg().get<bool>("lockout"));
}
TEST_F(FakeFaceEngineTest, AuthenticatorId) {
- FaceHalProperties::authenticator_id(50);
+ Face::cfg().set<std::int64_t>("authenticator_id", 50);
mEngine.getAuthenticatorIdImpl(mCallback.get());
ASSERT_EQ(50, mCallback->mLastAuthenticatorId);
ASSERT_FALSE(mCallback->mAuthenticatorIdInvalidated);
}
TEST_F(FakeFaceEngineTest, GetAuthenticatorIdWeakReturnsZero) {
- FaceHalProperties::strength("weak");
- FaceHalProperties::authenticator_id(500);
+ Face::cfg().set<std::string>("strength", "weak");
+ Face::cfg().set<std::int64_t>("authenticator_id", 500);
mEngine.getAuthenticatorIdImpl(mCallback.get());
ASSERT_EQ(0, mCallback->mLastAuthenticatorId);
ASSERT_FALSE(mCallback->mAuthenticatorIdInvalidated);
}
TEST_F(FakeFaceEngineTest, AuthenticatorIdInvalidate) {
- FaceHalProperties::authenticator_id(500);
+ Face::cfg().set<std::int64_t>("authenticator_id", 500);
mEngine.invalidateAuthenticatorIdImpl(mCallback.get());
- ASSERT_NE(500, FaceHalProperties::authenticator_id().value());
+ ASSERT_NE(500, Face::cfg().get<std::int64_t>("authenticator_id"));
ASSERT_TRUE(mCallback->mAuthenticatorIdInvalidated);
}
TEST_F(FakeFaceEngineTest, Enroll) {
- FaceHalProperties::next_enrollment("1,0:1000-[21,5,6,7,1],1100-[1118,1108,1]:true");
+ Face::cfg().set<std::string>("next_enrollment",
+ "1,0:1000-[21,5,6,7,1],1100-[1118,1108,1]:true");
keymaster::HardwareAuthToken hat{.mac = {2, 4}};
mEngine.enrollImpl(mCallback.get(), hat, {} /*enrollmentType*/, {} /*features*/,
mCancel.get_future());
- ASSERT_FALSE(FaceHalProperties::next_enrollment().has_value());
- ASSERT_EQ(1, FaceHalProperties::enrollments().size());
- ASSERT_EQ(1, FaceHalProperties::enrollments()[0].value());
+ ASSERT_FALSE(Face::cfg().getopt<OptString>("next_enrollment").has_value());
+ ASSERT_EQ(1, Face::cfg().getopt<OptIntVec>("enrollments").size());
+ ASSERT_EQ(1, Face::cfg().getopt<OptIntVec>("enrollments")[0].value());
ASSERT_EQ(1, mCallback->mLastEnrolled);
ASSERT_EQ(0, mCallback->mRemaining);
}
TEST_F(FakeFaceEngineTest, EnrollFails) {
- FaceHalProperties::next_enrollment("1,0:1000-[21,5,6,7,1],1100-[1118,1108,1]:false");
+ Face::cfg().set<std::string>("next_enrollment",
+ "1,0:1000-[21,5,6,7,1],1100-[1118,1108,1]:false");
keymaster::HardwareAuthToken hat{.mac = {2, 4}};
mEngine.enrollImpl(mCallback.get(), hat, {} /*enrollmentType*/, {} /*features*/,
mCancel.get_future());
- ASSERT_FALSE(FaceHalProperties::next_enrollment().has_value());
- ASSERT_EQ(0, FaceHalProperties::enrollments().size());
+ ASSERT_FALSE(Face::cfg().getopt<OptString>("next_enrollment").has_value());
+ ASSERT_EQ(0, Face::cfg().getopt<OptIntVec>("enrollments").size());
}
TEST_F(FakeFaceEngineTest, EnrollCancel) {
- FaceHalProperties::next_enrollment("1:2000-[21,8,9],300:false");
+ Face::cfg().set<std::string>("next_enrollment", "1:2000-[21,8,9],300:false");
keymaster::HardwareAuthToken hat{.mac = {2, 4}};
mCancel.set_value();
mEngine.enrollImpl(mCallback.get(), hat, {} /*enrollmentType*/, {} /*features*/,
mCancel.get_future());
ASSERT_EQ(Error::CANCELED, mCallback->mError);
ASSERT_EQ(-1, mCallback->mLastEnrolled);
- ASSERT_EQ(0, FaceHalProperties::enrollments().size());
- ASSERT_TRUE(FaceHalProperties::next_enrollment().has_value());
+ ASSERT_EQ(0, Face::cfg().getopt<OptIntVec>("enrollments").size());
+ ASSERT_FALSE(Face::cfg().get<std::string>("next_enrollment").empty());
}
TEST_F(FakeFaceEngineTest, Authenticate) {
- FaceHalProperties::enrollments({100});
- FaceHalProperties::enrollment_hit(100);
+ Face::cfg().setopt<OptIntVec>("enrollments", {100});
+ Face::cfg().set<std::int32_t>("enrollment_hit", 100);
mEngine.authenticateImpl(mCallback.get(), 0 /* operationId*/, mCancel.get_future());
ASSERT_EQ(100, mCallback->mLastAuthenticated);
@@ -242,32 +245,32 @@
}
TEST_F(FakeFaceEngineTest, AuthenticateCancel) {
- FaceHalProperties::enrollments({100});
- FaceHalProperties::enrollment_hit(100);
+ Face::cfg().setopt<OptIntVec>("enrollments", {100});
+ Face::cfg().set<std::int32_t>("enrollment_hit", 100);
mCancel.set_value();
mEngine.authenticateImpl(mCallback.get(), 0 /* operationId*/, mCancel.get_future());
ASSERT_EQ(Error::CANCELED, mCallback->mError);
}
TEST_F(FakeFaceEngineTest, AuthenticateFailedForUnEnrolled) {
- FaceHalProperties::enrollments({3});
- FaceHalProperties::enrollment_hit(100);
+ Face::cfg().setopt<OptIntVec>("enrollments", {3});
+ Face::cfg().set<std::int32_t>("enrollment_hit", 100);
mEngine.authenticateImpl(mCallback.get(), 0 /* operationId*/, mCancel.get_future());
ASSERT_EQ(Error::TIMEOUT, mCallback->mError);
ASSERT_TRUE(mCallback->mAuthenticateFailed);
}
TEST_F(FakeFaceEngineTest, DetectInteraction) {
- FaceHalProperties::enrollments({100});
- FaceHalProperties::enrollment_hit(100);
+ Face::cfg().setopt<OptIntVec>("enrollments", {100});
+ Face::cfg().set<std::int32_t>("enrollment_hit", 100);
ASSERT_EQ(0, mCallback->mInteractionDetectedCount);
mEngine.detectInteractionImpl(mCallback.get(), mCancel.get_future());
ASSERT_EQ(1, mCallback->mInteractionDetectedCount);
}
TEST_F(FakeFaceEngineTest, DetectInteractionCancel) {
- FaceHalProperties::enrollments({100});
- FaceHalProperties::enrollment_hit(100);
+ Face::cfg().setopt<OptIntVec>("enrollments", {100});
+ Face::cfg().set<std::int32_t>("enrollment_hit", 100);
mCancel.set_value();
mEngine.detectInteractionImpl(mCallback.get(), mCancel.get_future());
ASSERT_EQ(Error::CANCELED, mCallback->mError);
@@ -279,7 +282,7 @@
}
TEST_F(FakeFaceEngineTest, SetFeature) {
- FaceHalProperties::enrollments({1});
+ Face::cfg().setopt<OptIntVec>("enrollments", {1});
keymaster::HardwareAuthToken hat{.mac = {2, 4}};
mEngine.setFeatureImpl(mCallback.get(), hat, Feature::REQUIRE_ATTENTION, true);
auto features = mCallback->mFeatures;
@@ -294,7 +297,7 @@
}
TEST_F(FakeFaceEngineTest, ToggleFeature) {
- FaceHalProperties::enrollments({1});
+ Face::cfg().setopt<OptIntVec>("enrollments", {1});
keymaster::HardwareAuthToken hat{.mac = {2, 4}};
mEngine.setFeatureImpl(mCallback.get(), hat, Feature::REQUIRE_ATTENTION, true);
mEngine.getFeaturesImpl(mCallback.get());
@@ -310,7 +313,7 @@
}
TEST_F(FakeFaceEngineTest, TurningOffNonExistentFeatureDoesNothing) {
- FaceHalProperties::enrollments({1});
+ Face::cfg().setopt<OptIntVec>("enrollments", {1});
keymaster::HardwareAuthToken hat{.mac = {2, 4}};
mEngine.setFeatureImpl(mCallback.get(), hat, Feature::REQUIRE_ATTENTION, false);
mEngine.getFeaturesImpl(mCallback.get());
@@ -319,7 +322,7 @@
}
TEST_F(FakeFaceEngineTest, SetMultipleFeatures) {
- FaceHalProperties::enrollments({1});
+ Face::cfg().setopt<OptIntVec>("enrollments", {1});
keymaster::HardwareAuthToken hat{.mac = {2, 4}};
mEngine.setFeatureImpl(mCallback.get(), hat, Feature::REQUIRE_ATTENTION, true);
mEngine.setFeatureImpl(mCallback.get(), hat, Feature::REQUIRE_DIVERSE_POSES, true);
@@ -335,7 +338,7 @@
}
TEST_F(FakeFaceEngineTest, SetMultipleFeaturesAndTurnOffSome) {
- FaceHalProperties::enrollments({1});
+ Face::cfg().setopt<OptIntVec>("enrollments", {1});
keymaster::HardwareAuthToken hat{.mac = {2, 4}};
mEngine.setFeatureImpl(mCallback.get(), hat, Feature::REQUIRE_ATTENTION, true);
mEngine.setFeatureImpl(mCallback.get(), hat, Feature::REQUIRE_DIVERSE_POSES, true);
@@ -352,7 +355,7 @@
}
TEST_F(FakeFaceEngineTest, Enumerate) {
- FaceHalProperties::enrollments({120, 3});
+ Face::cfg().setopt<OptIntVec>("enrollments", {120, 3});
mEngine.enumerateEnrollmentsImpl(mCallback.get());
auto enrolls = mCallback->mLastEnrollmentsEnumerated;
ASSERT_FALSE(enrolls.empty());
@@ -361,7 +364,7 @@
}
TEST_F(FakeFaceEngineTest, RemoveEnrollments) {
- FaceHalProperties::enrollments({120, 3, 100});
+ Face::cfg().setopt<OptIntVec>("enrollments", {120, 3, 100});
mEngine.removeEnrollmentsImpl(mCallback.get(), {120, 100});
mEngine.enumerateEnrollmentsImpl(mCallback.get());
auto enrolls = mCallback->mLastEnrollmentsEnumerated;
@@ -372,9 +375,9 @@
}
TEST_F(FakeFaceEngineTest, ResetLockoutWithAuth) {
- FaceHalProperties::lockout(true);
- FaceHalProperties::enrollments({33});
- FaceHalProperties::enrollment_hit(33);
+ Face::cfg().set<bool>("lockout", true);
+ Face::cfg().setopt<OptIntVec>("enrollments", {33});
+ Face::cfg().set<std::int32_t>("enrollment_hit", 33);
auto cancelFuture = mCancel.get_future();
mEngine.authenticateImpl(mCallback.get(), 0 /* operationId*/, cancelFuture);
@@ -382,28 +385,30 @@
mEngine.resetLockoutImpl(mCallback.get(), {} /* hat */);
ASSERT_FALSE(mCallback->mLockoutPermanent);
- FaceHalProperties::enrollment_hit(33);
+ Face::cfg().set<std::int32_t>("enrollment_hit", 33);
mEngine.authenticateImpl(mCallback.get(), 0 /* operationId*/, cancelFuture);
ASSERT_EQ(33, mCallback->mLastAuthenticated);
ASSERT_FALSE(mCallback->mAuthenticateFailed);
}
TEST_F(FakeFaceEngineTest, LatencyDefault) {
- FaceHalProperties::operation_detect_interaction_latency({});
- ASSERT_EQ(DEFAULT_LATENCY,
- mEngine.getLatency(FaceHalProperties::operation_detect_interaction_latency()));
+ Face::cfg().setopt<OptIntVec>("operation_detect_interaction_latency", {});
+ ASSERT_EQ(DEFAULT_LATENCY, mEngine.getLatency(Face::cfg().getopt<OptIntVec>(
+ "operation_detect_interaction_latency")));
}
TEST_F(FakeFaceEngineTest, LatencyFixed) {
- FaceHalProperties::operation_detect_interaction_latency({10});
- ASSERT_EQ(10, mEngine.getLatency(FaceHalProperties::operation_detect_interaction_latency()));
+ Face::cfg().setopt<OptIntVec>("operation_detect_interaction_latency", {10});
+ ASSERT_EQ(10, mEngine.getLatency(
+ Face::cfg().getopt<OptIntVec>("operation_detect_interaction_latency")));
}
TEST_F(FakeFaceEngineTest, LatencyRandom) {
- FaceHalProperties::operation_detect_interaction_latency({1, 1000});
+ Face::cfg().setopt<OptIntVec>("operation_detect_interaction_latency", {1, 1000});
std::set<int32_t> latencySet;
for (int i = 0; i < 100; i++) {
- auto x = mEngine.getLatency(FaceHalProperties::operation_detect_interaction_latency());
+ auto x = mEngine.getLatency(
+ Face::cfg().getopt<OptIntVec>("operation_detect_interaction_latency"));
ASSERT_TRUE(x >= 1 && x <= 1000);
latencySet.insert(x);
}
diff --git a/biometrics/face/aidl/default/tests/FakeLockoutTrackerTest.cpp b/biometrics/face/aidl/default/tests/FakeLockoutTrackerTest.cpp
index fa07d1d..8564f6b 100644
--- a/biometrics/face/aidl/default/tests/FakeLockoutTrackerTest.cpp
+++ b/biometrics/face/aidl/default/tests/FakeLockoutTrackerTest.cpp
@@ -21,6 +21,7 @@
#include <android-base/logging.h>
+#include "Face.h"
#include "FakeLockoutTracker.h"
#include "util/Util.h"
@@ -103,19 +104,21 @@
static constexpr int32_t LOCKOUT_TIMED_DURATION = 100;
void SetUp() override {
- FaceHalProperties::lockout_timed_threshold(LOCKOUT_TIMED_THRESHOLD);
- FaceHalProperties::lockout_timed_duration(LOCKOUT_TIMED_DURATION);
- FaceHalProperties::lockout_permanent_threshold(LOCKOUT_PERMANENT_THRESHOLD);
+ Face::cfg().set<std::int32_t>("lockout_timed_threshold", LOCKOUT_TIMED_THRESHOLD);
+ Face::cfg().set<std::int32_t>("lockout_timed_duration", LOCKOUT_TIMED_DURATION);
+ Face::cfg().set<std::int32_t>("lockout_permanent_threshold", LOCKOUT_PERMANENT_THRESHOLD);
+ Face::cfg().set<bool>("lockout_enable", false);
+ Face::cfg().set<bool>("lockout", false);
mCallback = ndk::SharedRefBase::make<TestSessionCallback>();
}
void TearDown() override {
// reset to default
- FaceHalProperties::lockout_timed_threshold(5);
- FaceHalProperties::lockout_timed_duration(20);
- FaceHalProperties::lockout_permanent_threshold(10000);
- FaceHalProperties::lockout_enable(false);
- FaceHalProperties::lockout(false);
+ Face::cfg().set<std::int32_t>("lockout_timed_threshold", 5);
+ Face::cfg().set<std::int32_t>("lockout_timed_duration", 20);
+ Face::cfg().set<std::int32_t>("lockout_permanent_threshold", 10000);
+ Face::cfg().set<bool>("lockout_enable", false);
+ Face::cfg().set<bool>("lockout", false);
}
FakeLockoutTracker mLockoutTracker;
@@ -123,7 +126,7 @@
};
TEST_F(FakeLockoutTrackerTest, addFailedAttemptDisable) {
- FaceHalProperties::lockout_enable(false);
+ Face::cfg().set<bool>("lockout_enable", false);
for (int i = 0; i < LOCKOUT_TIMED_THRESHOLD + 1; i++)
mLockoutTracker.addFailedAttempt(mCallback.get());
ASSERT_EQ(mLockoutTracker.getMode(), FakeLockoutTracker::LockoutMode::kNone);
@@ -131,7 +134,7 @@
}
TEST_F(FakeLockoutTrackerTest, addFailedAttemptPermanent) {
- FaceHalProperties::lockout_enable(true);
+ Face::cfg().set<bool>("lockout_enable", true);
ASSERT_FALSE(mLockoutTracker.checkIfLockout(mCallback.get()));
for (int i = 0; i < LOCKOUT_PERMANENT_THRESHOLD - 1; i++)
mLockoutTracker.addFailedAttempt(mCallback.get());
@@ -145,8 +148,8 @@
}
TEST_F(FakeLockoutTrackerTest, addFailedAttemptLockoutTimed) {
- FaceHalProperties::lockout_enable(true);
- FaceHalProperties::lockout_timed_enable(true);
+ Face::cfg().set<bool>("lockout_enable", true);
+ Face::cfg().set<bool>("lockout_timed_enable", true);
ASSERT_FALSE(mLockoutTracker.checkIfLockout(mCallback.get()));
for (int i = 0; i < LOCKOUT_TIMED_THRESHOLD; i++)
mLockoutTracker.addFailedAttempt(mCallback.get());
@@ -168,8 +171,8 @@
}
TEST_F(FakeLockoutTrackerTest, addFailedAttemptLockout_TimedThenPermanent) {
- FaceHalProperties::lockout_enable(true);
- FaceHalProperties::lockout_timed_enable(true);
+ Face::cfg().set<bool>("lockout_enable", true);
+ Face::cfg().set<bool>("lockout_timed_enable", true);
ASSERT_FALSE(mLockoutTracker.checkIfLockout(mCallback.get()));
for (int i = 0; i < LOCKOUT_TIMED_THRESHOLD; i++)
mLockoutTracker.addFailedAttempt(mCallback.get());
@@ -182,8 +185,8 @@
}
TEST_F(FakeLockoutTrackerTest, addFailedAttemptLockoutTimedTwice) {
- FaceHalProperties::lockout_enable(true);
- FaceHalProperties::lockout_timed_enable(true);
+ Face::cfg().set<bool>("lockout_enable", true);
+ Face::cfg().set<bool>("lockout_timed_enable", true);
ASSERT_FALSE(mLockoutTracker.checkIfLockout(mCallback.get()));
ASSERT_EQ(0, mCallback->mLockoutTimed);
for (int i = 0; i < LOCKOUT_TIMED_THRESHOLD; i++)
@@ -198,7 +201,7 @@
}
TEST_F(FakeLockoutTrackerTest, resetLockout) {
- FaceHalProperties::lockout_enable(true);
+ Face::cfg().set<bool>("lockout_enable", true);
ASSERT_EQ(mLockoutTracker.getMode(), FakeLockoutTracker::LockoutMode::kNone);
for (int i = 0; i < LOCKOUT_PERMANENT_THRESHOLD; i++)
mLockoutTracker.addFailedAttempt(mCallback.get());
diff --git a/biometrics/face/aidl/default/tests/VirtualHalTest.cpp b/biometrics/face/aidl/default/tests/VirtualHalTest.cpp
new file mode 100644
index 0000000..2f19805
--- /dev/null
+++ b/biometrics/face/aidl/default/tests/VirtualHalTest.cpp
@@ -0,0 +1,237 @@
+/*
+ * Copyright (C) 2024 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <android/binder_process.h>
+#include <face.sysprop.h>
+#include <gtest/gtest.h>
+
+#include <android-base/logging.h>
+
+#include "Face.h"
+#include "VirtualHal.h"
+
+using namespace ::android::face::virt;
+using namespace ::aidl::android::hardware::biometrics::face;
+
+namespace aidl::android::hardware::biometrics::face {
+
+class VirtualHalTest : public ::testing::Test {
+ public:
+ static const int32_t STATUS_FAILED_TO_SET_PARAMETER = 2;
+
+ protected:
+ void SetUp() override {
+ mHal = ndk::SharedRefBase::make<Face>();
+ mVhal = ndk::SharedRefBase::make<VirtualHal>(mHal);
+ ASSERT_TRUE(mVhal != nullptr);
+ mHal->resetConfigToDefault();
+ }
+
+ void TearDown() override { mHal->resetConfigToDefault(); }
+
+ std::shared_ptr<VirtualHal> mVhal;
+
+ ndk::ScopedAStatus validateNonNegativeInputOfInt32(const char* name,
+ ndk::ScopedAStatus (VirtualHal::*f)(int32_t),
+ const std::vector<int32_t>& in_good);
+
+ private:
+ std::shared_ptr<Face> mHal;
+};
+
+ndk::ScopedAStatus VirtualHalTest::validateNonNegativeInputOfInt32(
+ const char* name, ndk::ScopedAStatus (VirtualHal::*f)(int32_t),
+ const std::vector<int32_t>& in_params_good) {
+ ndk::ScopedAStatus status;
+ for (auto& param : in_params_good) {
+ status = (*mVhal.*f)(param);
+ if (!status.isOk()) return status;
+ if (Face::cfg().get<int32_t>(name) != param) {
+ return ndk::ScopedAStatus(AStatus_fromServiceSpecificErrorWithMessage(
+ VirtualHalTest::STATUS_FAILED_TO_SET_PARAMETER,
+ "Error: fail to set non-negative parameter"));
+ }
+ }
+
+ int32_t old_param = Face::cfg().get<int32_t>(name);
+ status = (*mVhal.*f)(-1);
+ if (status.isOk()) {
+ return ndk::ScopedAStatus(AStatus_fromServiceSpecificErrorWithMessage(
+ VirtualHalTest::STATUS_FAILED_TO_SET_PARAMETER, "Error: should return NOK"));
+ }
+ if (status.getServiceSpecificError() != IVirtualHal::STATUS_INVALID_PARAMETER) {
+ return ndk::ScopedAStatus(AStatus_fromServiceSpecificErrorWithMessage(
+ VirtualHalTest::STATUS_FAILED_TO_SET_PARAMETER,
+ "Error: unexpected return error code"));
+ }
+ if (Face::cfg().get<int32_t>(name) != old_param) {
+ return ndk::ScopedAStatus(AStatus_fromServiceSpecificErrorWithMessage(
+ VirtualHalTest::STATUS_FAILED_TO_SET_PARAMETER,
+ "Error: unexpected parameter change on failed attempt"));
+ }
+ return ndk::ScopedAStatus::ok();
+}
+
+TEST_F(VirtualHalTest, init) {
+ mVhal->setLockout(false);
+ ASSERT_TRUE(Face::cfg().get<bool>("lockout") == false);
+ ASSERT_TRUE(Face::cfg().get<std::string>("type") == "rgb");
+ ASSERT_TRUE(Face::cfg().get<std::string>("strength") == "strong");
+ std::int64_t id = Face::cfg().get<std::int64_t>("authenticator_id");
+ ASSERT_TRUE(Face::cfg().get<std::int64_t>("authenticator_id") == 0);
+ ASSERT_TRUE(Face::cfg().getopt<OptIntVec>("enrollments") == OptIntVec());
+}
+
+TEST_F(VirtualHalTest, enrollment_hit_int32) {
+ mVhal->setEnrollmentHit(11);
+ ASSERT_TRUE(Face::cfg().get<int32_t>("enrollment_hit") == 11);
+}
+
+TEST_F(VirtualHalTest, next_enrollment) {
+ struct {
+ std::string nextEnrollmentStr;
+ face::NextEnrollment nextEnrollment;
+ } testData[] = {
+ {"1:20:true", {1, {{20}}, true}},
+ {"1:50,60,70:true", {1, {{50}, {60}, {70}}, true}},
+ {"2:50-[21],60,70-[4,1002,1]:false",
+ {2,
+ {{50, {{AcquiredInfo::START}}},
+ {60},
+ {70, {{AcquiredInfo::TOO_DARK}, {1002}, {AcquiredInfo::GOOD}}}},
+ false}},
+ };
+
+ for (auto& d : testData) {
+ mVhal->setNextEnrollment(d.nextEnrollment);
+ ASSERT_TRUE(Face::cfg().get<std::string>("next_enrollment") == d.nextEnrollmentStr);
+ }
+}
+
+TEST_F(VirtualHalTest, authenticator_id_int64) {
+ mVhal->setAuthenticatorId(12345678900);
+ ASSERT_TRUE(Face::cfg().get<int64_t>("authenticator_id") == 12345678900);
+}
+
+TEST_F(VirtualHalTest, opeationAuthenticateFails_bool) {
+ mVhal->setOperationAuthenticateFails(true);
+ ASSERT_TRUE(Face::cfg().get<bool>("operation_authenticate_fails"));
+}
+
+TEST_F(VirtualHalTest, operationAuthenticateAcquired_int32_vector) {
+ using Tag = AcquiredInfoAndVendorCode::Tag;
+ std::vector<AcquiredInfoAndVendorCode> ac{
+ {AcquiredInfo::START}, {AcquiredInfo::TOO_FAR}, {1023}};
+ mVhal->setOperationAuthenticateAcquired(ac);
+ OptIntVec ac_get = Face::cfg().getopt<OptIntVec>("operation_authenticate_acquired");
+ ASSERT_TRUE(ac_get.size() == ac.size());
+ for (int i = 0; i < ac.size(); i++) {
+ int acCode = (ac[i].getTag() == Tag::acquiredInfo) ? (int)ac[i].get<Tag::acquiredInfo>()
+ : ac[i].get<Tag::vendorCode>();
+ ASSERT_TRUE(acCode == ac_get[i]);
+ }
+}
+
+TEST_F(VirtualHalTest, type) {
+ struct {
+ FaceSensorType type;
+ const char* typeStr;
+ } typeMap[] = {{FaceSensorType::RGB, "rgb"},
+ {FaceSensorType::IR, "ir"},
+ {FaceSensorType::UNKNOWN, "unknown"}};
+ for (auto const& x : typeMap) {
+ mVhal->setType(x.type);
+ ASSERT_TRUE(Face::cfg().get<std::string>("type") == x.typeStr);
+ }
+}
+
+TEST_F(VirtualHalTest, sensorStrength) {
+ struct {
+ common::SensorStrength strength;
+ const char* strengthStr;
+ } strengths[] = {{common::SensorStrength::CONVENIENCE, "CONVENIENCE"},
+ {common::SensorStrength::WEAK, "WEAK"},
+ {common::SensorStrength::STRONG, "STRONG"}};
+
+ for (auto const& x : strengths) {
+ mVhal->setSensorStrength(x.strength);
+ ASSERT_TRUE(Face::cfg().get<std::string>("strength") == x.strengthStr);
+ }
+}
+
+TEST_F(VirtualHalTest, setLatency) {
+ ndk::ScopedAStatus status;
+ std::vector<int32_t> in_lats[] = {{1}, {2, 3}, {5, 4}};
+ for (auto const& in_lat : in_lats) {
+ status = mVhal->setOperationAuthenticateLatency(in_lat);
+ ASSERT_TRUE(status.isOk());
+ OptIntVec out_lat = Face::cfg().getopt<OptIntVec>("operation_authenticate_latency");
+ ASSERT_TRUE(in_lat.size() == out_lat.size());
+ for (int i = 0; i < in_lat.size(); i++) {
+ ASSERT_TRUE(in_lat[i] == out_lat[i]);
+ }
+ }
+
+ std::vector<int32_t> bad_in_lats[] = {{}, {1, 2, 3}, {1, -3}};
+ for (auto const& in_lat : bad_in_lats) {
+ status = mVhal->setOperationAuthenticateLatency(in_lat);
+ ASSERT_TRUE(!status.isOk());
+ ASSERT_TRUE(status.getServiceSpecificError() == IVirtualHal::STATUS_INVALID_PARAMETER);
+ }
+}
+
+TEST_F(VirtualHalTest, setOperationAuthenticateDuration) {
+ ndk::ScopedAStatus status = validateNonNegativeInputOfInt32(
+ "operation_authenticate_duration", &IVirtualHal::setOperationAuthenticateDuration,
+ {0, 33});
+ ASSERT_TRUE(status.isOk());
+}
+
+TEST_F(VirtualHalTest, setLockoutTimedDuration) {
+ ndk::ScopedAStatus status = validateNonNegativeInputOfInt32(
+ "lockout_timed_duration", &IVirtualHal::setLockoutTimedDuration, {0, 35});
+ ASSERT_TRUE(status.isOk());
+}
+
+TEST_F(VirtualHalTest, setLockoutTimedThreshold) {
+ ndk::ScopedAStatus status = validateNonNegativeInputOfInt32(
+ "lockout_timed_threshold", &IVirtualHal::setLockoutTimedThreshold, {0, 36});
+ ASSERT_TRUE(status.isOk());
+}
+
+TEST_F(VirtualHalTest, setLockoutPermanentThreshold) {
+ ndk::ScopedAStatus status = validateNonNegativeInputOfInt32(
+ "lockout_permanent_threshold", &IVirtualHal::setLockoutPermanentThreshold, {0, 37});
+ ASSERT_TRUE(status.isOk());
+}
+
+TEST_F(VirtualHalTest, setOthers) {
+ // Verify that there is no CHECK() failures
+ mVhal->setEnrollments({7, 6, 5});
+ mVhal->setChallenge(111222333444555666);
+ mVhal->setOperationAuthenticateError(4);
+ mVhal->setOperationEnrollLatency({4, 5});
+ mVhal->setLockout(false);
+ mVhal->setLockoutEnable(false);
+}
+
+} // namespace aidl::android::hardware::biometrics::face
+
+int main(int argc, char** argv) {
+ testing::InitGoogleTest(&argc, argv);
+ ABinderProcess_startThreadPool();
+ return RUN_ALL_TESTS();
+}
diff --git a/bluetooth/audio/utils/aidl_session/BluetoothAudioSession.cpp b/bluetooth/audio/utils/aidl_session/BluetoothAudioSession.cpp
index a458c5b..c62784e 100644
--- a/bluetooth/audio/utils/aidl_session/BluetoothAudioSession.cpp
+++ b/bluetooth/audio/utils/aidl_session/BluetoothAudioSession.cpp
@@ -145,6 +145,13 @@
<< toString(session_type_);
return;
}
+ } else if (session_type_ == SessionType::HFP_SOFTWARE_DECODING_DATAPATH ||
+ session_type_ == SessionType::HFP_SOFTWARE_ENCODING_DATAPATH) {
+ if (audio_config.getTag() != AudioConfiguration::pcmConfig) {
+ LOG(ERROR) << __func__ << " invalid audio config type for SessionType ="
+ << toString(session_type_);
+ return;
+ }
} else {
LOG(ERROR) << __func__ << " invalid SessionType ="
<< toString(session_type_);
@@ -166,6 +173,13 @@
<< toString(session_type_);
return;
}
+ } else if (session_type_ == SessionType::HFP_SOFTWARE_DECODING_DATAPATH ||
+ session_type_ == SessionType::HFP_SOFTWARE_ENCODING_DATAPATH) {
+ if (audio_config.getTag() != AudioConfiguration::pcmConfig) {
+ LOG(ERROR) << __func__ << " invalid audio config type for SessionType ="
+ << toString(session_type_);
+ return;
+ }
} else {
LOG(ERROR) << __func__
<< " invalid SessionType =" << toString(session_type_);
@@ -604,7 +618,9 @@
if (session_type_ == SessionType::A2DP_SOFTWARE_ENCODING_DATAPATH ||
session_type_ == SessionType::A2DP_HARDWARE_OFFLOAD_ENCODING_DATAPATH ||
session_type_ == SessionType::A2DP_SOFTWARE_DECODING_DATAPATH ||
- session_type_ == SessionType::A2DP_HARDWARE_OFFLOAD_DECODING_DATAPATH) {
+ session_type_ == SessionType::A2DP_HARDWARE_OFFLOAD_DECODING_DATAPATH ||
+ session_type_ == SessionType::HFP_SOFTWARE_ENCODING_DATAPATH ||
+ session_type_ == SessionType::HFP_SOFTWARE_DECODING_DATAPATH) {
return false;
}
@@ -629,7 +645,9 @@
if (session_type_ == SessionType::A2DP_SOFTWARE_ENCODING_DATAPATH ||
session_type_ == SessionType::A2DP_HARDWARE_OFFLOAD_ENCODING_DATAPATH ||
session_type_ == SessionType::A2DP_SOFTWARE_DECODING_DATAPATH ||
- session_type_ == SessionType::A2DP_HARDWARE_OFFLOAD_DECODING_DATAPATH) {
+ session_type_ == SessionType::A2DP_HARDWARE_OFFLOAD_DECODING_DATAPATH ||
+ session_type_ == SessionType::HFP_SOFTWARE_ENCODING_DATAPATH ||
+ session_type_ == SessionType::HFP_SOFTWARE_DECODING_DATAPATH) {
return false;
}
diff --git a/camera/provider/aidl/vts/camera_aidl_test.cpp b/camera/provider/aidl/vts/camera_aidl_test.cpp
index 6ecd451..44af306 100644
--- a/camera/provider/aidl/vts/camera_aidl_test.cpp
+++ b/camera/provider/aidl/vts/camera_aidl_test.cpp
@@ -2590,8 +2590,7 @@
return ret;
}
- if (flags::session_hal_buf_manager() &&
- (bufferManagerType == BufferManagerType::SESSION && interfaceVersion >= 3)) {
+ if (bufferManagerType == BufferManagerType::SESSION && interfaceVersion >= 3) {
ret = session->configureStreamsV2(config, &aidl_return);
} else {
ret = session->configureStreams(config, halStreams);
@@ -2599,12 +2598,11 @@
if (!ret.isOk()) {
return ret;
}
- if (flags::session_hal_buf_manager() && bufferManagerType == BufferManagerType::SESSION) {
+ if (bufferManagerType == BufferManagerType::SESSION) {
*halStreams = std::move(aidl_return.halStreams);
}
for (const auto& halStream : *halStreams) {
- if ((flags::session_hal_buf_manager() && bufferManagerType == BufferManagerType::SESSION &&
- halStream.enableHalBufferManager) ||
+ if ((bufferManagerType == BufferManagerType::SESSION && halStream.enableHalBufferManager) ||
bufferManagerType == BufferManagerType::HAL) {
halBufManagedStreamIds->insert(halStream.id);
}
diff --git a/compatibility_matrices/compatibility_matrix.202504.xml b/compatibility_matrices/compatibility_matrix.202504.xml
index ed45c1b..349496a 100644
--- a/compatibility_matrices/compatibility_matrix.202504.xml
+++ b/compatibility_matrices/compatibility_matrix.202504.xml
@@ -591,7 +591,7 @@
</hal>
<hal format="aidl">
<name>android.hardware.tv.tuner</name>
- <version>1-2</version>
+ <version>1-3</version>
<interface>
<name>ITuner</name>
<instance>default</instance>
@@ -646,7 +646,7 @@
</hal>
<hal format="aidl" updatable-via-apex="true">
<name>android.hardware.wifi</name>
- <version>1-2</version>
+ <version>2-3</version>
<interface>
<name>IWifi</name>
<instance>default</instance>
@@ -670,7 +670,7 @@
</hal>
<hal format="aidl">
<name>android.hardware.wifi.supplicant</name>
- <version>2-3</version>
+ <version>3-4</version>
<interface>
<name>ISupplicant</name>
<instance>default</instance>
diff --git a/graphics/composer/2.2/default/Android.bp b/graphics/composer/2.2/default/Android.bp
new file mode 100644
index 0000000..5753bb0
--- /dev/null
+++ b/graphics/composer/2.2/default/Android.bp
@@ -0,0 +1,51 @@
+// Copyright (C) 2024 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package {
+ // See: http://go/android-license-faq
+ default_applicable_licenses: [
+ "hardware_interfaces_license",
+ ],
+}
+
+cc_binary {
+ name: "android.hardware.graphics.composer@2.2-service",
+ vendor: true,
+ relative_install_path: "hw",
+ cflags: [
+ "-Wall",
+ "-Werror",
+ "-DLOG_TAG=\"ComposerHal\"",
+ ],
+ srcs: ["service.cpp"],
+ init_rc: ["android.hardware.graphics.composer@2.2-service.rc"],
+ header_libs: ["android.hardware.graphics.composer@2.2-passthrough"],
+ shared_libs: [
+ "android.hardware.graphics.composer@2.1",
+ "android.hardware.graphics.composer@2.2",
+ "android.hardware.graphics.composer@2.1-resources",
+ "android.hardware.graphics.composer@2.2-resources",
+ "libbase",
+ "libbinder",
+ "libcutils",
+ "libfmq",
+ "libhardware",
+ "libhidlbase",
+ "libhwc2on1adapter",
+ "libhwc2onfbadapter",
+ "liblog",
+ "libsync",
+ "libutils",
+ ],
+}
diff --git a/graphics/composer/2.2/default/Android.mk b/graphics/composer/2.2/default/Android.mk
deleted file mode 100644
index 6f7ef85..0000000
--- a/graphics/composer/2.2/default/Android.mk
+++ /dev/null
@@ -1,35 +0,0 @@
-LOCAL_PATH := $(call my-dir)
-
-include $(CLEAR_VARS)
-LOCAL_MODULE := android.hardware.graphics.composer@2.2-service
-LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0
-LOCAL_LICENSE_CONDITIONS := notice
-LOCAL_NOTICE_FILE := $(LOCAL_PATH)/../../../../NOTICE
-LOCAL_VENDOR_MODULE := true
-LOCAL_MODULE_RELATIVE_PATH := hw
-LOCAL_CFLAGS := -Wall -Werror -DLOG_TAG=\"ComposerHal\"
-LOCAL_SRC_FILES := service.cpp
-LOCAL_INIT_RC := android.hardware.graphics.composer@2.2-service.rc
-LOCAL_HEADER_LIBRARIES := android.hardware.graphics.composer@2.2-passthrough
-LOCAL_SHARED_LIBRARIES := \
- android.hardware.graphics.composer@2.1 \
- android.hardware.graphics.composer@2.2 \
- android.hardware.graphics.composer@2.1-resources \
- android.hardware.graphics.composer@2.2-resources \
- libbase \
- libbinder \
- libcutils \
- libfmq \
- libhardware \
- libhidlbase \
- libhwc2on1adapter \
- libhwc2onfbadapter \
- liblog \
- libsync \
- libutils
-
-ifdef TARGET_USES_DISPLAY_RENDER_INTENTS
-LOCAL_CFLAGS += -DUSES_DISPLAY_RENDER_INTENTS
-endif
-
-include $(BUILD_EXECUTABLE)
diff --git a/graphics/composer/aidl/vts/RenderEngineVts.cpp b/graphics/composer/aidl/vts/RenderEngineVts.cpp
index 48cb8ae..8f8b5fd 100644
--- a/graphics/composer/aidl/vts/RenderEngineVts.cpp
+++ b/graphics/composer/aidl/vts/RenderEngineVts.cpp
@@ -28,9 +28,7 @@
mRenderEngine = ::android::renderengine::RenderEngine::create(args);
}
-TestRenderEngine::~TestRenderEngine() {
- mRenderEngine.release();
-}
+TestRenderEngine::~TestRenderEngine() {}
void TestRenderEngine::setRenderLayers(std::vector<std::shared_ptr<TestLayer>> layers) {
sort(layers.begin(), layers.end(),
diff --git a/keymaster/aidl/Android.bp b/keymaster/aidl/Android.bp
index d416d2d..c101f56 100644
--- a/keymaster/aidl/Android.bp
+++ b/keymaster/aidl/Android.bp
@@ -20,6 +20,7 @@
},
ndk: {
apex_available: [
+ "com.android.hardware.biometrics.face.virtual",
"com.android.hardware.biometrics.fingerprint.virtual",
"//apex_available:platform",
],
diff --git a/media/omx/1.0/vts/functional/store/VtsHalMediaOmxV1_0TargetStoreTest.cpp b/media/omx/1.0/vts/functional/store/VtsHalMediaOmxV1_0TargetStoreTest.cpp
index d80e651..2d34afe 100644
--- a/media/omx/1.0/vts/functional/store/VtsHalMediaOmxV1_0TargetStoreTest.cpp
+++ b/media/omx/1.0/vts/functional/store/VtsHalMediaOmxV1_0TargetStoreTest.cpp
@@ -93,9 +93,9 @@
void validateAttributes(
const std::map<const std::string, const testing::internal::RE>& knownPatterns,
- const std::vector<const struct AttributePattern>& unknownPatterns,
+ const std::vector<struct AttributePattern>& unknownPatterns,
hidl_vec<IOmxStore::Attribute> attributes) {
- std::set<const std::string> attributeKeys;
+ std::set<std::string> attributeKeys;
for (const auto& attr : attributes) {
// Make sure there are no duplicates
const auto [nodeIter, inserted] = attributeKeys.insert(attr.key);
@@ -179,7 +179,7 @@
* tried for a match with the second element of the pair. If this second
* match fails, the test will fail.
*/
- const std::vector<const struct AttributePattern> unknownPatterns = {
+ const std::vector<struct AttributePattern> unknownPatterns = {
{"supports-[a-z0-9-]*", "0|1"}};
validateAttributes(knownPatterns, unknownPatterns, attributes);
@@ -248,7 +248,7 @@
};
// Strings for matching rules for node attributes with key patterns
- const std::vector<const struct AttributePattern> unknownPatterns = {
+ const std::vector<struct AttributePattern> unknownPatterns = {
{"measured-frame-rate-" + size + "-range", range_num},
{"feature-[a-zA-Z0-9_-]+", string},
};
@@ -257,9 +257,9 @@
const testing::internal::RE nodeNamePattern = "[a-zA-Z0-9._-]+";
const testing::internal::RE nodeOwnerPattern = "[a-zA-Z0-9._-]+";
- std::set<const std::string> roleKeys;
- std::map<const std::string, std::set<const std::string>> nodeToRoles;
- std::map<const std::string, std::set<const std::string>> ownerToNodes;
+ std::set<std::string> roleKeys;
+ std::map<const std::string, std::set<std::string>> nodeToRoles;
+ std::map<const std::string, std::set<std::string>> ownerToNodes;
for (const IOmxStore::RoleInfo& role : roleList) {
// Make sure there are no duplicates
const auto [roleIter, inserted] = roleKeys.insert(role.role);
@@ -276,7 +276,7 @@
}
// Check the nodes for this role
- std::set<const std::string> nodeKeys;
+ std::set<std::string> nodeKeys;
for (const IOmxStore::NodeInfo& node : role.nodes) {
// Make sure there are no duplicates
const auto [nodeIter, inserted] = nodeKeys.insert(node.name);
@@ -317,7 +317,7 @@
// Verify that roles for each node match with the information from
// IOmxStore::listRoles().
- std::set<const std::string> nodeKeys;
+ std::set<std::string> nodeKeys;
for (IOmx::ComponentInfo node : nodeList) {
// Make sure there are no duplicates
const auto [nodeIter, inserted] = nodeKeys.insert(node.mName);
@@ -334,7 +334,7 @@
// All the roles advertised by IOmxStore::listRoles() for this
// node must be included in roleKeys.
- std::set<const std::string> difference;
+ std::set<std::string> difference;
std::set_difference(nodeToRoles[node.mName].begin(), nodeToRoles[node.mName].end(),
roleKeys.begin(), roleKeys.end(),
std::inserter(difference, difference.begin()));
@@ -347,7 +347,7 @@
}
// Check that all nodes obtained from IOmxStore::listRoles() are
// supported by the their corresponding IOmx instances.
- std::set<const std::string> difference;
+ std::set<std::string> difference;
std::set_difference(nodes.begin(), nodes.end(), nodeKeys.begin(), nodeKeys.end(),
std::inserter(difference, difference.begin()));
EXPECT_EQ(difference.empty(), true) << "IOmx::listNodes() for IOmx "
diff --git a/radio/aidl/android/hardware/radio/data/ApnTypes.aidl b/radio/aidl/android/hardware/radio/data/ApnTypes.aidl
index f44c636..2a0c263 100644
--- a/radio/aidl/android/hardware/radio/data/ApnTypes.aidl
+++ b/radio/aidl/android/hardware/radio/data/ApnTypes.aidl
@@ -90,5 +90,17 @@
/**
* APN type for RCS (Rich Communication Services)
*/
- RCS = 1 << 15
+ RCS = 1 << 15,
+
+ /**
+ * APN type for OEM_PAID networks (Automotive PANS)
+ */
+ // TODO(b/366194627): enable once HAL unfreezes
+ // OEM_PAID = 1 << 16,
+
+ /**
+ * APN type for OEM_PRIVATE networks (Automotive PANS)
+ */
+ // TODO(b/366194627): enable once HAL unfreezes
+ // OEM_PRIVATE = 1 << 17,
}
diff --git a/radio/aidl/android/hardware/radio/network/CellIdentityLte.aidl b/radio/aidl/android/hardware/radio/network/CellIdentityLte.aidl
index 27c2580..6912e02 100644
--- a/radio/aidl/android/hardware/radio/network/CellIdentityLte.aidl
+++ b/radio/aidl/android/hardware/radio/network/CellIdentityLte.aidl
@@ -33,7 +33,7 @@
*/
String mnc;
/**
- * 28-bit Cell Identity described in TS TS 27.007, INT_MAX if unknown
+ * 28-bit Cell Identity described in TS 27.007, INT_MAX if unknown
*/
int ci;
/**
@@ -53,7 +53,7 @@
*/
OperatorInfo operatorNames;
/**
- * Cell bandwidth, in kHz.
+ * Cell bandwidth, in kHz. Must be valid as described in TS 36.101 5.6.
*/
int bandwidth;
/**
diff --git a/security/keymint/support/Android.bp b/security/keymint/support/Android.bp
index 5c9efef..608d328 100644
--- a/security/keymint/support/Android.bp
+++ b/security/keymint/support/Android.bp
@@ -40,6 +40,9 @@
export_include_dirs: [
"include",
],
+ header_libs: [
+ "libhardware_headers",
+ ],
defaults: [
"keymint_use_latest_hal_aidl_ndk_shared",
],
diff --git a/soundtrigger/2.0/default/Android.bp b/soundtrigger/2.0/default/Android.bp
index 2cbf041..2e61f9b 100644
--- a/soundtrigger/2.0/default/Android.bp
+++ b/soundtrigger/2.0/default/Android.bp
@@ -46,3 +46,36 @@
"libhardware_headers",
],
}
+
+soong_config_module_type {
+ name: "soundtrigger_cc_library_shared",
+ module_type: "cc_library_shared",
+ config_namespace: "soundtrigger",
+ value_variables: [
+ "audioserver_multilib",
+ ],
+ properties: ["compile_multilib"],
+}
+
+soundtrigger_cc_library_shared {
+ name: "android.hardware.soundtrigger@2.0-impl",
+ vendor: true,
+ relative_install_path: "hw",
+ srcs: ["FetchISoundTriggerHw.cpp"],
+ cflags: [
+ "-Wall",
+ "-Werror",
+ ],
+ shared_libs: [
+ "libhardware",
+ "libutils",
+ "android.hardware.soundtrigger@2.0",
+ "android.hardware.soundtrigger@2.0-core",
+ ],
+ compile_multilib: "32",
+ soong_config_variables: {
+ audioserver_multilib: {
+ compile_multilib: "%s",
+ },
+ },
+}
diff --git a/soundtrigger/2.0/default/Android.mk b/soundtrigger/2.0/default/Android.mk
deleted file mode 100644
index 17e4440..0000000
--- a/soundtrigger/2.0/default/Android.mk
+++ /dev/null
@@ -1,45 +0,0 @@
-#
-# Copyright (C) 2016 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.
-
-
-LOCAL_PATH := $(call my-dir)
-
-include $(CLEAR_VARS)
-LOCAL_MODULE := android.hardware.soundtrigger@2.0-impl
-LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0
-LOCAL_LICENSE_CONDITIONS := notice
-LOCAL_NOTICE_FILE := $(LOCAL_PATH)/../../../NOTICE
-LOCAL_VENDOR_MODULE := true
-LOCAL_MODULE_RELATIVE_PATH := hw
-LOCAL_SRC_FILES := \
- FetchISoundTriggerHw.cpp
-
-LOCAL_CFLAGS := -Wall -Werror
-
-LOCAL_SHARED_LIBRARIES := \
- libhardware \
- libutils \
- android.hardware.soundtrigger@2.0 \
- android.hardware.soundtrigger@2.0-core
-
-LOCAL_C_INCLUDE_DIRS := $(LOCAL_PATH)
-
-ifeq ($(strip $(AUDIOSERVER_MULTILIB)),)
-LOCAL_MULTILIB := 32
-else
-LOCAL_MULTILIB := $(AUDIOSERVER_MULTILIB)
-endif
-
-include $(BUILD_SHARED_LIBRARY)
diff --git a/soundtrigger/2.1/default/Android.bp b/soundtrigger/2.1/default/Android.bp
new file mode 100644
index 0000000..a246680
--- /dev/null
+++ b/soundtrigger/2.1/default/Android.bp
@@ -0,0 +1,57 @@
+//
+// Copyright (C) 2018 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 {
+ // See: http://go/android-license-faq
+ default_applicable_licenses: [
+ "hardware_interfaces_license",
+ ],
+}
+
+soong_config_module_type_import {
+ from: "hardware/interfaces/soundtrigger/2.0/default/Android.bp",
+ module_types: ["soundtrigger_cc_library_shared"],
+}
+
+soundtrigger_cc_library_shared {
+ name: "android.hardware.soundtrigger@2.1-impl",
+ vendor: true,
+ relative_install_path: "hw",
+ srcs: ["SoundTriggerHw.cpp"],
+
+ cflags: [
+ "-Wall",
+ "-Werror",
+ ],
+
+ shared_libs: [
+ "libhardware",
+ "libhidlbase",
+ "libhidlmemory",
+ "liblog",
+ "libutils",
+ "android.hardware.soundtrigger@2.1",
+ "android.hardware.soundtrigger@2.0",
+ "android.hardware.soundtrigger@2.0-core",
+ "android.hidl.allocator@1.0",
+ "android.hidl.memory@1.0",
+ ],
+ compile_multilib: "32",
+ soong_config_variables: {
+ audioserver_multilib: {
+ compile_multilib: "%s",
+ },
+ },
+}
diff --git a/soundtrigger/2.1/default/Android.mk b/soundtrigger/2.1/default/Android.mk
deleted file mode 100644
index 602f5a7..0000000
--- a/soundtrigger/2.1/default/Android.mk
+++ /dev/null
@@ -1,51 +0,0 @@
-#
-# Copyright (C) 2018 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.
-
-
-LOCAL_PATH := $(call my-dir)
-
-include $(CLEAR_VARS)
-LOCAL_MODULE := android.hardware.soundtrigger@2.1-impl
-LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0
-LOCAL_LICENSE_CONDITIONS := notice
-LOCAL_NOTICE_FILE := $(LOCAL_PATH)/../../../NOTICE
-LOCAL_VENDOR_MODULE := true
-LOCAL_MODULE_RELATIVE_PATH := hw
-LOCAL_SRC_FILES := \
- SoundTriggerHw.cpp
-
-LOCAL_CFLAGS := -Wall -Werror
-
-LOCAL_SHARED_LIBRARIES := \
- libhardware \
- libhidlbase \
- libhidlmemory \
- liblog \
- libutils \
- android.hardware.soundtrigger@2.1 \
- android.hardware.soundtrigger@2.0 \
- android.hardware.soundtrigger@2.0-core \
- android.hidl.allocator@1.0 \
- android.hidl.memory@1.0
-
-LOCAL_C_INCLUDE_DIRS := $(LOCAL_PATH)
-
-ifeq ($(strip $(AUDIOSERVER_MULTILIB)),)
-LOCAL_MULTILIB := 32
-else
-LOCAL_MULTILIB := $(AUDIOSERVER_MULTILIB)
-endif
-
-include $(BUILD_SHARED_LIBRARY)
diff --git a/threadnetwork/aidl/default/socket_interface.cpp b/threadnetwork/aidl/default/socket_interface.cpp
index a5aa2b4..71c6b4f 100644
--- a/threadnetwork/aidl/default/socket_interface.cpp
+++ b/threadnetwork/aidl/default/socket_interface.cpp
@@ -36,6 +36,7 @@
#include <vector>
#include "common/code_utils.hpp"
+#include "openthread/error.h"
#include "openthread/openthread-system.h"
#include "platform-posix.h"
@@ -56,14 +57,9 @@
otError SocketInterface::Init(ReceiveFrameCallback aCallback, void* aCallbackContext,
RxFrameBuffer& aFrameBuffer) {
- otError error = OT_ERROR_NONE;
+ otError error = InitSocket();
- VerifyOrExit(mSockFd == -1, error = OT_ERROR_ALREADY);
-
- WaitForSocketFileCreated(mRadioUrl.GetPath());
-
- mSockFd = OpenFile(mRadioUrl);
- VerifyOrExit(mSockFd != -1, error = OT_ERROR_FAILED);
+ VerifyOrExit(error == OT_ERROR_NONE);
mReceiveFrameCallback = aCallback;
mReceiveFrameContext = aCallbackContext;
@@ -155,9 +151,22 @@
VerifyOrExit(!mIsHardwareResetting, error = OT_ERROR_FAILED);
- WaitForSocketFileCreated(mRadioUrl.GetPath());
- mSockFd = OpenFile(mRadioUrl);
- VerifyOrExit(mSockFd != -1, error = OT_ERROR_FAILED);
+exit:
+ return error;
+}
+
+otError SocketInterface::InitSocket() {
+ otError error = OT_ERROR_NONE;
+ int retries = 0;
+
+ VerifyOrExit(mSockFd == -1, error = OT_ERROR_ALREADY);
+
+ while (retries++ < kMaxRetriesForSocketInit) {
+ WaitForSocketFileCreated(mRadioUrl.GetPath());
+ mSockFd = OpenFile(mRadioUrl);
+ VerifyOrExit(mSockFd == -1);
+ }
+ error = OT_ERROR_FAILED;
exit:
return error;
@@ -168,11 +177,16 @@
assert(context != nullptr);
+ VerifyOrExit(mSockFd != -1);
+
FD_SET(mSockFd, &context->mReadFdSet);
if (context->mMaxFd < mSockFd) {
context->mMaxFd = mSockFd;
}
+
+exit:
+ return;
}
void SocketInterface::Process(const void* aMainloopContext) {
@@ -181,9 +195,14 @@
assert(context != nullptr);
+ VerifyOrExit(mSockFd != -1);
+
if (FD_ISSET(mSockFd, &context->mReadFdSet)) {
Read();
}
+
+exit:
+ return;
}
otError SocketInterface::HardwareReset(void) {
@@ -198,22 +217,24 @@
void SocketInterface::Read(void) {
uint8_t buffer[kMaxFrameSize];
+ ssize_t rval;
- ssize_t rval = TEMP_FAILURE_RETRY(read(mSockFd, buffer, sizeof(buffer)));
+ VerifyOrExit(mSockFd != -1);
+
+ rval = TEMP_FAILURE_RETRY(read(mSockFd, buffer, sizeof(buffer)));
if (rval > 0) {
ProcessReceivedData(buffer, static_cast<uint16_t>(rval));
} else if (rval < 0) {
DieNow(OT_EXIT_ERROR_ERRNO);
} else {
- if (mIsHardwareResetting) {
- LogInfo("Socket connection is closed due to hardware reset.");
- ResetStates();
- } else {
- LogCrit("Socket connection is closed by remote.");
- exit(OT_EXIT_FAILURE);
- }
+ LogWarn("Socket connection is closed by remote, isHardwareReset: %d", mIsHardwareResetting);
+ ResetStates();
+ InitSocket();
}
+
+exit:
+ return;
}
void SocketInterface::Write(const uint8_t* aFrame, uint16_t aLength) {
diff --git a/threadnetwork/aidl/default/socket_interface.hpp b/threadnetwork/aidl/default/socket_interface.hpp
index 494d76a..83c86e8 100644
--- a/threadnetwork/aidl/default/socket_interface.hpp
+++ b/threadnetwork/aidl/default/socket_interface.hpp
@@ -247,6 +247,15 @@
otError WaitForHardwareResetCompletion(uint32_t aTimeoutMs);
/**
+ * Initialize socket
+ *
+ * @retval TRUE Socket initialization is successful.
+ * @retval FALSE Socket initialization is failed.
+ *
+ */
+ otError InitSocket();
+
+ /**
* Reset socket interface to intitial state.
*
*/
@@ -257,6 +266,7 @@
///< descriptor to become available.
kMaxRetriesForSocketCloseCheck = 3, ///< Maximum retry times for checking
///< if socket is closed.
+ kMaxRetriesForSocketInit = 3, ///< Maximum retry times for socket initialization.
};
ReceiveFrameCallback mReceiveFrameCallback;
diff --git a/tv/tuner/aidl/Android.bp b/tv/tuner/aidl/Android.bp
index efcc327..7ffc8bb 100644
--- a/tv/tuner/aidl/Android.bp
+++ b/tv/tuner/aidl/Android.bp
@@ -39,7 +39,6 @@
"android.hardware.common.fmq-V1",
],
},
-
],
}
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/AudioPreselectionRenderingIndicationType.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/AudioPreselectionRenderingIndicationType.aidl
index 783511f..2977ff6 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/AudioPreselectionRenderingIndicationType.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/AudioPreselectionRenderingIndicationType.aidl
@@ -35,9 +35,9 @@
/* @hide */
@Backing(type="int") @VintfStability
enum AudioPreselectionRenderingIndicationType {
- NOT_INDICATED = 0,
- STEREO = 1,
- TWO_DIMENSIONAL = 2,
- THREE_DIMENSIONAL = 3,
- HEADPHONE = 4,
+ NOT_INDICATED,
+ STEREO,
+ TWO_DIMENSIONAL,
+ THREE_DIMENSIONAL,
+ HEADPHONE,
}
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/AudioPresentation.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/AudioPresentation.aidl
index 96a6d98..eba820c 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/AudioPresentation.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/AudioPresentation.aidl
@@ -36,5 +36,5 @@
@VintfStability
parcelable AudioPresentation {
android.hardware.tv.tuner.AudioPreselection preselection;
- int ac4ShortProgramId = -1;
+ int ac4ShortProgramId = (-1) /* -1 */;
}
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/AudioStreamType.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/AudioStreamType.aidl
index 6c538ea..4754bb1 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/AudioStreamType.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/AudioStreamType.aidl
@@ -35,24 +35,24 @@
/* @hide */
@Backing(type="int") @VintfStability
enum AudioStreamType {
- UNDEFINED = 0,
- PCM = 1,
- MP3 = 2,
- MPEG1 = 3,
- MPEG2 = 4,
- MPEGH = 5,
- AAC = 6,
- AC3 = 7,
- EAC3 = 8,
- AC4 = 9,
- DTS = 10,
- DTS_HD = 11,
- WMA = 12,
- OPUS = 13,
- VORBIS = 14,
- DRA = 15,
- AAC_ADTS = 16,
- AAC_LATM = 17,
- AAC_HE_ADTS = 18,
- AAC_HE_LATM = 19,
+ UNDEFINED,
+ PCM,
+ MP3,
+ MPEG1,
+ MPEG2,
+ MPEGH,
+ AAC,
+ AC3,
+ EAC3,
+ AC4,
+ DTS,
+ DTS_HD,
+ WMA,
+ OPUS,
+ VORBIS,
+ DRA,
+ AAC_ADTS,
+ AAC_LATM,
+ AAC_HE_ADTS,
+ AAC_HE_LATM,
}
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/Constant.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/Constant.aidl
index 95ecc51..1f7153b 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/Constant.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/Constant.aidl
@@ -35,17 +35,17 @@
/* @hide */
@Backing(type="int") @VintfStability
enum Constant {
- INVALID_TS_PID = 65535,
- INVALID_STREAM_ID = 65535,
- INVALID_FILTER_ID = -1,
- INVALID_AV_SYNC_ID = -1,
- INVALID_MMTP_RECORD_EVENT_MPT_SEQUENCE_NUM = -1,
- INVALID_FIRST_MACROBLOCK_IN_SLICE = -1,
- INVALID_FRONTEND_SETTING_FREQUENCY = -1,
- INVALID_IP_FILTER_CONTEXT_ID = -1,
- INVALID_LTS_ID = -1,
- INVALID_FRONTEND_ID = -1,
- INVALID_LNB_ID = -1,
- INVALID_KEYTOKEN = 0,
- INVALID_TABINFO_VERSION = -1,
+ INVALID_TS_PID = 0xFFFF,
+ INVALID_STREAM_ID = 0xFFFF,
+ INVALID_FILTER_ID = 0xFFFFFFFF,
+ INVALID_AV_SYNC_ID = 0xFFFFFFFF,
+ INVALID_MMTP_RECORD_EVENT_MPT_SEQUENCE_NUM = 0xFFFFFFFF,
+ INVALID_FIRST_MACROBLOCK_IN_SLICE = 0xFFFFFFFF,
+ INVALID_FRONTEND_SETTING_FREQUENCY = 0xFFFFFFFF,
+ INVALID_IP_FILTER_CONTEXT_ID = 0xFFFFFFFF,
+ INVALID_LTS_ID = 0xFFFFFFFF,
+ INVALID_FRONTEND_ID = 0xFFFFFFFF,
+ INVALID_LNB_ID = 0xFFFFFFFF,
+ INVALID_KEYTOKEN = 0x00,
+ INVALID_TABINFO_VERSION = 0xFFFFFFFF,
}
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/Constant64Bit.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/Constant64Bit.aidl
index a56a0cf..ccbfd1a 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/Constant64Bit.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/Constant64Bit.aidl
@@ -35,7 +35,7 @@
/* @hide */
@Backing(type="long") @VintfStability
enum Constant64Bit {
- INVALID_FILTER_ID_64BIT = -1,
- INVALID_AV_SYNC_ID_64BIT = -1,
- INVALID_PRESENTATION_TIME_STAMP = -1,
+ INVALID_FILTER_ID_64BIT = 0xFFFFFFFFFFFFFFFF,
+ INVALID_AV_SYNC_ID_64BIT = 0xFFFFFFFFFFFFFFFF,
+ INVALID_PRESENTATION_TIME_STAMP = 0xFFFFFFFFFFFFFFFF,
}
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DataFormat.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DataFormat.aidl
index 3b8fee4..5fb34ba 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DataFormat.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DataFormat.aidl
@@ -35,9 +35,9 @@
/* @hide */
@Backing(type="int") @VintfStability
enum DataFormat {
- TS = 0,
- PES = 1,
- ES = 2,
- SHV_TLV = 3,
- UNDEFINED = 4,
+ TS,
+ PES,
+ ES,
+ SHV_TLV,
+ UNDEFINED,
}
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxAlpFilterType.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxAlpFilterType.aidl
index f0df497..c164f19 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxAlpFilterType.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxAlpFilterType.aidl
@@ -35,8 +35,8 @@
/* @hide */
@Backing(type="int") @VintfStability
enum DemuxAlpFilterType {
- UNDEFINED = 0,
- SECTION = 1,
- PTP = 2,
- PAYLOAD_THROUGH = 3,
+ UNDEFINED,
+ SECTION,
+ PTP,
+ PAYLOAD_THROUGH,
}
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxAlpLengthType.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxAlpLengthType.aidl
index ccca6de..59edc34 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxAlpLengthType.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxAlpLengthType.aidl
@@ -36,6 +36,6 @@
@Backing(type="byte") @VintfStability
enum DemuxAlpLengthType {
UNDEFINED = 0,
- WITHOUT_ADDITIONAL_HEADER = 1,
- WITH_ADDITIONAL_HEADER = 2,
+ WITHOUT_ADDITIONAL_HEADER,
+ WITH_ADDITIONAL_HEADER,
}
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxFilterMainType.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxFilterMainType.aidl
index 6abd87b..b78965d 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxFilterMainType.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxFilterMainType.aidl
@@ -36,9 +36,9 @@
@Backing(type="int") @VintfStability
enum DemuxFilterMainType {
UNDEFINED = 0,
- TS = 1,
- MMTP = 2,
- IP = 4,
- TLV = 8,
- ALP = 16,
+ TS = (1 << 0) /* 1 */,
+ MMTP = (1 << 1) /* 2 */,
+ IP = (1 << 2) /* 4 */,
+ TLV = (1 << 3) /* 8 */,
+ ALP = (1 << 4) /* 16 */,
}
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxFilterMediaEvent.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxFilterMediaEvent.aidl
index 61a9555..126c740 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxFilterMediaEvent.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxFilterMediaEvent.aidl
@@ -49,4 +49,7 @@
boolean isPesPrivateData;
android.hardware.tv.tuner.DemuxFilterMediaEventExtraMetaData extraMetaData;
android.hardware.tv.tuner.DemuxFilterScIndexMask scIndexMask;
+ int numDataPieces;
+ int indexInDataGroup;
+ int dataGroupId;
}
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxFilterMonitorEventType.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxFilterMonitorEventType.aidl
index 5d27f76..062650b 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxFilterMonitorEventType.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxFilterMonitorEventType.aidl
@@ -35,6 +35,6 @@
/* @hide */
@Backing(type="int") @VintfStability
enum DemuxFilterMonitorEventType {
- SCRAMBLING_STATUS = 1,
- IP_CID_CHANGE = 2,
+ SCRAMBLING_STATUS = (1 << 0) /* 1 */,
+ IP_CID_CHANGE = (1 << 1) /* 2 */,
}
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxFilterStatus.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxFilterStatus.aidl
index 1dc593a..cfc5838 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxFilterStatus.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxFilterStatus.aidl
@@ -35,9 +35,9 @@
/* @hide */
@Backing(type="byte") @VintfStability
enum DemuxFilterStatus {
- DATA_READY = 1,
- LOW_WATER = 2,
- HIGH_WATER = 4,
- OVERFLOW = 8,
- NO_DATA = 16,
+ DATA_READY = (1 << 0) /* 1 */,
+ LOW_WATER = (1 << 1) /* 2 */,
+ HIGH_WATER = (1 << 2) /* 4 */,
+ OVERFLOW = (1 << 3) /* 8 */,
+ NO_DATA = (1 << 4) /* 16 */,
}
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxInfo.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxInfo.aidl
index 872d963..12f9dc8 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxInfo.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxInfo.aidl
@@ -35,5 +35,5 @@
/* @hide */
@VintfStability
parcelable DemuxInfo {
- int filterTypes = 0;
+ int filterTypes = android.hardware.tv.tuner.DemuxFilterMainType.UNDEFINED /* 0 */;
}
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxIpFilterType.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxIpFilterType.aidl
index b78ac9a..7320aec 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxIpFilterType.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxIpFilterType.aidl
@@ -35,10 +35,10 @@
/* @hide */
@Backing(type="int") @VintfStability
enum DemuxIpFilterType {
- UNDEFINED = 0,
- SECTION = 1,
- NTP = 2,
- IP_PAYLOAD = 3,
- IP = 4,
- PAYLOAD_THROUGH = 5,
+ UNDEFINED,
+ SECTION,
+ NTP,
+ IP_PAYLOAD,
+ IP,
+ PAYLOAD_THROUGH,
}
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxMmtpFilterType.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxMmtpFilterType.aidl
index 7e9e3a6..a89c5b1 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxMmtpFilterType.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxMmtpFilterType.aidl
@@ -35,12 +35,12 @@
/* @hide */
@Backing(type="int") @VintfStability
enum DemuxMmtpFilterType {
- UNDEFINED = 0,
- SECTION = 1,
- PES = 2,
- MMTP = 3,
- AUDIO = 4,
- VIDEO = 5,
- RECORD = 6,
- DOWNLOAD = 7,
+ UNDEFINED,
+ SECTION,
+ PES,
+ MMTP,
+ AUDIO,
+ VIDEO,
+ RECORD,
+ DOWNLOAD,
}
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxQueueNotifyBits.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxQueueNotifyBits.aidl
index bcd0aeb..ecb4e8b 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxQueueNotifyBits.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxQueueNotifyBits.aidl
@@ -35,6 +35,6 @@
/* @hide */
@Backing(type="int") @VintfStability
enum DemuxQueueNotifyBits {
- DATA_READY = 1,
- DATA_CONSUMED = 2,
+ DATA_READY = (1 << 0) /* 1 */,
+ DATA_CONSUMED = (1 << 1) /* 2 */,
}
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxRecordScIndexType.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxRecordScIndexType.aidl
index fb4430b..5556bb2 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxRecordScIndexType.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxRecordScIndexType.aidl
@@ -35,9 +35,9 @@
/* @hide */
@Backing(type="int") @VintfStability
enum DemuxRecordScIndexType {
- NONE = 0,
- SC = 1,
- SC_HEVC = 2,
- SC_AVC = 3,
- SC_VVC = 4,
+ NONE,
+ SC,
+ SC_HEVC,
+ SC_AVC,
+ SC_VVC,
}
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxScAvcIndex.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxScAvcIndex.aidl
index 651b66c..5c51793 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxScAvcIndex.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxScAvcIndex.aidl
@@ -36,9 +36,9 @@
@Backing(type="int") @VintfStability
enum DemuxScAvcIndex {
UNDEFINED = 0,
- I_SLICE = 1,
- P_SLICE = 2,
- B_SLICE = 4,
- SI_SLICE = 8,
- SP_SLICE = 16,
+ I_SLICE = (1 << 0) /* 1 */,
+ P_SLICE = (1 << 1) /* 2 */,
+ B_SLICE = (1 << 2) /* 4 */,
+ SI_SLICE = (1 << 3) /* 8 */,
+ SP_SLICE = (1 << 4) /* 16 */,
}
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxScHevcIndex.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxScHevcIndex.aidl
index 670b34e..d07bcb7 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxScHevcIndex.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxScHevcIndex.aidl
@@ -36,12 +36,12 @@
@Backing(type="int") @VintfStability
enum DemuxScHevcIndex {
UNDEFINED = 0,
- SPS = 1,
- AUD = 2,
- SLICE_CE_BLA_W_LP = 4,
- SLICE_BLA_W_RADL = 8,
- SLICE_BLA_N_LP = 16,
- SLICE_IDR_W_RADL = 32,
- SLICE_IDR_N_LP = 64,
- SLICE_TRAIL_CRA = 128,
+ SPS = (1 << 0) /* 1 */,
+ AUD = (1 << 1) /* 2 */,
+ SLICE_CE_BLA_W_LP = (1 << 2) /* 4 */,
+ SLICE_BLA_W_RADL = (1 << 3) /* 8 */,
+ SLICE_BLA_N_LP = (1 << 4) /* 16 */,
+ SLICE_IDR_W_RADL = (1 << 5) /* 32 */,
+ SLICE_IDR_N_LP = (1 << 6) /* 64 */,
+ SLICE_TRAIL_CRA = (1 << 7) /* 128 */,
}
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxScIndex.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxScIndex.aidl
index 25f0585..509c1ab 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxScIndex.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxScIndex.aidl
@@ -36,8 +36,8 @@
@Backing(type="int") @VintfStability
enum DemuxScIndex {
UNDEFINED = 0,
- I_FRAME = 1,
- P_FRAME = 2,
- B_FRAME = 4,
- SEQUENCE = 8,
+ I_FRAME = (1 << 0) /* 1 */,
+ P_FRAME = (1 << 1) /* 2 */,
+ B_FRAME = (1 << 2) /* 4 */,
+ SEQUENCE = (1 << 3) /* 8 */,
}
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxScVvcIndex.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxScVvcIndex.aidl
index 3e08d26..ac3a5e6 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxScVvcIndex.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxScVvcIndex.aidl
@@ -36,11 +36,11 @@
@Backing(type="int") @VintfStability
enum DemuxScVvcIndex {
UNDEFINED = 0,
- SLICE_IDR_W_RADL = 1,
- SLICE_IDR_N_LP = 2,
- SLICE_CRA = 4,
- SLICE_GDR = 8,
- VPS = 16,
- SPS = 32,
- AUD = 64,
+ SLICE_IDR_W_RADL = (1 << 0) /* 1 */,
+ SLICE_IDR_N_LP = (1 << 1) /* 2 */,
+ SLICE_CRA = (1 << 2) /* 4 */,
+ SLICE_GDR = (1 << 3) /* 8 */,
+ VPS = (1 << 4) /* 16 */,
+ SPS = (1 << 5) /* 32 */,
+ AUD = (1 << 6) /* 64 */,
}
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxTlvFilterType.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxTlvFilterType.aidl
index a4e1ff1..bd9e583 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxTlvFilterType.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxTlvFilterType.aidl
@@ -35,8 +35,8 @@
/* @hide */
@Backing(type="int") @VintfStability
enum DemuxTlvFilterType {
- UNDEFINED = 0,
- SECTION = 1,
- TLV = 2,
- PAYLOAD_THROUGH = 3,
+ UNDEFINED,
+ SECTION,
+ TLV,
+ PAYLOAD_THROUGH,
}
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxTsFilterType.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxTsFilterType.aidl
index 8b806bf..8be0e95 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxTsFilterType.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxTsFilterType.aidl
@@ -35,13 +35,13 @@
/* @hide */
@Backing(type="int") @VintfStability
enum DemuxTsFilterType {
- UNDEFINED = 0,
- SECTION = 1,
- PES = 2,
- TS = 3,
- AUDIO = 4,
- VIDEO = 5,
- PCR = 6,
- RECORD = 7,
- TEMI = 8,
+ UNDEFINED,
+ SECTION,
+ PES,
+ TS,
+ AUDIO,
+ VIDEO,
+ PCR,
+ RECORD,
+ TEMI,
}
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxTsIndex.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxTsIndex.aidl
index ed03477..9ca684f 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxTsIndex.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DemuxTsIndex.aidl
@@ -35,22 +35,22 @@
/* @hide */
@Backing(type="int") @VintfStability
enum DemuxTsIndex {
- FIRST_PACKET = 1,
- PAYLOAD_UNIT_START_INDICATOR = 2,
- CHANGE_TO_NOT_SCRAMBLED = 4,
- CHANGE_TO_EVEN_SCRAMBLED = 8,
- CHANGE_TO_ODD_SCRAMBLED = 16,
- DISCONTINUITY_INDICATOR = 32,
- RANDOM_ACCESS_INDICATOR = 64,
- PRIORITY_INDICATOR = 128,
- PCR_FLAG = 256,
- OPCR_FLAG = 512,
- SPLICING_POINT_FLAG = 1024,
- PRIVATE_DATA = 2048,
- ADAPTATION_EXTENSION_FLAG = 4096,
- MPT_INDEX_MPT = 65536,
- MPT_INDEX_VIDEO = 131072,
- MPT_INDEX_AUDIO = 262144,
- MPT_INDEX_TIMESTAMP_TARGET_VIDEO = 524288,
- MPT_INDEX_TIMESTAMP_TARGET_AUDIO = 1048576,
+ FIRST_PACKET = (1 << 0) /* 1 */,
+ PAYLOAD_UNIT_START_INDICATOR = (1 << 1) /* 2 */,
+ CHANGE_TO_NOT_SCRAMBLED = (1 << 2) /* 4 */,
+ CHANGE_TO_EVEN_SCRAMBLED = (1 << 3) /* 8 */,
+ CHANGE_TO_ODD_SCRAMBLED = (1 << 4) /* 16 */,
+ DISCONTINUITY_INDICATOR = (1 << 5) /* 32 */,
+ RANDOM_ACCESS_INDICATOR = (1 << 6) /* 64 */,
+ PRIORITY_INDICATOR = (1 << 7) /* 128 */,
+ PCR_FLAG = (1 << 8) /* 256 */,
+ OPCR_FLAG = (1 << 9) /* 512 */,
+ SPLICING_POINT_FLAG = (1 << 10) /* 1024 */,
+ PRIVATE_DATA = (1 << 11) /* 2048 */,
+ ADAPTATION_EXTENSION_FLAG = (1 << 12) /* 4096 */,
+ MPT_INDEX_MPT = (1 << 16) /* 65536 */,
+ MPT_INDEX_VIDEO = (1 << 17) /* 131072 */,
+ MPT_INDEX_AUDIO = (1 << 18) /* 262144 */,
+ MPT_INDEX_TIMESTAMP_TARGET_VIDEO = (1 << 19) /* 524288 */,
+ MPT_INDEX_TIMESTAMP_TARGET_AUDIO = (1 << 20) /* 1048576 */,
}
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DvrType.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DvrType.aidl
index 3a0c1e4..6dab74b 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DvrType.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/DvrType.aidl
@@ -35,6 +35,6 @@
/* @hide */
@Backing(type="byte") @VintfStability
enum DvrType {
- RECORD = 0,
- PLAYBACK = 1,
+ RECORD,
+ PLAYBACK,
}
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FilterDelayHintType.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FilterDelayHintType.aidl
index 8c5a3f5..af35c70 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FilterDelayHintType.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FilterDelayHintType.aidl
@@ -35,7 +35,7 @@
/* @hide */
@Backing(type="int") @VintfStability
enum FilterDelayHintType {
- INVALID = 0,
- TIME_DELAY_IN_MS = 1,
- DATA_SIZE_DELAY_IN_BYTES = 2,
+ INVALID,
+ TIME_DELAY_IN_MS,
+ DATA_SIZE_DELAY_IN_BYTES,
}
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendAnalogAftFlag.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendAnalogAftFlag.aidl
index 6b32110..45aa2af 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendAnalogAftFlag.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendAnalogAftFlag.aidl
@@ -35,7 +35,7 @@
/* @hide */
@Backing(type="int") @VintfStability
enum FrontendAnalogAftFlag {
- UNDEFINED = 0,
- AFT_TRUE = 1,
- AFT_FALSE = 2,
+ UNDEFINED,
+ AFT_TRUE,
+ AFT_FALSE,
}
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendAnalogSifStandard.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendAnalogSifStandard.aidl
index 3502522..8d19461 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendAnalogSifStandard.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendAnalogSifStandard.aidl
@@ -36,22 +36,22 @@
@Backing(type="int") @VintfStability
enum FrontendAnalogSifStandard {
UNDEFINED = 0,
- AUTO = 1,
- BG = 2,
- BG_A2 = 4,
- BG_NICAM = 8,
- I = 16,
- DK = 32,
- DK1_A2 = 64,
- DK2_A2 = 128,
- DK3_A2 = 256,
- DK_NICAM = 512,
- L = 1024,
- M = 2048,
- M_BTSC = 4096,
- M_A2 = 8192,
- M_EIAJ = 16384,
- I_NICAM = 32768,
- L_NICAM = 65536,
- L_PRIME = 131072,
+ AUTO = (1 << 0) /* 1 */,
+ BG = (1 << 1) /* 2 */,
+ BG_A2 = (1 << 2) /* 4 */,
+ BG_NICAM = (1 << 3) /* 8 */,
+ I = (1 << 4) /* 16 */,
+ DK = (1 << 5) /* 32 */,
+ DK1_A2 = (1 << 6) /* 64 */,
+ DK2_A2 = (1 << 7) /* 128 */,
+ DK3_A2 = (1 << 8) /* 256 */,
+ DK_NICAM = (1 << 9) /* 512 */,
+ L = (1 << 10) /* 1024 */,
+ M = (1 << 11) /* 2048 */,
+ M_BTSC = (1 << 12) /* 4096 */,
+ M_A2 = (1 << 13) /* 8192 */,
+ M_EIAJ = (1 << 14) /* 16384 */,
+ I_NICAM = (1 << 15) /* 32768 */,
+ L_NICAM = (1 << 16) /* 65536 */,
+ L_PRIME = (1 << 17) /* 131072 */,
}
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendAnalogType.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendAnalogType.aidl
index 33fd93d..bf8b000 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendAnalogType.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendAnalogType.aidl
@@ -36,12 +36,12 @@
@Backing(type="int") @VintfStability
enum FrontendAnalogType {
UNDEFINED = 0,
- AUTO = 1,
- PAL = 2,
- PAL_M = 4,
- PAL_N = 8,
- PAL_60 = 16,
- NTSC = 32,
- NTSC_443 = 64,
- SECAM = 128,
+ AUTO = (1 << 0) /* 1 */,
+ PAL = (1 << 1) /* 2 */,
+ PAL_M = (1 << 2) /* 4 */,
+ PAL_N = (1 << 3) /* 8 */,
+ PAL_60 = (1 << 4) /* 16 */,
+ NTSC = (1 << 5) /* 32 */,
+ NTSC_443 = (1 << 6) /* 64 */,
+ SECAM = (1 << 7) /* 128 */,
}
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendAtsc3Bandwidth.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendAtsc3Bandwidth.aidl
index 51a3fc5..9704f40 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendAtsc3Bandwidth.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendAtsc3Bandwidth.aidl
@@ -36,8 +36,8 @@
@Backing(type="int") @VintfStability
enum FrontendAtsc3Bandwidth {
UNDEFINED = 0,
- AUTO = 1,
- BANDWIDTH_6MHZ = 2,
- BANDWIDTH_7MHZ = 4,
- BANDWIDTH_8MHZ = 8,
+ AUTO = (1 << 0) /* 1 */,
+ BANDWIDTH_6MHZ = (1 << 1) /* 2 */,
+ BANDWIDTH_7MHZ = (1 << 2) /* 4 */,
+ BANDWIDTH_8MHZ = (1 << 3) /* 8 */,
}
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendAtsc3CodeRate.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendAtsc3CodeRate.aidl
index aec0718..2d09271 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendAtsc3CodeRate.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendAtsc3CodeRate.aidl
@@ -36,17 +36,17 @@
@Backing(type="int") @VintfStability
enum FrontendAtsc3CodeRate {
UNDEFINED = 0,
- AUTO = 1,
- CODERATE_2_15 = 2,
- CODERATE_3_15 = 4,
- CODERATE_4_15 = 8,
- CODERATE_5_15 = 16,
- CODERATE_6_15 = 32,
- CODERATE_7_15 = 64,
- CODERATE_8_15 = 128,
- CODERATE_9_15 = 256,
- CODERATE_10_15 = 512,
- CODERATE_11_15 = 1024,
- CODERATE_12_15 = 2048,
- CODERATE_13_15 = 4096,
+ AUTO = (1 << 0) /* 1 */,
+ CODERATE_2_15 = (1 << 1) /* 2 */,
+ CODERATE_3_15 = (1 << 2) /* 4 */,
+ CODERATE_4_15 = (1 << 3) /* 8 */,
+ CODERATE_5_15 = (1 << 4) /* 16 */,
+ CODERATE_6_15 = (1 << 5) /* 32 */,
+ CODERATE_7_15 = (1 << 6) /* 64 */,
+ CODERATE_8_15 = (1 << 7) /* 128 */,
+ CODERATE_9_15 = (1 << 8) /* 256 */,
+ CODERATE_10_15 = (1 << 9) /* 512 */,
+ CODERATE_11_15 = (1 << 10) /* 1024 */,
+ CODERATE_12_15 = (1 << 11) /* 2048 */,
+ CODERATE_13_15 = (1 << 12) /* 4096 */,
}
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendAtsc3DemodOutputFormat.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendAtsc3DemodOutputFormat.aidl
index 8702a49..22267e7 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendAtsc3DemodOutputFormat.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendAtsc3DemodOutputFormat.aidl
@@ -36,6 +36,6 @@
@Backing(type="byte") @VintfStability
enum FrontendAtsc3DemodOutputFormat {
UNDEFINED = 0,
- ATSC3_LINKLAYER_PACKET = 1,
- BASEBAND_PACKET = 2,
+ ATSC3_LINKLAYER_PACKET = (1 << 0) /* 1 */,
+ BASEBAND_PACKET = (1 << 1) /* 2 */,
}
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendAtsc3Fec.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendAtsc3Fec.aidl
index a2c140a..2e229c0 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendAtsc3Fec.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendAtsc3Fec.aidl
@@ -36,11 +36,11 @@
@Backing(type="int") @VintfStability
enum FrontendAtsc3Fec {
UNDEFINED = 0,
- AUTO = 1,
- BCH_LDPC_16K = 2,
- BCH_LDPC_64K = 4,
- CRC_LDPC_16K = 8,
- CRC_LDPC_64K = 16,
- LDPC_16K = 32,
- LDPC_64K = 64,
+ AUTO = (1 << 0) /* 1 */,
+ BCH_LDPC_16K = (1 << 1) /* 2 */,
+ BCH_LDPC_64K = (1 << 2) /* 4 */,
+ CRC_LDPC_16K = (1 << 3) /* 8 */,
+ CRC_LDPC_64K = (1 << 4) /* 16 */,
+ LDPC_16K = (1 << 5) /* 32 */,
+ LDPC_64K = (1 << 6) /* 64 */,
}
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendAtsc3Modulation.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendAtsc3Modulation.aidl
index 09e513d..cbe8c1f 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendAtsc3Modulation.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendAtsc3Modulation.aidl
@@ -36,11 +36,11 @@
@Backing(type="int") @VintfStability
enum FrontendAtsc3Modulation {
UNDEFINED = 0,
- AUTO = 1,
- MOD_QPSK = 2,
- MOD_16QAM = 4,
- MOD_64QAM = 8,
- MOD_256QAM = 16,
- MOD_1024QAM = 32,
- MOD_4096QAM = 64,
+ AUTO = (1 << 0) /* 1 */,
+ MOD_QPSK = (1 << 1) /* 2 */,
+ MOD_16QAM = (1 << 2) /* 4 */,
+ MOD_64QAM = (1 << 3) /* 8 */,
+ MOD_256QAM = (1 << 4) /* 16 */,
+ MOD_1024QAM = (1 << 5) /* 32 */,
+ MOD_4096QAM = (1 << 6) /* 64 */,
}
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendAtsc3TimeInterleaveMode.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendAtsc3TimeInterleaveMode.aidl
index a9747f0..4e70641 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendAtsc3TimeInterleaveMode.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendAtsc3TimeInterleaveMode.aidl
@@ -36,7 +36,7 @@
@Backing(type="int") @VintfStability
enum FrontendAtsc3TimeInterleaveMode {
UNDEFINED = 0,
- AUTO = 1,
- CTI = 2,
- HTI = 4,
+ AUTO = (1 << 0) /* 1 */,
+ CTI = (1 << 1) /* 2 */,
+ HTI = (1 << 2) /* 4 */,
}
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendAtscModulation.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendAtscModulation.aidl
index 426fe20..7da48f1 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendAtscModulation.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendAtscModulation.aidl
@@ -36,7 +36,7 @@
@Backing(type="int") @VintfStability
enum FrontendAtscModulation {
UNDEFINED = 0,
- AUTO = 1,
- MOD_8VSB = 4,
- MOD_16VSB = 8,
+ AUTO = (1 << 0) /* 1 */,
+ MOD_8VSB = (1 << 2) /* 4 */,
+ MOD_16VSB = (1 << 3) /* 8 */,
}
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendCableTimeInterleaveMode.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendCableTimeInterleaveMode.aidl
index ff71df3..61cbf12 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendCableTimeInterleaveMode.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendCableTimeInterleaveMode.aidl
@@ -36,14 +36,14 @@
@Backing(type="int") @VintfStability
enum FrontendCableTimeInterleaveMode {
UNDEFINED = 0,
- AUTO = 1,
- INTERLEAVING_128_1_0 = 2,
- INTERLEAVING_128_1_1 = 4,
- INTERLEAVING_64_2 = 8,
- INTERLEAVING_32_4 = 16,
- INTERLEAVING_16_8 = 32,
- INTERLEAVING_8_16 = 64,
- INTERLEAVING_128_2 = 128,
- INTERLEAVING_128_3 = 256,
- INTERLEAVING_128_4 = 512,
+ AUTO = (1 << 0) /* 1 */,
+ INTERLEAVING_128_1_0 = (1 << 1) /* 2 */,
+ INTERLEAVING_128_1_1 = (1 << 2) /* 4 */,
+ INTERLEAVING_64_2 = (1 << 3) /* 8 */,
+ INTERLEAVING_32_4 = (1 << 4) /* 16 */,
+ INTERLEAVING_16_8 = (1 << 5) /* 32 */,
+ INTERLEAVING_8_16 = (1 << 6) /* 64 */,
+ INTERLEAVING_128_2 = (1 << 7) /* 128 */,
+ INTERLEAVING_128_3 = (1 << 8) /* 256 */,
+ INTERLEAVING_128_4 = (1 << 9) /* 512 */,
}
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendDtmbBandwidth.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendDtmbBandwidth.aidl
index 18d71d2..6f62d91 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendDtmbBandwidth.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendDtmbBandwidth.aidl
@@ -36,7 +36,7 @@
@Backing(type="int") @VintfStability
enum FrontendDtmbBandwidth {
UNDEFINED = 0,
- AUTO = 1,
- BANDWIDTH_8MHZ = 2,
- BANDWIDTH_6MHZ = 4,
+ AUTO = (1 << 0) /* 1 */,
+ BANDWIDTH_8MHZ = (1 << 1) /* 2 */,
+ BANDWIDTH_6MHZ = (1 << 2) /* 4 */,
}
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendDtmbCodeRate.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendDtmbCodeRate.aidl
index c9454e7..d6be639 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendDtmbCodeRate.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendDtmbCodeRate.aidl
@@ -36,8 +36,8 @@
@Backing(type="int") @VintfStability
enum FrontendDtmbCodeRate {
UNDEFINED = 0,
- AUTO = 1,
- CODERATE_2_5 = 2,
- CODERATE_3_5 = 4,
- CODERATE_4_5 = 8,
+ AUTO = (1 << 0) /* 1 */,
+ CODERATE_2_5 = (1 << 1) /* 2 */,
+ CODERATE_3_5 = (1 << 2) /* 4 */,
+ CODERATE_4_5 = (1 << 3) /* 8 */,
}
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendDtmbGuardInterval.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendDtmbGuardInterval.aidl
index 872eb6a..5626064 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendDtmbGuardInterval.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendDtmbGuardInterval.aidl
@@ -36,11 +36,11 @@
@Backing(type="int") @VintfStability
enum FrontendDtmbGuardInterval {
UNDEFINED = 0,
- AUTO = 1,
- PN_420_VARIOUS = 2,
- PN_595_CONST = 4,
- PN_945_VARIOUS = 8,
- PN_420_CONST = 16,
- PN_945_CONST = 32,
- PN_RESERVED = 64,
+ AUTO = (1 << 0) /* 1 */,
+ PN_420_VARIOUS = (1 << 1) /* 2 */,
+ PN_595_CONST = (1 << 2) /* 4 */,
+ PN_945_VARIOUS = (1 << 3) /* 8 */,
+ PN_420_CONST = (1 << 4) /* 16 */,
+ PN_945_CONST = (1 << 5) /* 32 */,
+ PN_RESERVED = (1 << 6) /* 64 */,
}
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendDtmbModulation.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendDtmbModulation.aidl
index 088aac5..036e64b 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendDtmbModulation.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendDtmbModulation.aidl
@@ -36,10 +36,10 @@
@Backing(type="int") @VintfStability
enum FrontendDtmbModulation {
UNDEFINED = 0,
- AUTO = 1,
- CONSTELLATION_4QAM = 2,
- CONSTELLATION_4QAM_NR = 4,
- CONSTELLATION_16QAM = 8,
- CONSTELLATION_32QAM = 16,
- CONSTELLATION_64QAM = 32,
+ AUTO = (1 << 0) /* 1 */,
+ CONSTELLATION_4QAM = (1 << 1) /* 2 */,
+ CONSTELLATION_4QAM_NR = (1 << 2) /* 4 */,
+ CONSTELLATION_16QAM = (1 << 3) /* 8 */,
+ CONSTELLATION_32QAM = (1 << 4) /* 16 */,
+ CONSTELLATION_64QAM = (1 << 5) /* 32 */,
}
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendDtmbTimeInterleaveMode.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendDtmbTimeInterleaveMode.aidl
index 8321ad0..1223887 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendDtmbTimeInterleaveMode.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendDtmbTimeInterleaveMode.aidl
@@ -36,7 +36,7 @@
@Backing(type="int") @VintfStability
enum FrontendDtmbTimeInterleaveMode {
UNDEFINED = 0,
- AUTO = 1,
- TIMER_INT_240 = 2,
- TIMER_INT_720 = 4,
+ AUTO = (1 << 0) /* 1 */,
+ TIMER_INT_240 = (1 << 1) /* 2 */,
+ TIMER_INT_720 = (1 << 2) /* 4 */,
}
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendDtmbTransmissionMode.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendDtmbTransmissionMode.aidl
index 5298291..0498825 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendDtmbTransmissionMode.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendDtmbTransmissionMode.aidl
@@ -36,7 +36,7 @@
@Backing(type="int") @VintfStability
enum FrontendDtmbTransmissionMode {
UNDEFINED = 0,
- AUTO = 1,
- C1 = 2,
- C3780 = 4,
+ AUTO = (1 << 0) /* 1 */,
+ C1 = (1 << 1) /* 2 */,
+ C3780 = (1 << 2) /* 4 */,
}
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendDvbcAnnex.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendDvbcAnnex.aidl
index cdfedb6..985add1 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendDvbcAnnex.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendDvbcAnnex.aidl
@@ -36,7 +36,7 @@
@Backing(type="byte") @VintfStability
enum FrontendDvbcAnnex {
UNDEFINED = 0,
- A = 1,
- B = 2,
- C = 4,
+ A = (1 << 0) /* 1 */,
+ B = (1 << 1) /* 2 */,
+ C = (1 << 2) /* 4 */,
}
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendDvbcBandwidth.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendDvbcBandwidth.aidl
index f0fe460..c253cfe 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendDvbcBandwidth.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendDvbcBandwidth.aidl
@@ -36,8 +36,8 @@
@Backing(type="int") @VintfStability
enum FrontendDvbcBandwidth {
UNDEFINED = 0,
- BANDWIDTH_5MHZ = 1,
- BANDWIDTH_6MHZ = 2,
- BANDWIDTH_7MHZ = 4,
- BANDWIDTH_8MHZ = 8,
+ BANDWIDTH_5MHZ = (1 << 0) /* 1 */,
+ BANDWIDTH_6MHZ = (1 << 1) /* 2 */,
+ BANDWIDTH_7MHZ = (1 << 2) /* 4 */,
+ BANDWIDTH_8MHZ = (1 << 3) /* 8 */,
}
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendDvbcModulation.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendDvbcModulation.aidl
index 0871777..c18e83e 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendDvbcModulation.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendDvbcModulation.aidl
@@ -36,10 +36,10 @@
@Backing(type="int") @VintfStability
enum FrontendDvbcModulation {
UNDEFINED = 0,
- AUTO = 1,
- MOD_16QAM = 2,
- MOD_32QAM = 4,
- MOD_64QAM = 8,
- MOD_128QAM = 16,
- MOD_256QAM = 32,
+ AUTO = (1 << 0) /* 1 */,
+ MOD_16QAM = (1 << 1) /* 2 */,
+ MOD_32QAM = (1 << 2) /* 4 */,
+ MOD_64QAM = (1 << 3) /* 8 */,
+ MOD_128QAM = (1 << 4) /* 16 */,
+ MOD_256QAM = (1 << 5) /* 32 */,
}
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendDvbcOuterFec.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendDvbcOuterFec.aidl
index f1e92c9..a6fbc6d 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendDvbcOuterFec.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendDvbcOuterFec.aidl
@@ -36,6 +36,6 @@
@Backing(type="int") @VintfStability
enum FrontendDvbcOuterFec {
UNDEFINED = 0,
- OUTER_FEC_NONE = 1,
- OUTER_FEC_RS = 2,
+ OUTER_FEC_NONE,
+ OUTER_FEC_RS,
}
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendDvbsModulation.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendDvbsModulation.aidl
index 25951cc..71957d5 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendDvbsModulation.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendDvbsModulation.aidl
@@ -36,18 +36,18 @@
@Backing(type="int") @VintfStability
enum FrontendDvbsModulation {
UNDEFINED = 0,
- AUTO = 1,
- MOD_QPSK = 2,
- MOD_8PSK = 4,
- MOD_16QAM = 8,
- MOD_16PSK = 16,
- MOD_32PSK = 32,
- MOD_ACM = 64,
- MOD_8APSK = 128,
- MOD_16APSK = 256,
- MOD_32APSK = 512,
- MOD_64APSK = 1024,
- MOD_128APSK = 2048,
- MOD_256APSK = 4096,
- MOD_RESERVED = 8192,
+ AUTO = (1 << 0) /* 1 */,
+ MOD_QPSK = (1 << 1) /* 2 */,
+ MOD_8PSK = (1 << 2) /* 4 */,
+ MOD_16QAM = (1 << 3) /* 8 */,
+ MOD_16PSK = (1 << 4) /* 16 */,
+ MOD_32PSK = (1 << 5) /* 32 */,
+ MOD_ACM = (1 << 6) /* 64 */,
+ MOD_8APSK = (1 << 7) /* 128 */,
+ MOD_16APSK = (1 << 8) /* 256 */,
+ MOD_32APSK = (1 << 9) /* 512 */,
+ MOD_64APSK = (1 << 10) /* 1024 */,
+ MOD_128APSK = (1 << 11) /* 2048 */,
+ MOD_256APSK = (1 << 12) /* 4096 */,
+ MOD_RESERVED = (1 << 13) /* 8192 */,
}
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendDvbsPilot.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendDvbsPilot.aidl
index 4f2c6eb..e3543b3 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendDvbsPilot.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendDvbsPilot.aidl
@@ -35,8 +35,8 @@
/* @hide */
@Backing(type="int") @VintfStability
enum FrontendDvbsPilot {
- UNDEFINED = 0,
- ON = 1,
- OFF = 2,
- AUTO = 3,
+ UNDEFINED,
+ ON,
+ OFF,
+ AUTO,
}
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendDvbsRolloff.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendDvbsRolloff.aidl
index 56ee37b..2181abf 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendDvbsRolloff.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendDvbsRolloff.aidl
@@ -35,11 +35,11 @@
/* @hide */
@Backing(type="int") @VintfStability
enum FrontendDvbsRolloff {
- UNDEFINED = 0,
- ROLLOFF_0_35 = 1,
- ROLLOFF_0_25 = 2,
- ROLLOFF_0_20 = 3,
- ROLLOFF_0_15 = 4,
- ROLLOFF_0_10 = 5,
- ROLLOFF_0_5 = 6,
+ UNDEFINED,
+ ROLLOFF_0_35,
+ ROLLOFF_0_25,
+ ROLLOFF_0_20,
+ ROLLOFF_0_15,
+ ROLLOFF_0_10,
+ ROLLOFF_0_5,
}
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendDvbsScanType.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendDvbsScanType.aidl
index 110b1d8..46edb56 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendDvbsScanType.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendDvbsScanType.aidl
@@ -36,8 +36,8 @@
@Backing(type="int") @VintfStability
enum FrontendDvbsScanType {
UNDEFINED = 0,
- DIRECT = 1,
- DISEQC = 2,
- UNICABLE = 3,
- JESS = 4,
+ DIRECT,
+ DISEQC,
+ UNICABLE,
+ JESS,
}
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendDvbsStandard.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendDvbsStandard.aidl
index b9cb657..bcb1c6d 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendDvbsStandard.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendDvbsStandard.aidl
@@ -36,8 +36,8 @@
@Backing(type="byte") @VintfStability
enum FrontendDvbsStandard {
UNDEFINED = 0,
- AUTO = 1,
- S = 2,
- S2 = 4,
- S2X = 8,
+ AUTO = (1 << 0) /* 1 */,
+ S = (1 << 1) /* 2 */,
+ S2 = (1 << 2) /* 4 */,
+ S2X = (1 << 3) /* 8 */,
}
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendDvbsVcmMode.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendDvbsVcmMode.aidl
index 2cbff7c..af87423 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendDvbsVcmMode.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendDvbsVcmMode.aidl
@@ -35,7 +35,7 @@
/* @hide */
@Backing(type="int") @VintfStability
enum FrontendDvbsVcmMode {
- UNDEFINED = 0,
- AUTO = 1,
- MANUAL = 2,
+ UNDEFINED,
+ AUTO,
+ MANUAL,
}
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendDvbtBandwidth.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendDvbtBandwidth.aidl
index f5d14e8..ff2d9e4 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendDvbtBandwidth.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendDvbtBandwidth.aidl
@@ -36,11 +36,11 @@
@Backing(type="int") @VintfStability
enum FrontendDvbtBandwidth {
UNDEFINED = 0,
- AUTO = 1,
- BANDWIDTH_8MHZ = 2,
- BANDWIDTH_7MHZ = 4,
- BANDWIDTH_6MHZ = 8,
- BANDWIDTH_5MHZ = 16,
- BANDWIDTH_1_7MHZ = 32,
- BANDWIDTH_10MHZ = 64,
+ AUTO = (1 << 0) /* 1 */,
+ BANDWIDTH_8MHZ = (1 << 1) /* 2 */,
+ BANDWIDTH_7MHZ = (1 << 2) /* 4 */,
+ BANDWIDTH_6MHZ = (1 << 3) /* 8 */,
+ BANDWIDTH_5MHZ = (1 << 4) /* 16 */,
+ BANDWIDTH_1_7MHZ = (1 << 5) /* 32 */,
+ BANDWIDTH_10MHZ = (1 << 6) /* 64 */,
}
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendDvbtCoderate.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendDvbtCoderate.aidl
index 8bd0489..8d2df06 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendDvbtCoderate.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendDvbtCoderate.aidl
@@ -36,14 +36,14 @@
@Backing(type="int") @VintfStability
enum FrontendDvbtCoderate {
UNDEFINED = 0,
- AUTO = 1,
- CODERATE_1_2 = 2,
- CODERATE_2_3 = 4,
- CODERATE_3_4 = 8,
- CODERATE_5_6 = 16,
- CODERATE_7_8 = 32,
- CODERATE_3_5 = 64,
- CODERATE_4_5 = 128,
- CODERATE_6_7 = 256,
- CODERATE_8_9 = 512,
+ AUTO = (1 << 0) /* 1 */,
+ CODERATE_1_2 = (1 << 1) /* 2 */,
+ CODERATE_2_3 = (1 << 2) /* 4 */,
+ CODERATE_3_4 = (1 << 3) /* 8 */,
+ CODERATE_5_6 = (1 << 4) /* 16 */,
+ CODERATE_7_8 = (1 << 5) /* 32 */,
+ CODERATE_3_5 = (1 << 6) /* 64 */,
+ CODERATE_4_5 = (1 << 7) /* 128 */,
+ CODERATE_6_7 = (1 << 8) /* 256 */,
+ CODERATE_8_9 = (1 << 9) /* 512 */,
}
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendDvbtConstellation.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendDvbtConstellation.aidl
index bc40901..4bd5691 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendDvbtConstellation.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendDvbtConstellation.aidl
@@ -36,13 +36,13 @@
@Backing(type="int") @VintfStability
enum FrontendDvbtConstellation {
UNDEFINED = 0,
- AUTO = 1,
- CONSTELLATION_QPSK = 2,
- CONSTELLATION_16QAM = 4,
- CONSTELLATION_64QAM = 8,
- CONSTELLATION_256QAM = 16,
- CONSTELLATION_QPSK_R = 32,
- CONSTELLATION_16QAM_R = 64,
- CONSTELLATION_64QAM_R = 128,
- CONSTELLATION_256QAM_R = 256,
+ AUTO = (1 << 0) /* 1 */,
+ CONSTELLATION_QPSK = (1 << 1) /* 2 */,
+ CONSTELLATION_16QAM = (1 << 2) /* 4 */,
+ CONSTELLATION_64QAM = (1 << 3) /* 8 */,
+ CONSTELLATION_256QAM = (1 << 4) /* 16 */,
+ CONSTELLATION_QPSK_R = (1 << 5) /* 32 */,
+ CONSTELLATION_16QAM_R = (1 << 6) /* 64 */,
+ CONSTELLATION_64QAM_R = (1 << 7) /* 128 */,
+ CONSTELLATION_256QAM_R = (1 << 8) /* 256 */,
}
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendDvbtGuardInterval.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendDvbtGuardInterval.aidl
index 073a77e..01c2b66 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendDvbtGuardInterval.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendDvbtGuardInterval.aidl
@@ -36,12 +36,12 @@
@Backing(type="int") @VintfStability
enum FrontendDvbtGuardInterval {
UNDEFINED = 0,
- AUTO = 1,
- INTERVAL_1_32 = 2,
- INTERVAL_1_16 = 4,
- INTERVAL_1_8 = 8,
- INTERVAL_1_4 = 16,
- INTERVAL_1_128 = 32,
- INTERVAL_19_128 = 64,
- INTERVAL_19_256 = 128,
+ AUTO = (1 << 0) /* 1 */,
+ INTERVAL_1_32 = (1 << 1) /* 2 */,
+ INTERVAL_1_16 = (1 << 2) /* 4 */,
+ INTERVAL_1_8 = (1 << 3) /* 8 */,
+ INTERVAL_1_4 = (1 << 4) /* 16 */,
+ INTERVAL_1_128 = (1 << 5) /* 32 */,
+ INTERVAL_19_128 = (1 << 6) /* 64 */,
+ INTERVAL_19_256 = (1 << 7) /* 128 */,
}
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendDvbtHierarchy.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendDvbtHierarchy.aidl
index 9ed5c8c..bd86479 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendDvbtHierarchy.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendDvbtHierarchy.aidl
@@ -36,13 +36,13 @@
@Backing(type="int") @VintfStability
enum FrontendDvbtHierarchy {
UNDEFINED = 0,
- AUTO = 1,
- HIERARCHY_NON_NATIVE = 2,
- HIERARCHY_1_NATIVE = 4,
- HIERARCHY_2_NATIVE = 8,
- HIERARCHY_4_NATIVE = 16,
- HIERARCHY_NON_INDEPTH = 32,
- HIERARCHY_1_INDEPTH = 64,
- HIERARCHY_2_INDEPTH = 128,
- HIERARCHY_4_INDEPTH = 256,
+ AUTO = (1 << 0) /* 1 */,
+ HIERARCHY_NON_NATIVE = (1 << 1) /* 2 */,
+ HIERARCHY_1_NATIVE = (1 << 2) /* 4 */,
+ HIERARCHY_2_NATIVE = (1 << 3) /* 8 */,
+ HIERARCHY_4_NATIVE = (1 << 4) /* 16 */,
+ HIERARCHY_NON_INDEPTH = (1 << 5) /* 32 */,
+ HIERARCHY_1_INDEPTH = (1 << 6) /* 64 */,
+ HIERARCHY_2_INDEPTH = (1 << 7) /* 128 */,
+ HIERARCHY_4_INDEPTH = (1 << 8) /* 256 */,
}
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendDvbtPlpMode.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendDvbtPlpMode.aidl
index c80bc2a..dc8e12c 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendDvbtPlpMode.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendDvbtPlpMode.aidl
@@ -35,7 +35,7 @@
/* @hide */
@Backing(type="int") @VintfStability
enum FrontendDvbtPlpMode {
- UNDEFINED = 0,
- AUTO = 1,
- MANUAL = 2,
+ UNDEFINED,
+ AUTO,
+ MANUAL,
}
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendDvbtStandard.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendDvbtStandard.aidl
index c7ba68a..080cc5c 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendDvbtStandard.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendDvbtStandard.aidl
@@ -36,7 +36,7 @@
@Backing(type="byte") @VintfStability
enum FrontendDvbtStandard {
UNDEFINED = 0,
- AUTO = 1,
- T = 2,
- T2 = 4,
+ AUTO = (1 << 0) /* 1 */,
+ T = (1 << 1) /* 2 */,
+ T2 = (1 << 2) /* 4 */,
}
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendDvbtTransmissionMode.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendDvbtTransmissionMode.aidl
index e3ca2e3..3731f86 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendDvbtTransmissionMode.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendDvbtTransmissionMode.aidl
@@ -36,14 +36,14 @@
@Backing(type="int") @VintfStability
enum FrontendDvbtTransmissionMode {
UNDEFINED = 0,
- AUTO = 1,
- MODE_2K = 2,
- MODE_8K = 4,
- MODE_4K = 8,
- MODE_1K = 16,
- MODE_16K = 32,
- MODE_32K = 64,
- MODE_8K_E = 128,
- MODE_16K_E = 256,
- MODE_32K_E = 512,
+ AUTO = (1 << 0) /* 1 */,
+ MODE_2K = (1 << 1) /* 2 */,
+ MODE_8K = (1 << 2) /* 4 */,
+ MODE_4K = (1 << 3) /* 8 */,
+ MODE_1K = (1 << 4) /* 16 */,
+ MODE_16K = (1 << 5) /* 32 */,
+ MODE_32K = (1 << 6) /* 64 */,
+ MODE_8K_E = (1 << 7) /* 128 */,
+ MODE_16K_E = (1 << 8) /* 256 */,
+ MODE_32K_E = (1 << 9) /* 512 */,
}
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendEventType.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendEventType.aidl
index 443313f..101e347 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendEventType.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendEventType.aidl
@@ -35,7 +35,7 @@
/* @hide */
@Backing(type="int") @VintfStability
enum FrontendEventType {
- LOCKED = 0,
- NO_SIGNAL = 1,
- LOST_LOCK = 2,
+ LOCKED,
+ NO_SIGNAL,
+ LOST_LOCK,
}
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendInnerFec.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendInnerFec.aidl
index 19599a3..da91888 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendInnerFec.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendInnerFec.aidl
@@ -36,57 +36,57 @@
@Backing(type="long") @VintfStability
enum FrontendInnerFec {
FEC_UNDEFINED = 0,
- AUTO = 1,
- FEC_1_2 = 2,
- FEC_1_3 = 4,
- FEC_1_4 = 8,
- FEC_1_5 = 16,
- FEC_2_3 = 32,
- FEC_2_5 = 64,
- FEC_2_9 = 128,
- FEC_3_4 = 256,
- FEC_3_5 = 512,
- FEC_4_5 = 1024,
- FEC_4_15 = 2048,
- FEC_5_6 = 4096,
- FEC_5_9 = 8192,
- FEC_6_7 = 16384,
- FEC_7_8 = 32768,
- FEC_7_9 = 65536,
- FEC_7_15 = 131072,
- FEC_8_9 = 262144,
- FEC_8_15 = 524288,
- FEC_9_10 = 1048576,
- FEC_9_20 = 2097152,
- FEC_11_15 = 4194304,
- FEC_11_20 = 8388608,
- FEC_11_45 = 16777216,
- FEC_13_18 = 33554432,
- FEC_13_45 = 67108864,
- FEC_14_45 = 134217728,
- FEC_23_36 = 268435456,
- FEC_25_36 = 536870912,
- FEC_26_45 = 1073741824,
- FEC_28_45 = 2147483648,
- FEC_29_45 = 4294967296,
- FEC_31_45 = 8589934592,
- FEC_32_45 = 17179869184,
- FEC_77_90 = 34359738368,
- FEC_2_15 = 68719476736,
- FEC_3_15 = 137438953472,
- FEC_5_15 = 274877906944,
- FEC_6_15 = 549755813888,
- FEC_9_15 = 1099511627776,
- FEC_10_15 = 2199023255552,
- FEC_12_15 = 4398046511104,
- FEC_13_15 = 8796093022208,
- FEC_18_30 = 17592186044416,
- FEC_20_30 = 35184372088832,
- FEC_90_180 = 70368744177664,
- FEC_96_180 = 140737488355328,
- FEC_104_180 = 281474976710656,
- FEC_128_180 = 562949953421312,
- FEC_132_180 = 1125899906842624,
- FEC_135_180 = 2251799813685248,
- FEC_140_180 = 4503599627370496,
+ AUTO = (1L << 0) /* 1 */,
+ FEC_1_2 = (1L << 1) /* 2 */,
+ FEC_1_3 = (1L << 2) /* 4 */,
+ FEC_1_4 = (1L << 3) /* 8 */,
+ FEC_1_5 = (1L << 4) /* 16 */,
+ FEC_2_3 = (1L << 5) /* 32 */,
+ FEC_2_5 = (1L << 6) /* 64 */,
+ FEC_2_9 = (1L << 7) /* 128 */,
+ FEC_3_4 = (1L << 8) /* 256 */,
+ FEC_3_5 = (1L << 9) /* 512 */,
+ FEC_4_5 = (1L << 10) /* 1024 */,
+ FEC_4_15 = (1L << 11) /* 2048 */,
+ FEC_5_6 = (1L << 12) /* 4096 */,
+ FEC_5_9 = (1L << 13) /* 8192 */,
+ FEC_6_7 = (1L << 14) /* 16384 */,
+ FEC_7_8 = (1L << 15) /* 32768 */,
+ FEC_7_9 = (1L << 16) /* 65536 */,
+ FEC_7_15 = (1L << 17) /* 131072 */,
+ FEC_8_9 = (1L << 18) /* 262144 */,
+ FEC_8_15 = (1L << 19) /* 524288 */,
+ FEC_9_10 = (1L << 20) /* 1048576 */,
+ FEC_9_20 = (1L << 21) /* 2097152 */,
+ FEC_11_15 = (1L << 22) /* 4194304 */,
+ FEC_11_20 = (1L << 23) /* 8388608 */,
+ FEC_11_45 = (1L << 24) /* 16777216 */,
+ FEC_13_18 = (1L << 25) /* 33554432 */,
+ FEC_13_45 = (1L << 26) /* 67108864 */,
+ FEC_14_45 = (1L << 27) /* 134217728 */,
+ FEC_23_36 = (1L << 28) /* 268435456 */,
+ FEC_25_36 = (1L << 29) /* 536870912 */,
+ FEC_26_45 = (1L << 30) /* 1073741824 */,
+ FEC_28_45 = (1L << 31) /* 2147483648 */,
+ FEC_29_45 = (1L << 32) /* 4294967296 */,
+ FEC_31_45 = (1L << 33) /* 8589934592 */,
+ FEC_32_45 = (1L << 34) /* 17179869184 */,
+ FEC_77_90 = (1L << 35) /* 34359738368 */,
+ FEC_2_15 = (1L << 36) /* 68719476736 */,
+ FEC_3_15 = (1L << 37) /* 137438953472 */,
+ FEC_5_15 = (1L << 38) /* 274877906944 */,
+ FEC_6_15 = (1L << 39) /* 549755813888 */,
+ FEC_9_15 = (1L << 40) /* 1099511627776 */,
+ FEC_10_15 = (1L << 41) /* 2199023255552 */,
+ FEC_12_15 = (1L << 42) /* 4398046511104 */,
+ FEC_13_15 = (1L << 43) /* 8796093022208 */,
+ FEC_18_30 = (1L << 44) /* 17592186044416 */,
+ FEC_20_30 = (1L << 45) /* 35184372088832 */,
+ FEC_90_180 = (1L << 46) /* 70368744177664 */,
+ FEC_96_180 = (1L << 47) /* 140737488355328 */,
+ FEC_104_180 = (1L << 48) /* 281474976710656 */,
+ FEC_128_180 = (1L << 49) /* 562949953421312 */,
+ FEC_132_180 = (1L << 50) /* 1125899906842624 */,
+ FEC_135_180 = (1L << 51) /* 2251799813685248 */,
+ FEC_140_180 = (1L << 52) /* 4503599627370496 */,
}
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendIptvSettingsFecType.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendIptvSettingsFecType.aidl
index 50a1208..5806cc5 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendIptvSettingsFecType.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendIptvSettingsFecType.aidl
@@ -36,7 +36,7 @@
@Backing(type="int") @VintfStability
enum FrontendIptvSettingsFecType {
UNDEFINED = 0,
- COLUMN = 1,
- ROW = 2,
- COLUMN_ROW = 4,
+ COLUMN = (1 << 0) /* 1 */,
+ ROW = (1 << 1) /* 2 */,
+ COLUMN_ROW = (1 << 2) /* 4 */,
}
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendIptvSettingsIgmp.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendIptvSettingsIgmp.aidl
index aa08496..43ae523 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendIptvSettingsIgmp.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendIptvSettingsIgmp.aidl
@@ -36,7 +36,7 @@
@Backing(type="int") @VintfStability
enum FrontendIptvSettingsIgmp {
UNDEFINED = 0,
- V1 = 1,
- V2 = 2,
- V3 = 4,
+ V1 = (1 << 0) /* 1 */,
+ V2 = (1 << 1) /* 2 */,
+ V3 = (1 << 2) /* 4 */,
}
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendIptvSettingsProtocol.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendIptvSettingsProtocol.aidl
index 08a01f1..2e4c478 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendIptvSettingsProtocol.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendIptvSettingsProtocol.aidl
@@ -36,6 +36,6 @@
@Backing(type="int") @VintfStability
enum FrontendIptvSettingsProtocol {
UNDEFINED = 0,
- UDP = 1,
- RTP = 2,
+ UDP = (1 << 0) /* 1 */,
+ RTP = (1 << 1) /* 2 */,
}
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendIsdbs3Coderate.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendIsdbs3Coderate.aidl
index 1ee7f07..de865ca 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendIsdbs3Coderate.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendIsdbs3Coderate.aidl
@@ -36,16 +36,16 @@
@Backing(type="int") @VintfStability
enum FrontendIsdbs3Coderate {
UNDEFINED = 0,
- AUTO = 1,
- CODERATE_1_3 = 2,
- CODERATE_2_5 = 4,
- CODERATE_1_2 = 8,
- CODERATE_3_5 = 16,
- CODERATE_2_3 = 32,
- CODERATE_3_4 = 64,
- CODERATE_7_9 = 128,
- CODERATE_4_5 = 256,
- CODERATE_5_6 = 512,
- CODERATE_7_8 = 1024,
- CODERATE_9_10 = 2048,
+ AUTO = (1 << 0) /* 1 */,
+ CODERATE_1_3 = (1 << 1) /* 2 */,
+ CODERATE_2_5 = (1 << 2) /* 4 */,
+ CODERATE_1_2 = (1 << 3) /* 8 */,
+ CODERATE_3_5 = (1 << 4) /* 16 */,
+ CODERATE_2_3 = (1 << 5) /* 32 */,
+ CODERATE_3_4 = (1 << 6) /* 64 */,
+ CODERATE_7_9 = (1 << 7) /* 128 */,
+ CODERATE_4_5 = (1 << 8) /* 256 */,
+ CODERATE_5_6 = (1 << 9) /* 512 */,
+ CODERATE_7_8 = (1 << 10) /* 1024 */,
+ CODERATE_9_10 = (1 << 11) /* 2048 */,
}
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendIsdbs3Modulation.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendIsdbs3Modulation.aidl
index 3603292..adc902d 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendIsdbs3Modulation.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendIsdbs3Modulation.aidl
@@ -36,10 +36,10 @@
@Backing(type="int") @VintfStability
enum FrontendIsdbs3Modulation {
UNDEFINED = 0,
- AUTO = 1,
- MOD_BPSK = 2,
- MOD_QPSK = 4,
- MOD_8PSK = 8,
- MOD_16APSK = 16,
- MOD_32APSK = 32,
+ AUTO = (1 << 0) /* 1 */,
+ MOD_BPSK = (1 << 1) /* 2 */,
+ MOD_QPSK = (1 << 2) /* 4 */,
+ MOD_8PSK = (1 << 3) /* 8 */,
+ MOD_16APSK = (1 << 4) /* 16 */,
+ MOD_32APSK = (1 << 5) /* 32 */,
}
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendIsdbs3Rolloff.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendIsdbs3Rolloff.aidl
index 733760c..c93cf20 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendIsdbs3Rolloff.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendIsdbs3Rolloff.aidl
@@ -35,6 +35,6 @@
/* @hide */
@Backing(type="int") @VintfStability
enum FrontendIsdbs3Rolloff {
- UNDEFINED = 0,
- ROLLOFF_0_03 = 1,
+ UNDEFINED,
+ ROLLOFF_0_03,
}
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendIsdbsCoderate.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendIsdbsCoderate.aidl
index 09e9c59..a0e436f 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendIsdbsCoderate.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendIsdbsCoderate.aidl
@@ -36,10 +36,10 @@
@Backing(type="int") @VintfStability
enum FrontendIsdbsCoderate {
UNDEFINED = 0,
- AUTO = 1,
- CODERATE_1_2 = 2,
- CODERATE_2_3 = 4,
- CODERATE_3_4 = 8,
- CODERATE_5_6 = 16,
- CODERATE_7_8 = 32,
+ AUTO = (1 << 0) /* 1 */,
+ CODERATE_1_2 = (1 << 1) /* 2 */,
+ CODERATE_2_3 = (1 << 2) /* 4 */,
+ CODERATE_3_4 = (1 << 3) /* 8 */,
+ CODERATE_5_6 = (1 << 4) /* 16 */,
+ CODERATE_7_8 = (1 << 5) /* 32 */,
}
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendIsdbsModulation.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendIsdbsModulation.aidl
index 7b9bde6..61a21c3 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendIsdbsModulation.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendIsdbsModulation.aidl
@@ -36,8 +36,8 @@
@Backing(type="int") @VintfStability
enum FrontendIsdbsModulation {
UNDEFINED = 0,
- AUTO = 1,
- MOD_BPSK = 2,
- MOD_QPSK = 4,
- MOD_TC8PSK = 8,
+ AUTO = (1 << 0) /* 1 */,
+ MOD_BPSK = (1 << 1) /* 2 */,
+ MOD_QPSK = (1 << 2) /* 4 */,
+ MOD_TC8PSK = (1 << 3) /* 8 */,
}
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendIsdbsRolloff.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendIsdbsRolloff.aidl
index a2ab154..b769231 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendIsdbsRolloff.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendIsdbsRolloff.aidl
@@ -35,6 +35,6 @@
/* @hide */
@Backing(type="int") @VintfStability
enum FrontendIsdbsRolloff {
- UNDEFINED = 0,
- ROLLOFF_0_35 = 1,
+ UNDEFINED,
+ ROLLOFF_0_35,
}
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendIsdbsStreamIdType.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendIsdbsStreamIdType.aidl
index 089f611..77956b6 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendIsdbsStreamIdType.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendIsdbsStreamIdType.aidl
@@ -35,7 +35,7 @@
/* @hide */
@Backing(type="int") @VintfStability
enum FrontendIsdbsStreamIdType {
- STREAM_ID = 0,
- RELATIVE_STREAM_NUMBER = 1,
- UNDEFINED = 2,
+ STREAM_ID,
+ RELATIVE_STREAM_NUMBER,
+ UNDEFINED,
}
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendIsdbtBandwidth.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendIsdbtBandwidth.aidl
index cd49214..209620f 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendIsdbtBandwidth.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendIsdbtBandwidth.aidl
@@ -36,8 +36,8 @@
@Backing(type="int") @VintfStability
enum FrontendIsdbtBandwidth {
UNDEFINED = 0,
- AUTO = 1,
- BANDWIDTH_8MHZ = 2,
- BANDWIDTH_7MHZ = 4,
- BANDWIDTH_6MHZ = 8,
+ AUTO = (1 << 0) /* 1 */,
+ BANDWIDTH_8MHZ = (1 << 1) /* 2 */,
+ BANDWIDTH_7MHZ = (1 << 2) /* 4 */,
+ BANDWIDTH_6MHZ = (1 << 3) /* 8 */,
}
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendIsdbtCoderate.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendIsdbtCoderate.aidl
index 2b747ed..4236b7c 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendIsdbtCoderate.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendIsdbtCoderate.aidl
@@ -36,14 +36,14 @@
@Backing(type="int") @VintfStability
enum FrontendIsdbtCoderate {
UNDEFINED = 0,
- AUTO = 1,
- CODERATE_1_2 = 2,
- CODERATE_2_3 = 4,
- CODERATE_3_4 = 8,
- CODERATE_5_6 = 16,
- CODERATE_7_8 = 32,
- CODERATE_3_5 = 64,
- CODERATE_4_5 = 128,
- CODERATE_6_7 = 256,
- CODERATE_8_9 = 512,
+ AUTO = (1 << 0) /* 1 */,
+ CODERATE_1_2 = (1 << 1) /* 2 */,
+ CODERATE_2_3 = (1 << 2) /* 4 */,
+ CODERATE_3_4 = (1 << 3) /* 8 */,
+ CODERATE_5_6 = (1 << 4) /* 16 */,
+ CODERATE_7_8 = (1 << 5) /* 32 */,
+ CODERATE_3_5 = (1 << 6) /* 64 */,
+ CODERATE_4_5 = (1 << 7) /* 128 */,
+ CODERATE_6_7 = (1 << 8) /* 256 */,
+ CODERATE_8_9 = (1 << 9) /* 512 */,
}
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendIsdbtGuardInterval.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendIsdbtGuardInterval.aidl
index 42a023a..86225e2 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendIsdbtGuardInterval.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendIsdbtGuardInterval.aidl
@@ -36,12 +36,12 @@
@Backing(type="int") @VintfStability
enum FrontendIsdbtGuardInterval {
UNDEFINED = 0,
- AUTO = 1,
- INTERVAL_1_32 = 2,
- INTERVAL_1_16 = 4,
- INTERVAL_1_8 = 8,
- INTERVAL_1_4 = 16,
- INTERVAL_1_128 = 32,
- INTERVAL_19_128 = 64,
- INTERVAL_19_256 = 128,
+ AUTO = (1 << 0) /* 1 */,
+ INTERVAL_1_32 = (1 << 1) /* 2 */,
+ INTERVAL_1_16 = (1 << 2) /* 4 */,
+ INTERVAL_1_8 = (1 << 3) /* 8 */,
+ INTERVAL_1_4 = (1 << 4) /* 16 */,
+ INTERVAL_1_128 = (1 << 5) /* 32 */,
+ INTERVAL_19_128 = (1 << 6) /* 64 */,
+ INTERVAL_19_256 = (1 << 7) /* 128 */,
}
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendIsdbtMode.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendIsdbtMode.aidl
index 54698ab..0e38c26 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendIsdbtMode.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendIsdbtMode.aidl
@@ -36,8 +36,8 @@
@Backing(type="int") @VintfStability
enum FrontendIsdbtMode {
UNDEFINED = 0,
- AUTO = 1,
- MODE_1 = 2,
- MODE_2 = 4,
- MODE_3 = 8,
+ AUTO = (1 << 0) /* 1 */,
+ MODE_1 = (1 << 1) /* 2 */,
+ MODE_2 = (1 << 2) /* 4 */,
+ MODE_3 = (1 << 3) /* 8 */,
}
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendIsdbtModulation.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendIsdbtModulation.aidl
index a31e0cf..4474c83 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendIsdbtModulation.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendIsdbtModulation.aidl
@@ -36,9 +36,9 @@
@Backing(type="int") @VintfStability
enum FrontendIsdbtModulation {
UNDEFINED = 0,
- AUTO = 1,
- MOD_DQPSK = 2,
- MOD_QPSK = 4,
- MOD_16QAM = 8,
- MOD_64QAM = 16,
+ AUTO = (1 << 0) /* 1 */,
+ MOD_DQPSK = (1 << 1) /* 2 */,
+ MOD_QPSK = (1 << 2) /* 4 */,
+ MOD_16QAM = (1 << 3) /* 8 */,
+ MOD_64QAM = (1 << 4) /* 16 */,
}
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendIsdbtPartialReceptionFlag.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendIsdbtPartialReceptionFlag.aidl
index 133887f..1387e66 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendIsdbtPartialReceptionFlag.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendIsdbtPartialReceptionFlag.aidl
@@ -36,7 +36,7 @@
@Backing(type="int") @VintfStability
enum FrontendIsdbtPartialReceptionFlag {
UNDEFINED = 0,
- AUTO = 1,
- FALSE = 2,
- TRUE = 4,
+ AUTO = (1 << 0) /* 1 */,
+ FALSE = (1 << 1) /* 2 */,
+ TRUE = (1 << 2) /* 4 */,
}
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendIsdbtTimeInterleaveMode.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendIsdbtTimeInterleaveMode.aidl
index 50adde9..b9d76ee 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendIsdbtTimeInterleaveMode.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendIsdbtTimeInterleaveMode.aidl
@@ -36,17 +36,17 @@
@Backing(type="int") @VintfStability
enum FrontendIsdbtTimeInterleaveMode {
UNDEFINED = 0,
- AUTO = 1,
- INTERLEAVE_1_0 = 2,
- INTERLEAVE_1_4 = 4,
- INTERLEAVE_1_8 = 8,
- INTERLEAVE_1_16 = 16,
- INTERLEAVE_2_0 = 32,
- INTERLEAVE_2_2 = 64,
- INTERLEAVE_2_4 = 128,
- INTERLEAVE_2_8 = 256,
- INTERLEAVE_3_0 = 512,
- INTERLEAVE_3_1 = 1024,
- INTERLEAVE_3_2 = 2048,
- INTERLEAVE_3_4 = 4096,
+ AUTO = (1 << 0) /* 1 */,
+ INTERLEAVE_1_0 = (1 << 1) /* 2 */,
+ INTERLEAVE_1_4 = (1 << 2) /* 4 */,
+ INTERLEAVE_1_8 = (1 << 3) /* 8 */,
+ INTERLEAVE_1_16 = (1 << 4) /* 16 */,
+ INTERLEAVE_2_0 = (1 << 5) /* 32 */,
+ INTERLEAVE_2_2 = (1 << 6) /* 64 */,
+ INTERLEAVE_2_4 = (1 << 7) /* 128 */,
+ INTERLEAVE_2_8 = (1 << 8) /* 256 */,
+ INTERLEAVE_3_0 = (1 << 9) /* 512 */,
+ INTERLEAVE_3_1 = (1 << 10) /* 1024 */,
+ INTERLEAVE_3_2 = (1 << 11) /* 2048 */,
+ INTERLEAVE_3_4 = (1 << 12) /* 4096 */,
}
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendScanMessageType.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendScanMessageType.aidl
index 6976ecd..186dbd7 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendScanMessageType.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendScanMessageType.aidl
@@ -35,20 +35,20 @@
/* @hide */
@Backing(type="int") @VintfStability
enum FrontendScanMessageType {
- LOCKED = 0,
- END = 1,
- PROGRESS_PERCENT = 2,
- FREQUENCY = 3,
- SYMBOL_RATE = 4,
- HIERARCHY = 5,
- ANALOG_TYPE = 6,
- PLP_IDS = 7,
- GROUP_IDS = 8,
- INPUT_STREAM_IDS = 9,
- STANDARD = 10,
- ATSC3_PLP_INFO = 11,
- MODULATION = 12,
- DVBC_ANNEX = 13,
- HIGH_PRIORITY = 14,
- DVBT_CELL_IDS = 15,
+ LOCKED,
+ END,
+ PROGRESS_PERCENT,
+ FREQUENCY,
+ SYMBOL_RATE,
+ HIERARCHY,
+ ANALOG_TYPE,
+ PLP_IDS,
+ GROUP_IDS,
+ INPUT_STREAM_IDS,
+ STANDARD,
+ ATSC3_PLP_INFO,
+ MODULATION,
+ DVBC_ANNEX,
+ HIGH_PRIORITY,
+ DVBT_CELL_IDS,
}
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendScanType.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendScanType.aidl
index ed42d0a..cef02cc 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendScanType.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendScanType.aidl
@@ -36,6 +36,6 @@
@Backing(type="int") @VintfStability
enum FrontendScanType {
SCAN_UNDEFINED = 0,
- SCAN_AUTO = 1,
- SCAN_BLIND = 2,
+ SCAN_AUTO = (1 << 0) /* 1 */,
+ SCAN_BLIND = (1 << 1) /* 2 */,
}
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendSpectralInversion.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendSpectralInversion.aidl
index ff11bb8..14ec2fd 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendSpectralInversion.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendSpectralInversion.aidl
@@ -35,7 +35,7 @@
/* @hide */
@Backing(type="int") @VintfStability
enum FrontendSpectralInversion {
- UNDEFINED = 0,
- NORMAL = 1,
- INVERTED = 2,
+ UNDEFINED,
+ NORMAL,
+ INVERTED,
}
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendStatusReadiness.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendStatusReadiness.aidl
index 41944ce..13735fa 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendStatusReadiness.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendStatusReadiness.aidl
@@ -35,9 +35,9 @@
/* @hide */
@Backing(type="int") @VintfStability
enum FrontendStatusReadiness {
- UNDEFINED = 0,
- UNAVAILABLE = 1,
- UNSTABLE = 2,
- STABLE = 3,
- UNSUPPORTED = 4,
+ UNDEFINED,
+ UNAVAILABLE,
+ UNSTABLE,
+ STABLE,
+ UNSUPPORTED,
}
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendStatusType.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendStatusType.aidl
index 3791299..9f34e8d 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendStatusType.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendStatusType.aidl
@@ -35,51 +35,51 @@
/* @hide */
@Backing(type="int") @VintfStability
enum FrontendStatusType {
- DEMOD_LOCK = 0,
- SNR = 1,
- BER = 2,
- PER = 3,
- PRE_BER = 4,
- SIGNAL_QUALITY = 5,
- SIGNAL_STRENGTH = 6,
- SYMBOL_RATE = 7,
- FEC = 8,
- MODULATION = 9,
- SPECTRAL = 10,
- LNB_VOLTAGE = 11,
- PLP_ID = 12,
- EWBS = 13,
- AGC = 14,
- LNA = 15,
- LAYER_ERROR = 16,
- MER = 17,
- FREQ_OFFSET = 18,
- HIERARCHY = 19,
- RF_LOCK = 20,
- ATSC3_PLP_INFO = 21,
- MODULATIONS = 22,
- BERS = 23,
- CODERATES = 24,
- BANDWIDTH = 25,
- GUARD_INTERVAL = 26,
- TRANSMISSION_MODE = 27,
- UEC = 28,
- T2_SYSTEM_ID = 29,
- INTERLEAVINGS = 30,
- ISDBT_SEGMENTS = 31,
- TS_DATA_RATES = 32,
- ROLL_OFF = 33,
- IS_MISO = 34,
- IS_LINEAR = 35,
- IS_SHORT_FRAMES = 36,
- ISDBT_MODE = 37,
- ISDBT_PARTIAL_RECEPTION_FLAG = 38,
- STREAM_ID_LIST = 39,
- DVBT_CELL_IDS = 40,
- ATSC3_ALL_PLP_INFO = 41,
- IPTV_CONTENT_URL = 42,
- IPTV_PACKETS_LOST = 43,
- IPTV_PACKETS_RECEIVED = 44,
- IPTV_WORST_JITTER_MS = 45,
- IPTV_AVERAGE_JITTER_MS = 46,
+ DEMOD_LOCK,
+ SNR,
+ BER,
+ PER,
+ PRE_BER,
+ SIGNAL_QUALITY,
+ SIGNAL_STRENGTH,
+ SYMBOL_RATE,
+ FEC,
+ MODULATION,
+ SPECTRAL,
+ LNB_VOLTAGE,
+ PLP_ID,
+ EWBS,
+ AGC,
+ LNA,
+ LAYER_ERROR,
+ MER,
+ FREQ_OFFSET,
+ HIERARCHY,
+ RF_LOCK,
+ ATSC3_PLP_INFO,
+ MODULATIONS,
+ BERS,
+ CODERATES,
+ BANDWIDTH,
+ GUARD_INTERVAL,
+ TRANSMISSION_MODE,
+ UEC,
+ T2_SYSTEM_ID,
+ INTERLEAVINGS,
+ ISDBT_SEGMENTS,
+ TS_DATA_RATES,
+ ROLL_OFF,
+ IS_MISO,
+ IS_LINEAR,
+ IS_SHORT_FRAMES,
+ ISDBT_MODE,
+ ISDBT_PARTIAL_RECEPTION_FLAG,
+ STREAM_ID_LIST,
+ DVBT_CELL_IDS,
+ ATSC3_ALL_PLP_INFO,
+ IPTV_CONTENT_URL,
+ IPTV_PACKETS_LOST,
+ IPTV_PACKETS_RECEIVED,
+ IPTV_WORST_JITTER_MS,
+ IPTV_AVERAGE_JITTER_MS,
}
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendType.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendType.aidl
index cbf5b47..455bbc0 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendType.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendType.aidl
@@ -36,15 +36,15 @@
@Backing(type="int") @VintfStability
enum FrontendType {
UNDEFINED = 0,
- ANALOG = 1,
- ATSC = 2,
- ATSC3 = 3,
- DVBC = 4,
- DVBS = 5,
- DVBT = 6,
- ISDBS = 7,
- ISDBS3 = 8,
- ISDBT = 9,
- DTMB = 10,
- IPTV = 11,
+ ANALOG,
+ ATSC,
+ ATSC3,
+ DVBC,
+ DVBS,
+ DVBT,
+ ISDBS,
+ ISDBS3,
+ ISDBT,
+ DTMB,
+ IPTV,
}
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/LnbEventType.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/LnbEventType.aidl
index e6e2b05..7bec809 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/LnbEventType.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/LnbEventType.aidl
@@ -35,8 +35,8 @@
/* @hide */
@Backing(type="int") @VintfStability
enum LnbEventType {
- DISEQC_RX_OVERFLOW = 0,
- DISEQC_RX_TIMEOUT = 1,
- DISEQC_RX_PARITY_ERROR = 2,
- LNB_OVERLOAD = 3,
+ DISEQC_RX_OVERFLOW,
+ DISEQC_RX_TIMEOUT,
+ DISEQC_RX_PARITY_ERROR,
+ LNB_OVERLOAD,
}
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/LnbPosition.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/LnbPosition.aidl
index 5fc4d15..a4a5740 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/LnbPosition.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/LnbPosition.aidl
@@ -35,7 +35,7 @@
/* @hide */
@Backing(type="int") @VintfStability
enum LnbPosition {
- UNDEFINED = 0,
- POSITION_A = 1,
- POSITION_B = 2,
+ UNDEFINED,
+ POSITION_A,
+ POSITION_B,
}
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/LnbTone.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/LnbTone.aidl
index 3217de9..0628354 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/LnbTone.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/LnbTone.aidl
@@ -35,6 +35,6 @@
/* @hide */
@Backing(type="int") @VintfStability
enum LnbTone {
- NONE = 0,
- CONTINUOUS = 1,
+ NONE,
+ CONTINUOUS,
}
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/LnbVoltage.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/LnbVoltage.aidl
index 034c7e6..b18ff0e 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/LnbVoltage.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/LnbVoltage.aidl
@@ -35,13 +35,13 @@
/* @hide */
@Backing(type="int") @VintfStability
enum LnbVoltage {
- NONE = 0,
- VOLTAGE_5V = 1,
- VOLTAGE_11V = 2,
- VOLTAGE_12V = 3,
- VOLTAGE_13V = 4,
- VOLTAGE_14V = 5,
- VOLTAGE_15V = 6,
- VOLTAGE_18V = 7,
- VOLTAGE_19V = 8,
+ NONE,
+ VOLTAGE_5V,
+ VOLTAGE_11V,
+ VOLTAGE_12V,
+ VOLTAGE_13V,
+ VOLTAGE_14V,
+ VOLTAGE_15V,
+ VOLTAGE_18V,
+ VOLTAGE_19V,
}
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/PlaybackStatus.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/PlaybackStatus.aidl
index 850b737..a8b6378 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/PlaybackStatus.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/PlaybackStatus.aidl
@@ -35,8 +35,8 @@
/* @hide */
@Backing(type="int") @VintfStability
enum PlaybackStatus {
- SPACE_EMPTY = 1,
- SPACE_ALMOST_EMPTY = 2,
- SPACE_ALMOST_FULL = 4,
- SPACE_FULL = 8,
+ SPACE_EMPTY = (1 << 0) /* 1 */,
+ SPACE_ALMOST_EMPTY = (1 << 1) /* 2 */,
+ SPACE_ALMOST_FULL = (1 << 2) /* 4 */,
+ SPACE_FULL = (1 << 3) /* 8 */,
}
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/RecordStatus.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/RecordStatus.aidl
index 48bf9ec..e06b616 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/RecordStatus.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/RecordStatus.aidl
@@ -35,8 +35,8 @@
/* @hide */
@Backing(type="byte") @VintfStability
enum RecordStatus {
- DATA_READY = 1,
- LOW_WATER = 2,
- HIGH_WATER = 4,
- OVERFLOW = 8,
+ DATA_READY = (1 << 0) /* 1 */,
+ LOW_WATER = (1 << 1) /* 2 */,
+ HIGH_WATER = (1 << 2) /* 4 */,
+ OVERFLOW = (1 << 3) /* 8 */,
}
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/Result.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/Result.aidl
index 4e22f67..ae43350 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/Result.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/Result.aidl
@@ -35,11 +35,11 @@
/* @hide */
@Backing(type="int") @VintfStability
enum Result {
- SUCCESS = 0,
- UNAVAILABLE = 1,
- NOT_INITIALIZED = 2,
- INVALID_STATE = 3,
- INVALID_ARGUMENT = 4,
- OUT_OF_MEMORY = 5,
- UNKNOWN_ERROR = 6,
+ SUCCESS,
+ UNAVAILABLE,
+ NOT_INITIALIZED,
+ INVALID_STATE,
+ INVALID_ARGUMENT,
+ OUT_OF_MEMORY,
+ UNKNOWN_ERROR,
}
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/ScramblingStatus.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/ScramblingStatus.aidl
index 656fe20..4d52de1 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/ScramblingStatus.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/ScramblingStatus.aidl
@@ -35,7 +35,7 @@
/* @hide */
@Backing(type="int") @VintfStability
enum ScramblingStatus {
- UNKNOWN = 1,
- NOT_SCRAMBLED = 2,
- SCRAMBLED = 4,
+ UNKNOWN = (1 << 0) /* 1 */,
+ NOT_SCRAMBLED = (1 << 1) /* 2 */,
+ SCRAMBLED = (1 << 2) /* 4 */,
}
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/VideoStreamType.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/VideoStreamType.aidl
index dbb6033..530f454 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/VideoStreamType.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/VideoStreamType.aidl
@@ -35,18 +35,18 @@
/* @hide */
@Backing(type="int") @VintfStability
enum VideoStreamType {
- UNDEFINED = 0,
- RESERVED = 1,
- MPEG1 = 2,
- MPEG2 = 3,
- MPEG4P2 = 4,
- AVC = 5,
- HEVC = 6,
- VC1 = 7,
- VP8 = 8,
- VP9 = 9,
- AV1 = 10,
- AVS = 11,
- AVS2 = 12,
- VVC = 13,
+ UNDEFINED,
+ RESERVED,
+ MPEG1,
+ MPEG2,
+ MPEG4P2,
+ AVC,
+ HEVC,
+ VC1,
+ VP8,
+ VP9,
+ AV1,
+ AVS,
+ AVS2,
+ VVC,
}
diff --git a/tv/tuner/aidl/android/hardware/tv/tuner/DemuxFilterMediaEvent.aidl b/tv/tuner/aidl/android/hardware/tv/tuner/DemuxFilterMediaEvent.aidl
index 32f0cb2..06f087b 100644
--- a/tv/tuner/aidl/android/hardware/tv/tuner/DemuxFilterMediaEvent.aidl
+++ b/tv/tuner/aidl/android/hardware/tv/tuner/DemuxFilterMediaEvent.aidl
@@ -17,7 +17,6 @@
package android.hardware.tv.tuner;
import android.hardware.common.NativeHandle;
-
import android.hardware.tv.tuner.DemuxFilterMediaEventExtraMetaData;
import android.hardware.tv.tuner.DemuxFilterScIndexMask;
@@ -91,4 +90,32 @@
* access unit framing at decode stage.
*/
DemuxFilterScIndexMask scIndexMask;
+
+ /**
+ * This attribute is used together with dataGroupId and indexInDataGroup to
+ * associate fragmented data.
+ *
+ * 1 if the media event contains the complete data. dataGroupId can be
+ * ignored.
+ * Greater than 1 if the media event contains incomplete data. Data can be
+ * reassembled by gathering all media events with the same dataGroupId.
+ */
+ int numDataPieces;
+
+ /**
+ * This attribute is used together with numDataPieces and dataGroupId to
+ * associate fragmented data.
+ *
+ * The value should be in the range of [0, numDataPieces - 1], indicating
+ * this piece is the Nth piece.
+ */
+ int indexInDataGroup;
+
+ /**
+ * This attribute is used together with numDataPieces and indexInDataGroup to
+ * associate fragmented data.
+ *
+ * The value is the id of the data group.
+ */
+ int dataGroupId;
}
diff --git a/tv/tuner/aidl/default/Filter.cpp b/tv/tuner/aidl/default/Filter.cpp
index 5f7a4cd..946ec3a 100644
--- a/tv/tuner/aidl/default/Filter.cpp
+++ b/tv/tuner/aidl/default/Filter.cpp
@@ -333,8 +333,8 @@
// All the filter event callbacks in start are for testing purpose.
switch (mType.mainType) {
case DemuxFilterMainType::TS:
- createMediaEvent(events, false);
- createMediaEvent(events, true);
+ createMediaEvent(events, false, 0);
+ createMediaEvent(events, true, 1);
createTsRecordEvent(events);
createTemiEvent(events);
break;
@@ -1235,7 +1235,8 @@
return (stat1.st_dev == stat2.st_dev) && (stat1.st_ino == stat2.st_ino);
}
-void Filter::createMediaEvent(vector<DemuxFilterEvent>& events, bool isAudioPresentation) {
+void Filter::createMediaEvent(vector<DemuxFilterEvent>& events, bool isAudioPresentation,
+ int indexInDataGroup) {
DemuxFilterMediaEvent mediaEvent;
mediaEvent.streamId = 1;
mediaEvent.isPtsPresent = true;
@@ -1302,6 +1303,10 @@
mediaEvent.avDataId = static_cast<int64_t>(dataId);
mediaEvent.avMemory = ::android::dupToAidl(nativeHandle);
+ mediaEvent.numDataPieces = 2;
+ mediaEvent.indexInDataGroup = indexInDataGroup;
+ mediaEvent.dataGroupId = 321;
+
events.push_back(DemuxFilterEvent::make<DemuxFilterEvent::Tag::media>(std::move(mediaEvent)));
native_handle_close(nativeHandle);
diff --git a/tv/tuner/aidl/default/Filter.h b/tv/tuner/aidl/default/Filter.h
index e2a0c7a..4be15e2 100644
--- a/tv/tuner/aidl/default/Filter.h
+++ b/tv/tuner/aidl/default/Filter.h
@@ -231,7 +231,8 @@
::ndk::ScopedAStatus createShareMemMediaEvents(vector<int8_t>& output);
bool sameFile(int fd1, int fd2);
- void createMediaEvent(vector<DemuxFilterEvent>&, bool isAudioPresentation);
+ void createMediaEvent(vector<DemuxFilterEvent>&, bool isAudioPresentation,
+ int indexInDataGroup);
void createTsRecordEvent(vector<DemuxFilterEvent>&);
void createMmtpRecordEvent(vector<DemuxFilterEvent>&);
void createSectionEvent(vector<DemuxFilterEvent>&);
diff --git a/tv/tuner/aidl/default/tuner-default.xml b/tv/tuner/aidl/default/tuner-default.xml
index bff8ff0..261fcbf 100644
--- a/tv/tuner/aidl/default/tuner-default.xml
+++ b/tv/tuner/aidl/default/tuner-default.xml
@@ -2,6 +2,6 @@
<hal format="aidl">
<name>android.hardware.tv.tuner</name>
<fqname>ITuner/default</fqname>
- <version>2</version>
+ <version>3</version>
</hal>
</manifest>
diff --git a/tv/tuner/aidl/vts/functional/FilterTests.cpp b/tv/tuner/aidl/vts/functional/FilterTests.cpp
index 533d0e6..788ebbd 100644
--- a/tv/tuner/aidl/vts/functional/FilterTests.cpp
+++ b/tv/tuner/aidl/vts/functional/FilterTests.cpp
@@ -105,17 +105,30 @@
// todo separate filter handlers
for (int i = 0; i < events.size(); i++) {
switch (events[i].getTag()) {
- case DemuxFilterEvent::Tag::media:
- ALOGD("[vts] Media filter event, avMemHandle numFds=%zu.",
- events[i].get<DemuxFilterEvent::Tag::media>().avMemory.fds.size());
+ case DemuxFilterEvent::Tag::media: {
+ int numDataPieces = events[i].get<DemuxFilterEvent::Tag::media>().numDataPieces;
+ int indexInDataGroup
+ = events[i].get<DemuxFilterEvent::Tag::media>().indexInDataGroup;
+ ALOGD("[vts] Media filter event, avMemHandle numFds=%zu, numDataPieces=%d,"
+ " indexInDataGroup=%d, dataGroupId=%d.",
+ events[i].get<DemuxFilterEvent::Tag::media>().avMemory.fds.size(),
+ numDataPieces,
+ indexInDataGroup,
+ events[i].get<DemuxFilterEvent::Tag::media>().dataGroupId);
+ if (numDataPieces > 1) {
+ EXPECT_TRUE(indexInDataGroup >= 0);
+ EXPECT_TRUE(indexInDataGroup < numDataPieces);
+ }
dumpAvData(events[i].get<DemuxFilterEvent::Tag::media>());
break;
- case DemuxFilterEvent::Tag::tsRecord:
+ }
+ case DemuxFilterEvent::Tag::tsRecord: {
ALOGD("[vts] TS record filter event, pts=%" PRIu64 ", firstMbInSlice=%d",
events[i].get<DemuxFilterEvent::Tag::tsRecord>().pts,
events[i].get<DemuxFilterEvent::Tag::tsRecord>().firstMbInSlice);
break;
- case DemuxFilterEvent::Tag::mmtpRecord:
+ }
+ case DemuxFilterEvent::Tag::mmtpRecord: {
ALOGD("[vts] MMTP record filter event, pts=%" PRIu64
", firstMbInSlice=%d, mpuSequenceNumber=%d, tsIndexMask=%d",
events[i].get<DemuxFilterEvent::Tag::mmtpRecord>().pts,
@@ -123,7 +136,8 @@
events[i].get<DemuxFilterEvent::Tag::mmtpRecord>().mpuSequenceNumber,
events[i].get<DemuxFilterEvent::Tag::mmtpRecord>().tsIndexMask);
break;
- case DemuxFilterEvent::Tag::monitorEvent:
+ }
+ case DemuxFilterEvent::Tag::monitorEvent: {
switch (events[i].get<DemuxFilterEvent::Tag::monitorEvent>().getTag()) {
case DemuxFilterMonitorEvent::Tag::scramblingStatus:
mScramblingStatusEvent++;
@@ -135,13 +149,16 @@
break;
}
break;
- case DemuxFilterEvent::Tag::startId:
+ }
+ case DemuxFilterEvent::Tag::startId: {
ALOGD("[vts] Restart filter event, startId=%d",
events[i].get<DemuxFilterEvent::Tag::startId>());
mStartIdReceived = true;
break;
- default:
+ }
+ default: {
break;
+ }
}
}
}
diff --git a/vibrator/aidl/aidl_api/android.hardware.vibrator/current/android/hardware/vibrator/IVibrationSession.aidl b/vibrator/aidl/aidl_api/android.hardware.vibrator/current/android/hardware/vibrator/IVibrationSession.aidl
new file mode 100644
index 0000000..ec301b2
--- /dev/null
+++ b/vibrator/aidl/aidl_api/android.hardware.vibrator/current/android/hardware/vibrator/IVibrationSession.aidl
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2024 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.vibrator;
+@VintfStability
+interface IVibrationSession {
+ void close();
+ void abort();
+}
diff --git a/vibrator/aidl/aidl_api/android.hardware.vibrator/current/android/hardware/vibrator/IVibratorManager.aidl b/vibrator/aidl/aidl_api/android.hardware.vibrator/current/android/hardware/vibrator/IVibratorManager.aidl
index ef5794c..081d9dc 100644
--- a/vibrator/aidl/aidl_api/android.hardware.vibrator/current/android/hardware/vibrator/IVibratorManager.aidl
+++ b/vibrator/aidl/aidl_api/android.hardware.vibrator/current/android/hardware/vibrator/IVibratorManager.aidl
@@ -40,6 +40,8 @@
void prepareSynced(in int[] vibratorIds);
void triggerSynced(in android.hardware.vibrator.IVibratorCallback callback);
void cancelSynced();
+ android.hardware.vibrator.IVibrationSession startSession(in int[] vibratorIds, in android.hardware.vibrator.VibrationSessionConfig config, in android.hardware.vibrator.IVibratorCallback callback);
+ void clearSessions();
const int CAP_SYNC = (1 << 0) /* 1 */;
const int CAP_PREPARE_ON = (1 << 1) /* 2 */;
const int CAP_PREPARE_PERFORM = (1 << 2) /* 4 */;
@@ -48,4 +50,5 @@
const int CAP_MIXED_TRIGGER_PERFORM = (1 << 5) /* 32 */;
const int CAP_MIXED_TRIGGER_COMPOSE = (1 << 6) /* 64 */;
const int CAP_TRIGGER_CALLBACK = (1 << 7) /* 128 */;
+ const int CAP_START_SESSIONS = (1 << 8) /* 256 */;
}
diff --git a/vibrator/aidl/aidl_api/android.hardware.vibrator/current/android/hardware/vibrator/VibrationSessionConfig.aidl b/vibrator/aidl/aidl_api/android.hardware.vibrator/current/android/hardware/vibrator/VibrationSessionConfig.aidl
new file mode 100644
index 0000000..01136aa
--- /dev/null
+++ b/vibrator/aidl/aidl_api/android.hardware.vibrator/current/android/hardware/vibrator/VibrationSessionConfig.aidl
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2024 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+// the interface (from the latest frozen version), the build system will
+// prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.vibrator;
+@VintfStability
+parcelable VibrationSessionConfig {
+ ParcelableHolder vendorExtension;
+}
diff --git a/vibrator/aidl/android/hardware/vibrator/IVibrationSession.aidl b/vibrator/aidl/android/hardware/vibrator/IVibrationSession.aidl
new file mode 100644
index 0000000..88382e5
--- /dev/null
+++ b/vibrator/aidl/android/hardware/vibrator/IVibrationSession.aidl
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2024 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.vibrator;
+
+@VintfStability
+interface IVibrationSession {
+ /**
+ * Request the end of this session.
+ *
+ * This will cause this session to end once the ongoing vibration commands are completed in each
+ * individual vibrator. The immediate end of this session can stll be trigged via abort().
+ *
+ * This should not block on the end of this session. The callback provided during the creation
+ * of this session should be used to indicate the vibrations are done and the session has
+ * ended. The session object can be safely destroyed after this is called, and the session
+ * should end as expected.
+ */
+ void close();
+
+ /**
+ * Immediately end this session.
+ *
+ * This will cause this session to end immediately and stop any ongoing vibration. The vibrator
+ * manager and each individual vibrator in this session will be reset and available when this
+ * returns.
+ */
+ void abort();
+}
diff --git a/vibrator/aidl/android/hardware/vibrator/IVibratorManager.aidl b/vibrator/aidl/android/hardware/vibrator/IVibratorManager.aidl
index eb5e9cc..e8b85c5 100644
--- a/vibrator/aidl/android/hardware/vibrator/IVibratorManager.aidl
+++ b/vibrator/aidl/android/hardware/vibrator/IVibratorManager.aidl
@@ -16,8 +16,10 @@
package android.hardware.vibrator;
+import android.hardware.vibrator.IVibrationSession;
import android.hardware.vibrator.IVibrator;
import android.hardware.vibrator.IVibratorCallback;
+import android.hardware.vibrator.VibrationSessionConfig;
@VintfStability
interface IVibratorManager {
@@ -42,17 +44,23 @@
*/
const int CAP_MIXED_TRIGGER_ON = 1 << 4;
/**
- * Whether IVibrator 'perform' can be triggered with other functions in sync with 'triggerSynced'.
+ * Whether IVibrator 'perform' can be triggered with other functions in sync with
+ * 'triggerSynced'.
*/
const int CAP_MIXED_TRIGGER_PERFORM = 1 << 5;
/**
- * Whether IVibrator 'compose' can be triggered with other functions in sync with 'triggerSynced'.
+ * Whether IVibrator 'compose' can be triggered with other functions in sync with
+ * 'triggerSynced'.
*/
const int CAP_MIXED_TRIGGER_COMPOSE = 1 << 6;
/**
* Whether on w/ IVibratorCallback can be used w/ 'trigerSynced' function.
*/
const int CAP_TRIGGER_CALLBACK = 1 << 7;
+ /**
+ * Whether vibration sessions are supported.
+ */
+ const int CAP_START_SESSIONS = 1 << 8;
/**
* Determine capabilities of the vibrator manager HAL (CAP_* mask)
@@ -75,8 +83,8 @@
* This function must only be called after the previous synced vibration was triggered or
* canceled (through cancelSynced()).
*
- * Doing this operation while any of the specified vibrators is already on is undefined behavior.
- * Clients should explicitly call off in each vibrator.
+ * Doing this operation while any of the specified vibrators is already on is undefined
+ * behavior. Clients should explicitly call off in each vibrator.
*
* @param vibratorIds ids of the vibrators to play vibrations in sync.
*/
@@ -99,4 +107,41 @@
* Cancel a previously-started preparation for synced vibration, if any.
*/
void cancelSynced();
+
+ /**
+ * Start a vibration session.
+ *
+ * A vibration session can be used to send commands without resetting the vibrator state. Once a
+ * session starts, the individual vibrators can receive one or more commands like on(),
+ * performEffect(), setAmplitude(), etc. The vibrations performed in a session must have the
+ * same behavior they have outside them. Multiple commands can be synced in a session via
+ * prepareSynced as usual.
+ *
+ * Starting a session on a vibrator already in another session or in a prepareSynced state is
+ * not allowed and should throw illegal state. The end of a session should always notify the
+ * callback provided, even if it ends prematurely due to an error.
+ *
+ * This may not be supported and this support is reflected in
+ * getCapabilities (CAP_START_SESSIONS). IVibratorCallback.onComplete() support is required for
+ * this API.
+ *
+ * @param vibratorIds ids of the vibrators in the session.
+ * @param config The parameters for starting a vibration session.
+ * @param callback A callback used to inform Frameworks of state change.
+ * @throws :
+ * - EX_UNSUPPORTED_OPERATION if unsupported, as reflected by getCapabilities.
+ * - EX_ILLEGAL_ARGUMENT for invalid vibrator IDs.
+ * - EX_ILLEGAL_STATE for vibrator IDs already in a session or in a prepareSynced state.
+ * - EX_SERVICE_SPECIFIC for bad vendor data.
+ */
+ IVibrationSession startSession(
+ in int[] vibratorIds, in VibrationSessionConfig config, in IVibratorCallback callback);
+
+ /**
+ * Abort and clear all ongoing vibration sessions.
+ *
+ * This can be used to reset the vibrator manager and some individual vibrators to an idle
+ * state.
+ */
+ void clearSessions();
}
diff --git a/vibrator/aidl/android/hardware/vibrator/VibrationSessionConfig.aidl b/vibrator/aidl/android/hardware/vibrator/VibrationSessionConfig.aidl
new file mode 100644
index 0000000..56cdde3
--- /dev/null
+++ b/vibrator/aidl/android/hardware/vibrator/VibrationSessionConfig.aidl
@@ -0,0 +1,25 @@
+/*
+ * Copyright (C) 2024 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.vibrator;
+
+@VintfStability
+parcelable VibrationSessionConfig {
+ /**
+ * Vendor extension point for starting a vibration session.
+ */
+ ParcelableHolder vendorExtension;
+}
diff --git a/vibrator/aidl/default/Android.bp b/vibrator/aidl/default/Android.bp
index 4b26640..0ac5bc0 100644
--- a/vibrator/aidl/default/Android.bp
+++ b/vibrator/aidl/default/Android.bp
@@ -19,6 +19,7 @@
],
export_include_dirs: ["include"],
srcs: [
+ "VibrationSession.cpp",
"Vibrator.cpp",
"VibratorManager.cpp",
],
diff --git a/vibrator/aidl/default/VibrationSession.cpp b/vibrator/aidl/default/VibrationSession.cpp
new file mode 100644
index 0000000..cfb6608
--- /dev/null
+++ b/vibrator/aidl/default/VibrationSession.cpp
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2024 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "vibrator-impl/VibrationSession.h"
+
+#include <android-base/logging.h>
+#include <thread>
+
+namespace aidl {
+namespace android {
+namespace hardware {
+namespace vibrator {
+
+static constexpr int32_t SESSION_END_DELAY_MS = 50;
+
+ndk::ScopedAStatus VibrationSession::close() {
+ LOG(VERBOSE) << "Vibration Session close";
+ mManager->closeSession(SESSION_END_DELAY_MS);
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus VibrationSession::abort() {
+ LOG(VERBOSE) << "Vibration Session abort";
+ mManager->abortSession();
+ return ndk::ScopedAStatus::ok();
+}
+
+} // namespace vibrator
+} // namespace hardware
+} // namespace android
+} // namespace aidl
diff --git a/vibrator/aidl/default/Vibrator.cpp b/vibrator/aidl/default/Vibrator.cpp
index 4f8c2b8..34be008 100644
--- a/vibrator/aidl/default/Vibrator.cpp
+++ b/vibrator/aidl/default/Vibrator.cpp
@@ -45,11 +45,62 @@
// Service specific error code used for vendor vibration effects.
static constexpr int32_t ERROR_CODE_INVALID_DURATION = 1;
+void Vibrator::dispatchVibrate(int32_t timeoutMs,
+ const std::shared_ptr<IVibratorCallback>& callback) {
+ std::lock_guard lock(mMutex);
+ if (mIsVibrating) {
+ // Already vibrating, ignore new request.
+ return;
+ }
+ mVibrationCallback = callback;
+ mIsVibrating = true;
+ // Note that thread lambdas aren't using implicit capture [=], to avoid capturing "this",
+ // which may be asynchronously destructed.
+ std::thread([timeoutMs, callback, sharedThis = this->ref<Vibrator>()] {
+ LOG(VERBOSE) << "Starting delayed callback on another thread";
+ usleep(timeoutMs * 1000);
+
+ if (sharedThis) {
+ std::lock_guard lock(sharedThis->mMutex);
+ sharedThis->mIsVibrating = false;
+ if (sharedThis->mVibrationCallback && (callback == sharedThis->mVibrationCallback)) {
+ LOG(VERBOSE) << "Notifying callback onComplete";
+ if (!sharedThis->mVibrationCallback->onComplete().isOk()) {
+ LOG(ERROR) << "Failed to call onComplete";
+ }
+ sharedThis->mVibrationCallback = nullptr;
+ }
+ if (sharedThis->mGlobalVibrationCallback) {
+ LOG(VERBOSE) << "Notifying global callback onComplete";
+ if (!sharedThis->mGlobalVibrationCallback->onComplete().isOk()) {
+ LOG(ERROR) << "Failed to call onComplete";
+ }
+ sharedThis->mGlobalVibrationCallback = nullptr;
+ }
+ }
+ }).detach();
+}
+
+void Vibrator::setGlobalVibrationCallback(const std::shared_ptr<IVibratorCallback>& callback) {
+ std::lock_guard lock(mMutex);
+ if (mIsVibrating) {
+ mGlobalVibrationCallback = callback;
+ } else if (callback) {
+ std::thread([callback] {
+ LOG(VERBOSE) << "Notifying global callback onComplete";
+ if (!callback->onComplete().isOk()) {
+ LOG(ERROR) << "Failed to call onComplete";
+ }
+ }).detach();
+ }
+}
+
ndk::ScopedAStatus Vibrator::getCapabilities(int32_t* _aidl_return) {
LOG(VERBOSE) << "Vibrator reporting capabilities";
std::lock_guard lock(mMutex);
if (mCapabilities == 0) {
- if (!getInterfaceVersion(&mVersion).isOk()) {
+ int32_t version;
+ if (!getInterfaceVersion(&version).isOk()) {
return ndk::ScopedAStatus(AStatus_fromExceptionCode(EX_ILLEGAL_STATE));
}
mCapabilities = IVibrator::CAP_ON_CALLBACK | IVibrator::CAP_PERFORM_CALLBACK |
@@ -59,9 +110,9 @@
IVibrator::CAP_GET_Q_FACTOR | IVibrator::CAP_FREQUENCY_CONTROL |
IVibrator::CAP_COMPOSE_PWLE_EFFECTS;
- if (mVersion >= 3) {
- mCapabilities |= (IVibrator::CAP_PERFORM_VENDOR_EFFECTS |
- IVibrator::CAP_COMPOSE_PWLE_EFFECTS_V2);
+ if (version >= 3) {
+ mCapabilities |=
+ IVibrator::CAP_PERFORM_VENDOR_EFFECTS | IVibrator::CAP_COMPOSE_PWLE_EFFECTS_V2;
}
}
@@ -71,25 +122,35 @@
ndk::ScopedAStatus Vibrator::off() {
LOG(VERBOSE) << "Vibrator off";
+ std::lock_guard lock(mMutex);
+ std::shared_ptr<IVibratorCallback> callback = mVibrationCallback;
+ std::shared_ptr<IVibratorCallback> globalCallback = mGlobalVibrationCallback;
+ mIsVibrating = false;
+ mVibrationCallback = nullptr;
+ mGlobalVibrationCallback = nullptr;
+ if (callback || globalCallback) {
+ std::thread([callback, globalCallback] {
+ if (callback) {
+ LOG(VERBOSE) << "Notifying callback onComplete";
+ if (!callback->onComplete().isOk()) {
+ LOG(ERROR) << "Failed to call onComplete";
+ }
+ }
+ if (globalCallback) {
+ LOG(VERBOSE) << "Notifying global callback onComplete";
+ if (!globalCallback->onComplete().isOk()) {
+ LOG(ERROR) << "Failed to call onComplete";
+ }
+ }
+ }).detach();
+ }
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus Vibrator::on(int32_t timeoutMs,
const std::shared_ptr<IVibratorCallback>& callback) {
LOG(VERBOSE) << "Vibrator on for timeoutMs: " << timeoutMs;
- if (callback != nullptr) {
- // Note that thread lambdas aren't using implicit capture [=], to avoid capturing "this",
- // which may be asynchronously destructed.
- // If "this" is needed, use [sharedThis = this->ref<Vibrator>()].
- std::thread([timeoutMs, callback] {
- LOG(VERBOSE) << "Starting on on another thread";
- usleep(timeoutMs * 1000);
- LOG(VERBOSE) << "Notifying on complete";
- if (!callback->onComplete().isOk()) {
- LOG(ERROR) << "Failed to call onComplete";
- }
- }).detach();
- }
+ dispatchVibrate(timeoutMs, callback);
return ndk::ScopedAStatus::ok();
}
@@ -107,16 +168,7 @@
}
constexpr size_t kEffectMillis = 100;
-
- if (callback != nullptr) {
- std::thread([callback] {
- LOG(VERBOSE) << "Starting perform on another thread";
- usleep(kEffectMillis * 1000);
- LOG(VERBOSE) << "Notifying perform complete";
- callback->onComplete();
- }).detach();
- }
-
+ dispatchVibrate(kEffectMillis, callback);
*_aidl_return = kEffectMillis;
return ndk::ScopedAStatus::ok();
}
@@ -150,15 +202,7 @@
return ndk::ScopedAStatus::fromServiceSpecificError(ERROR_CODE_INVALID_DURATION);
}
- if (callback != nullptr) {
- std::thread([callback, durationMs] {
- LOG(VERBOSE) << "Starting perform on another thread for durationMs:" << durationMs;
- usleep(durationMs * 1000);
- LOG(VERBOSE) << "Notifying perform vendor effect complete";
- callback->onComplete();
- }).detach();
- }
-
+ dispatchVibrate(durationMs, callback);
return ndk::ScopedAStatus::ok();
}
@@ -237,28 +281,14 @@
}
}
- // The thread may theoretically outlive the vibrator, so take a proper reference to it.
- std::thread([sharedThis = this->ref<Vibrator>(), composite, callback] {
- LOG(VERBOSE) << "Starting compose on another thread";
+ int32_t totalDuration = 0;
+ for (auto& e : composite) {
+ int32_t durationMs;
+ getPrimitiveDuration(e.primitive, &durationMs);
+ totalDuration += e.delayMs + durationMs;
+ }
- for (auto& e : composite) {
- if (e.delayMs) {
- usleep(e.delayMs * 1000);
- }
- LOG(VERBOSE) << "triggering primitive " << static_cast<int>(e.primitive) << " @ scale "
- << e.scale;
-
- int32_t durationMs;
- sharedThis->getPrimitiveDuration(e.primitive, &durationMs);
- usleep(durationMs * 1000);
- }
-
- if (callback != nullptr) {
- LOG(VERBOSE) << "Notifying perform complete";
- callback->onComplete();
- }
- }).detach();
-
+ dispatchVibrate(totalDuration, callback);
return ndk::ScopedAStatus::ok();
}
@@ -460,15 +490,7 @@
}
}
- std::thread([totalDuration, callback] {
- LOG(VERBOSE) << "Starting composePwle on another thread";
- usleep(totalDuration * 1000);
- if (callback != nullptr) {
- LOG(VERBOSE) << "Notifying compose PWLE complete";
- callback->onComplete();
- }
- }).detach();
-
+ dispatchVibrate(totalDuration, callback);
return ndk::ScopedAStatus::ok();
}
@@ -543,6 +565,7 @@
ndk::ScopedAStatus Vibrator::composePwleV2(const std::vector<PwleV2Primitive>& composite,
const std::shared_ptr<IVibratorCallback>& callback) {
+ LOG(VERBOSE) << "Vibrator compose PWLE V2";
int32_t capabilities = 0;
if (!getCapabilities(&capabilities).isOk()) {
return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_STATE);
@@ -576,15 +599,7 @@
totalEffectDuration += e.timeMillis;
}
- std::thread([totalEffectDuration, callback] {
- LOG(VERBOSE) << "Starting composePwleV2 on another thread";
- usleep(totalEffectDuration * 1000);
- if (callback != nullptr) {
- LOG(VERBOSE) << "Notifying compose PWLE V2 complete";
- callback->onComplete();
- }
- }).detach();
-
+ dispatchVibrate(totalEffectDuration, callback);
return ndk::ScopedAStatus::ok();
}
diff --git a/vibrator/aidl/default/VibratorManager.cpp b/vibrator/aidl/default/VibratorManager.cpp
index 26edf5a..c3be468 100644
--- a/vibrator/aidl/default/VibratorManager.cpp
+++ b/vibrator/aidl/default/VibratorManager.cpp
@@ -15,6 +15,9 @@
*/
#include "vibrator-impl/VibratorManager.h"
+#include "vibrator-impl/VibrationSession.h"
+
+#include <aidl/android/hardware/vibrator/BnVibratorCallback.h>
#include <android-base/logging.h>
#include <thread>
@@ -26,25 +29,52 @@
static constexpr int32_t kDefaultVibratorId = 1;
+class VibratorCallback : public BnVibratorCallback {
+ public:
+ VibratorCallback(const std::function<void()>& callback) : mCallback(callback) {}
+ ndk::ScopedAStatus onComplete() override {
+ mCallback();
+ return ndk::ScopedAStatus::ok();
+ }
+
+ private:
+ std::function<void()> mCallback;
+};
+
ndk::ScopedAStatus VibratorManager::getCapabilities(int32_t* _aidl_return) {
- LOG(INFO) << "Vibrator manager reporting capabilities";
- *_aidl_return =
- IVibratorManager::CAP_SYNC | IVibratorManager::CAP_PREPARE_ON |
- IVibratorManager::CAP_PREPARE_PERFORM | IVibratorManager::CAP_PREPARE_COMPOSE |
- IVibratorManager::CAP_MIXED_TRIGGER_ON | IVibratorManager::CAP_MIXED_TRIGGER_PERFORM |
- IVibratorManager::CAP_MIXED_TRIGGER_COMPOSE | IVibratorManager::CAP_TRIGGER_CALLBACK;
+ LOG(VERBOSE) << "Vibrator manager reporting capabilities";
+ std::lock_guard lock(mMutex);
+ if (mCapabilities == 0) {
+ int32_t version;
+ if (!getInterfaceVersion(&version).isOk()) {
+ return ndk::ScopedAStatus(AStatus_fromExceptionCode(EX_ILLEGAL_STATE));
+ }
+ mCapabilities = IVibratorManager::CAP_SYNC | IVibratorManager::CAP_PREPARE_ON |
+ IVibratorManager::CAP_PREPARE_PERFORM |
+ IVibratorManager::CAP_PREPARE_COMPOSE |
+ IVibratorManager::CAP_MIXED_TRIGGER_ON |
+ IVibratorManager::CAP_MIXED_TRIGGER_PERFORM |
+ IVibratorManager::CAP_MIXED_TRIGGER_COMPOSE |
+ IVibratorManager::CAP_TRIGGER_CALLBACK;
+
+ if (version >= 3) {
+ mCapabilities |= IVibratorManager::CAP_START_SESSIONS;
+ }
+ }
+
+ *_aidl_return = mCapabilities;
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus VibratorManager::getVibratorIds(std::vector<int32_t>* _aidl_return) {
- LOG(INFO) << "Vibrator manager getting vibrator ids";
+ LOG(VERBOSE) << "Vibrator manager getting vibrator ids";
*_aidl_return = {kDefaultVibratorId};
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus VibratorManager::getVibrator(int32_t vibratorId,
std::shared_ptr<IVibrator>* _aidl_return) {
- LOG(INFO) << "Vibrator manager getting vibrator " << vibratorId;
+ LOG(VERBOSE) << "Vibrator manager getting vibrator " << vibratorId;
if (vibratorId == kDefaultVibratorId) {
*_aidl_return = mDefaultVibrator;
return ndk::ScopedAStatus::ok();
@@ -55,32 +85,131 @@
}
ndk::ScopedAStatus VibratorManager::prepareSynced(const std::vector<int32_t>& vibratorIds) {
- LOG(INFO) << "Vibrator Manager prepare synced";
- if (vibratorIds.size() == 1 && vibratorIds[0] == kDefaultVibratorId) {
- return ndk::ScopedAStatus::ok();
- } else {
+ LOG(VERBOSE) << "Vibrator Manager prepare synced";
+ if (vibratorIds.size() != 1 || vibratorIds[0] != kDefaultVibratorId) {
return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT);
}
+ std::lock_guard lock(mMutex);
+ if (mIsPreparing) {
+ return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_STATE);
+ }
+ mIsPreparing = true;
+ return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus VibratorManager::triggerSynced(
const std::shared_ptr<IVibratorCallback>& callback) {
- LOG(INFO) << "Vibrator Manager trigger synced";
+ LOG(VERBOSE) << "Vibrator Manager trigger synced";
+ std::lock_guard lock(mMutex);
+ if (!mIsPreparing) {
+ return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_STATE);
+ }
std::thread([callback] {
if (callback != nullptr) {
- LOG(INFO) << "Notifying perform complete";
+ LOG(VERBOSE) << "Notifying perform complete";
callback->onComplete();
}
}).detach();
-
+ mIsPreparing = false;
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus VibratorManager::cancelSynced() {
- LOG(INFO) << "Vibrator Manager cancel synced";
+ LOG(VERBOSE) << "Vibrator Manager cancel synced";
+ std::lock_guard lock(mMutex);
+ mIsPreparing = false;
return ndk::ScopedAStatus::ok();
}
+ndk::ScopedAStatus VibratorManager::startSession(const std::vector<int32_t>& vibratorIds,
+ const VibrationSessionConfig&,
+ const std::shared_ptr<IVibratorCallback>& callback,
+ std::shared_ptr<IVibrationSession>* _aidl_return) {
+ LOG(VERBOSE) << "Vibrator Manager start session";
+ *_aidl_return = nullptr;
+ int32_t capabilities = 0;
+ if (!getCapabilities(&capabilities).isOk()) {
+ return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_STATE);
+ }
+ if ((capabilities & IVibratorManager::CAP_START_SESSIONS) == 0) {
+ return ndk::ScopedAStatus(AStatus_fromExceptionCode(EX_UNSUPPORTED_OPERATION));
+ }
+ if (vibratorIds.size() != 1 || vibratorIds[0] != kDefaultVibratorId) {
+ return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT);
+ }
+ std::lock_guard lock(mMutex);
+ if (mIsPreparing || mSession) {
+ return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_STATE);
+ }
+ mSessionCallback = callback;
+ mSession = ndk::SharedRefBase::make<VibrationSession>(this->ref<VibratorManager>());
+ *_aidl_return = static_cast<std::shared_ptr<IVibrationSession>>(mSession);
+ return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus VibratorManager::clearSessions() {
+ LOG(VERBOSE) << "Vibrator Manager clear sessions";
+ abortSession();
+ return ndk::ScopedAStatus::ok();
+}
+
+void VibratorManager::abortSession() {
+ std::shared_ptr<IVibrationSession> session;
+ {
+ std::lock_guard lock(mMutex);
+ session = mSession;
+ }
+ if (session) {
+ mDefaultVibrator->off();
+ clearSession(session);
+ }
+}
+
+void VibratorManager::closeSession(int32_t delayMs) {
+ std::shared_ptr<IVibrationSession> session;
+ {
+ std::lock_guard lock(mMutex);
+ if (mIsClosingSession) {
+ // Already closing session, ignore this.
+ return;
+ }
+ session = mSession;
+ mIsClosingSession = true;
+ }
+ if (session) {
+ auto callback = ndk::SharedRefBase::make<VibratorCallback>(
+ [session, delayMs, sharedThis = this->ref<VibratorManager>()] {
+ LOG(VERBOSE) << "Closing session after vibrator became idle";
+ usleep(delayMs * 1000);
+
+ if (sharedThis) {
+ sharedThis->clearSession(session);
+ }
+ });
+ mDefaultVibrator->setGlobalVibrationCallback(callback);
+ }
+}
+
+void VibratorManager::clearSession(const std::shared_ptr<IVibrationSession>& session) {
+ std::lock_guard lock(mMutex);
+ if (mSession != session) {
+ // Probably a delayed call from an old session that was already cleared, ignore it.
+ return;
+ }
+ std::shared_ptr<IVibratorCallback> callback = mSessionCallback;
+ mSession = nullptr;
+ mSessionCallback = nullptr; // make sure any delayed call will not trigger this again.
+ mIsClosingSession = false;
+ if (callback) {
+ std::thread([callback] {
+ LOG(VERBOSE) << "Notifying session complete";
+ if (!callback->onComplete().isOk()) {
+ LOG(ERROR) << "Failed to call onComplete";
+ }
+ }).detach();
+ }
+}
+
} // namespace vibrator
} // namespace hardware
} // namespace android
diff --git a/vibrator/aidl/default/include/vibrator-impl/VibrationSession.h b/vibrator/aidl/default/include/vibrator-impl/VibrationSession.h
new file mode 100644
index 0000000..98bdd1c
--- /dev/null
+++ b/vibrator/aidl/default/include/vibrator-impl/VibrationSession.h
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2024 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#include <aidl/android/hardware/vibrator/BnVibrationSession.h>
+#include <aidl/android/hardware/vibrator/IVibrator.h>
+#include <aidl/android/hardware/vibrator/IVibratorCallback.h>
+#include <android-base/thread_annotations.h>
+
+#include "vibrator-impl/VibratorManager.h"
+
+namespace aidl {
+namespace android {
+namespace hardware {
+namespace vibrator {
+
+class VibrationSession : public BnVibrationSession {
+ public:
+ VibrationSession(std::shared_ptr<VibratorManager> manager) : mManager(std::move(manager)) {};
+
+ ndk::ScopedAStatus close() override;
+ ndk::ScopedAStatus abort() override;
+
+ private:
+ mutable std::mutex mMutex;
+ std::shared_ptr<VibratorManager> mManager;
+};
+
+} // namespace vibrator
+} // namespace hardware
+} // namespace android
+} // namespace aidl
diff --git a/vibrator/aidl/default/include/vibrator-impl/Vibrator.h b/vibrator/aidl/default/include/vibrator-impl/Vibrator.h
index 28bc763..4637c5a 100644
--- a/vibrator/aidl/default/include/vibrator-impl/Vibrator.h
+++ b/vibrator/aidl/default/include/vibrator-impl/Vibrator.h
@@ -25,6 +25,7 @@
namespace vibrator {
class Vibrator : public BnVibrator {
+ public:
ndk::ScopedAStatus getCapabilities(int32_t* _aidl_return) override;
ndk::ScopedAStatus off() override;
ndk::ScopedAStatus on(int32_t timeoutMs,
@@ -66,10 +67,16 @@
ndk::ScopedAStatus composePwleV2(const std::vector<PwleV2Primitive>& composite,
const std::shared_ptr<IVibratorCallback>& callback) override;
+ void setGlobalVibrationCallback(const std::shared_ptr<IVibratorCallback>& callback);
+
private:
mutable std::mutex mMutex;
- int32_t mVersion GUARDED_BY(mMutex) = 0; // current Hal version
+ bool mIsVibrating GUARDED_BY(mMutex) = false;
int32_t mCapabilities GUARDED_BY(mMutex) = 0;
+ std::shared_ptr<IVibratorCallback> mVibrationCallback GUARDED_BY(mMutex) = nullptr;
+ std::shared_ptr<IVibratorCallback> mGlobalVibrationCallback GUARDED_BY(mMutex) = nullptr;
+
+ void dispatchVibrate(int32_t timeoutMs, const std::shared_ptr<IVibratorCallback>& callback);
};
} // namespace vibrator
diff --git a/vibrator/aidl/default/include/vibrator-impl/VibratorManager.h b/vibrator/aidl/default/include/vibrator-impl/VibratorManager.h
index 319eb05..fe30394 100644
--- a/vibrator/aidl/default/include/vibrator-impl/VibratorManager.h
+++ b/vibrator/aidl/default/include/vibrator-impl/VibratorManager.h
@@ -17,6 +17,9 @@
#pragma once
#include <aidl/android/hardware/vibrator/BnVibratorManager.h>
+#include <android-base/thread_annotations.h>
+
+#include "vibrator-impl/Vibrator.h"
namespace aidl {
namespace android {
@@ -25,7 +28,8 @@
class VibratorManager : public BnVibratorManager {
public:
- VibratorManager(std::shared_ptr<IVibrator> vibrator) : mDefaultVibrator(std::move(vibrator)){};
+ VibratorManager(std::shared_ptr<Vibrator> vibrator) : mDefaultVibrator(std::move(vibrator)) {};
+
ndk::ScopedAStatus getCapabilities(int32_t* _aidl_return) override;
ndk::ScopedAStatus getVibratorIds(std::vector<int32_t>* _aidl_return) override;
ndk::ScopedAStatus getVibrator(int32_t vibratorId,
@@ -33,9 +37,25 @@
ndk::ScopedAStatus prepareSynced(const std::vector<int32_t>& vibratorIds) override;
ndk::ScopedAStatus triggerSynced(const std::shared_ptr<IVibratorCallback>& callback) override;
ndk::ScopedAStatus cancelSynced() override;
+ ndk::ScopedAStatus startSession(const std::vector<int32_t>& vibratorIds,
+ const VibrationSessionConfig& config,
+ const std::shared_ptr<IVibratorCallback>& callback,
+ std::shared_ptr<IVibrationSession>* _aidl_return) override;
+ ndk::ScopedAStatus clearSessions() override;
+
+ void abortSession();
+ void closeSession(int32_t delayMs);
private:
- std::shared_ptr<IVibrator> mDefaultVibrator;
+ std::shared_ptr<Vibrator> mDefaultVibrator;
+ mutable std::mutex mMutex;
+ int32_t mCapabilities GUARDED_BY(mMutex) = 0;
+ bool mIsPreparing GUARDED_BY(mMutex) = false;
+ bool mIsClosingSession GUARDED_BY(mMutex) = false;
+ std::shared_ptr<IVibrationSession> mSession GUARDED_BY(mMutex) = nullptr;
+ std::shared_ptr<IVibratorCallback> mSessionCallback GUARDED_BY(mMutex) = nullptr;
+
+ void clearSession(const std::shared_ptr<IVibrationSession>& session);
};
} // namespace vibrator
diff --git a/vibrator/aidl/vts/VtsHalVibratorManagerTargetTest.cpp b/vibrator/aidl/vts/VtsHalVibratorManagerTargetTest.cpp
index 3c2a360..101d4f5 100644
--- a/vibrator/aidl/vts/VtsHalVibratorManagerTargetTest.cpp
+++ b/vibrator/aidl/vts/VtsHalVibratorManagerTargetTest.cpp
@@ -16,12 +16,14 @@
#include <aidl/Gtest.h>
#include <aidl/Vintf.h>
#include <aidl/android/hardware/vibrator/BnVibratorCallback.h>
+#include <aidl/android/hardware/vibrator/IVibrationSession.h>
#include <aidl/android/hardware/vibrator/IVibrator.h>
#include <aidl/android/hardware/vibrator/IVibratorManager.h>
#include <android/binder_manager.h>
#include <android/binder_process.h>
+#include <algorithm>
#include <cmath>
#include <future>
@@ -32,10 +34,14 @@
using aidl::android::hardware::vibrator::CompositePrimitive;
using aidl::android::hardware::vibrator::Effect;
using aidl::android::hardware::vibrator::EffectStrength;
+using aidl::android::hardware::vibrator::IVibrationSession;
using aidl::android::hardware::vibrator::IVibrator;
using aidl::android::hardware::vibrator::IVibratorManager;
+using aidl::android::hardware::vibrator::VibrationSessionConfig;
using std::chrono::high_resolution_clock;
+using namespace ::std::chrono_literals;
+
const std::vector<Effect> kEffects{ndk::enum_range<Effect>().begin(),
ndk::enum_range<Effect>().end()};
const std::vector<EffectStrength> kEffectStrengths{ndk::enum_range<EffectStrength>().begin(),
@@ -43,6 +49,11 @@
const std::vector<CompositePrimitive> kPrimitives{ndk::enum_range<CompositePrimitive>().begin(),
ndk::enum_range<CompositePrimitive>().end()};
+// Timeout to wait for vibration callback completion.
+static constexpr std::chrono::milliseconds VIBRATION_CALLBACK_TIMEOUT = 100ms;
+
+static constexpr int32_t VIBRATION_SESSIONS_MIN_VERSION = 3;
+
class CompletionCallback : public BnVibratorCallback {
public:
CompletionCallback(const std::function<void()>& callback) : mCallback(callback) {}
@@ -64,9 +75,29 @@
ASSERT_NE(manager, nullptr);
EXPECT_OK(manager->getCapabilities(&capabilities));
EXPECT_OK(manager->getVibratorIds(&vibratorIds));
+ EXPECT_OK(manager->getInterfaceVersion(&version));
+ }
+
+ virtual void TearDown() override {
+ // Reset manager state between tests.
+ if (capabilities & IVibratorManager::CAP_SYNC) {
+ manager->cancelSynced();
+ }
+ if (capabilities & IVibratorManager::CAP_START_SESSIONS) {
+ manager->clearSessions();
+ }
+ // Reset all managed vibrators.
+ for (int32_t id : vibratorIds) {
+ std::shared_ptr<IVibrator> vibrator;
+ EXPECT_OK(manager->getVibrator(id, &vibrator));
+ ASSERT_NE(vibrator, nullptr);
+ EXPECT_OK(vibrator->off());
+ }
}
std::shared_ptr<IVibratorManager> manager;
+ std::shared_ptr<IVibrationSession> session;
+ int32_t version;
int32_t capabilities;
std::vector<int32_t> vibratorIds;
};
@@ -109,7 +140,7 @@
if (vibratorIds.empty()) return;
if (!(capabilities & IVibratorManager::CAP_SYNC)) return;
if (!(capabilities & IVibratorManager::CAP_PREPARE_ON)) {
- uint32_t durationMs = 250;
+ int32_t durationMs = 250;
EXPECT_OK(manager->prepareSynced(vibratorIds));
std::shared_ptr<IVibrator> vibrator;
for (int32_t id : vibratorIds) {
@@ -170,7 +201,7 @@
std::future<void> completionFuture{completionPromise.get_future()};
auto callback = ndk::SharedRefBase::make<CompletionCallback>(
[&completionPromise] { completionPromise.set_value(); });
- uint32_t durationMs = 250;
+ int32_t durationMs = 250;
std::chrono::milliseconds timeout{durationMs * 2};
EXPECT_OK(manager->prepareSynced(vibratorIds));
@@ -202,6 +233,435 @@
}
}
+TEST_P(VibratorAidl, VibrationSessionsSupported) {
+ if (!(capabilities & IVibratorManager::CAP_START_SESSIONS)) return;
+ if (vibratorIds.empty()) return;
+
+ std::promise<void> sessionPromise;
+ std::future<void> sessionFuture{sessionPromise.get_future()};
+ auto sessionCallback = ndk::SharedRefBase::make<CompletionCallback>(
+ [&sessionPromise] { sessionPromise.set_value(); });
+
+ VibrationSessionConfig sessionConfig;
+ EXPECT_OK(manager->startSession(vibratorIds, sessionConfig, sessionCallback, &session));
+ ASSERT_NE(session, nullptr);
+
+ int32_t durationMs = 250;
+ std::vector<std::promise<void>> vibrationPromises;
+ std::vector<std::future<void>> vibrationFutures;
+ for (int32_t id : vibratorIds) {
+ std::shared_ptr<IVibrator> vibrator;
+ EXPECT_OK(manager->getVibrator(id, &vibrator));
+ ASSERT_NE(vibrator, nullptr);
+
+ std::promise<void>& vibrationPromise = vibrationPromises.emplace_back();
+ vibrationFutures.push_back(vibrationPromise.get_future());
+ auto vibrationCallback = ndk::SharedRefBase::make<CompletionCallback>(
+ [&vibrationPromise] { vibrationPromise.set_value(); });
+ EXPECT_OK(vibrator->on(durationMs, vibrationCallback));
+ }
+
+ auto timeout = std::chrono::milliseconds(durationMs) + VIBRATION_CALLBACK_TIMEOUT;
+ for (std::future<void>& future : vibrationFutures) {
+ EXPECT_EQ(future.wait_for(timeout), std::future_status::ready);
+ }
+
+ // Session callback not triggered.
+ EXPECT_EQ(sessionFuture.wait_for(VIBRATION_CALLBACK_TIMEOUT), std::future_status::timeout);
+
+ // Ending a session should not take long since the vibration was already completed
+ EXPECT_OK(session->close());
+ EXPECT_EQ(sessionFuture.wait_for(VIBRATION_CALLBACK_TIMEOUT), std::future_status::ready);
+}
+
+TEST_P(VibratorAidl, VibrationSessionInterrupted) {
+ if (!(capabilities & IVibratorManager::CAP_START_SESSIONS)) return;
+ if (vibratorIds.empty()) return;
+
+ std::promise<void> sessionPromise;
+ std::future<void> sessionFuture{sessionPromise.get_future()};
+ auto sessionCallback = ndk::SharedRefBase::make<CompletionCallback>(
+ [&sessionPromise] { sessionPromise.set_value(); });
+
+ VibrationSessionConfig sessionConfig;
+ EXPECT_OK(manager->startSession(vibratorIds, sessionConfig, sessionCallback, &session));
+ ASSERT_NE(session, nullptr);
+
+ std::vector<std::promise<void>> vibrationPromises;
+ std::vector<std::future<void>> vibrationFutures;
+ for (int32_t id : vibratorIds) {
+ std::shared_ptr<IVibrator> vibrator;
+ EXPECT_OK(manager->getVibrator(id, &vibrator));
+ ASSERT_NE(vibrator, nullptr);
+
+ std::promise<void>& vibrationPromise = vibrationPromises.emplace_back();
+ vibrationFutures.push_back(vibrationPromise.get_future());
+ auto vibrationCallback = ndk::SharedRefBase::make<CompletionCallback>(
+ [&vibrationPromise] { vibrationPromise.set_value(); });
+
+ // Vibration longer than test timeout.
+ EXPECT_OK(vibrator->on(2000, vibrationCallback));
+ }
+
+ // Session callback not triggered.
+ EXPECT_EQ(sessionFuture.wait_for(VIBRATION_CALLBACK_TIMEOUT), std::future_status::timeout);
+
+ // Interrupt vibrations and session.
+ EXPECT_OK(session->abort());
+
+ // Both callbacks triggered.
+ EXPECT_EQ(sessionFuture.wait_for(VIBRATION_CALLBACK_TIMEOUT), std::future_status::ready);
+ for (std::future<void>& future : vibrationFutures) {
+ EXPECT_EQ(future.wait_for(VIBRATION_CALLBACK_TIMEOUT), std::future_status::ready);
+ }
+}
+
+TEST_P(VibratorAidl, VibrationSessionEndingInterrupted) {
+ if (!(capabilities & IVibratorManager::CAP_START_SESSIONS)) return;
+ if (vibratorIds.empty()) return;
+
+ std::promise<void> sessionPromise;
+ std::future<void> sessionFuture{sessionPromise.get_future()};
+ auto sessionCallback = ndk::SharedRefBase::make<CompletionCallback>(
+ [&sessionPromise] { sessionPromise.set_value(); });
+
+ VibrationSessionConfig sessionConfig;
+ EXPECT_OK(manager->startSession(vibratorIds, sessionConfig, sessionCallback, &session));
+ ASSERT_NE(session, nullptr);
+
+ std::vector<std::promise<void>> vibrationPromises;
+ std::vector<std::future<void>> vibrationFutures;
+ for (int32_t id : vibratorIds) {
+ std::shared_ptr<IVibrator> vibrator;
+ EXPECT_OK(manager->getVibrator(id, &vibrator));
+ ASSERT_NE(vibrator, nullptr);
+
+ std::promise<void>& vibrationPromise = vibrationPromises.emplace_back();
+ vibrationFutures.push_back(vibrationPromise.get_future());
+ auto vibrationCallback = ndk::SharedRefBase::make<CompletionCallback>(
+ [&vibrationPromise] { vibrationPromise.set_value(); });
+
+ // Vibration longer than test timeout.
+ EXPECT_OK(vibrator->on(2000, vibrationCallback));
+ }
+
+ // Session callback not triggered.
+ EXPECT_EQ(sessionFuture.wait_for(VIBRATION_CALLBACK_TIMEOUT), std::future_status::timeout);
+
+ // End session, this might take a while
+ EXPECT_OK(session->close());
+
+ // Interrupt ending session.
+ EXPECT_OK(session->abort());
+
+ // Both callbacks triggered.
+ EXPECT_EQ(sessionFuture.wait_for(VIBRATION_CALLBACK_TIMEOUT), std::future_status::ready);
+ for (std::future<void>& future : vibrationFutures) {
+ EXPECT_EQ(future.wait_for(VIBRATION_CALLBACK_TIMEOUT), std::future_status::ready);
+ }
+}
+
+TEST_P(VibratorAidl, VibrationSessionCleared) {
+ if (!(capabilities & IVibratorManager::CAP_START_SESSIONS)) return;
+ if (vibratorIds.empty()) return;
+
+ std::promise<void> sessionPromise;
+ std::future<void> sessionFuture{sessionPromise.get_future()};
+ auto sessionCallback = ndk::SharedRefBase::make<CompletionCallback>(
+ [&sessionPromise] { sessionPromise.set_value(); });
+
+ VibrationSessionConfig sessionConfig;
+ EXPECT_OK(manager->startSession(vibratorIds, sessionConfig, sessionCallback, &session));
+ ASSERT_NE(session, nullptr);
+
+ int32_t durationMs = 250;
+ std::vector<std::promise<void>> vibrationPromises;
+ std::vector<std::future<void>> vibrationFutures;
+ for (int32_t id : vibratorIds) {
+ std::shared_ptr<IVibrator> vibrator;
+ EXPECT_OK(manager->getVibrator(id, &vibrator));
+ ASSERT_NE(vibrator, nullptr);
+
+ std::promise<void>& vibrationPromise = vibrationPromises.emplace_back();
+ vibrationFutures.push_back(vibrationPromise.get_future());
+ auto vibrationCallback = ndk::SharedRefBase::make<CompletionCallback>(
+ [&vibrationPromise] { vibrationPromise.set_value(); });
+ EXPECT_OK(vibrator->on(durationMs, vibrationCallback));
+ }
+
+ // Session callback not triggered.
+ EXPECT_EQ(sessionFuture.wait_for(VIBRATION_CALLBACK_TIMEOUT), std::future_status::timeout);
+
+ // Clearing sessions should abort ongoing session
+ EXPECT_OK(manager->clearSessions());
+
+ EXPECT_EQ(sessionFuture.wait_for(VIBRATION_CALLBACK_TIMEOUT), std::future_status::ready);
+ for (std::future<void>& future : vibrationFutures) {
+ EXPECT_EQ(future.wait_for(VIBRATION_CALLBACK_TIMEOUT), std::future_status::ready);
+ }
+}
+
+TEST_P(VibratorAidl, VibrationSessionsClearedWithoutSession) {
+ if (!(capabilities & IVibratorManager::CAP_START_SESSIONS)) return;
+
+ EXPECT_OK(manager->clearSessions());
+}
+
+TEST_P(VibratorAidl, VibrationSessionsWithSyncedVibrations) {
+ if (!(capabilities & IVibratorManager::CAP_START_SESSIONS)) return;
+ if (!(capabilities & IVibratorManager::CAP_SYNC)) return;
+ if (!(capabilities & IVibratorManager::CAP_PREPARE_ON)) return;
+ if (!(capabilities & IVibratorManager::CAP_TRIGGER_CALLBACK)) return;
+ if (vibratorIds.empty()) return;
+
+ std::promise<void> sessionPromise;
+ std::future<void> sessionFuture{sessionPromise.get_future()};
+ auto sessionCallback = ndk::SharedRefBase::make<CompletionCallback>(
+ [&sessionPromise] { sessionPromise.set_value(); });
+
+ VibrationSessionConfig sessionConfig;
+ EXPECT_OK(manager->startSession(vibratorIds, sessionConfig, sessionCallback, &session));
+ ASSERT_NE(session, nullptr);
+
+ EXPECT_OK(manager->prepareSynced(vibratorIds));
+
+ int32_t durationMs = 250;
+ std::vector<std::promise<void>> vibrationPromises;
+ std::vector<std::future<void>> vibrationFutures;
+ for (int32_t id : vibratorIds) {
+ std::shared_ptr<IVibrator> vibrator;
+ EXPECT_OK(manager->getVibrator(id, &vibrator));
+ ASSERT_NE(vibrator, nullptr);
+
+ std::promise<void>& vibrationPromise = vibrationPromises.emplace_back();
+ vibrationFutures.push_back(vibrationPromise.get_future());
+ auto vibrationCallback = ndk::SharedRefBase::make<CompletionCallback>(
+ [&vibrationPromise] { vibrationPromise.set_value(); });
+ EXPECT_OK(vibrator->on(durationMs, vibrationCallback));
+ }
+
+ std::promise<void> triggerPromise;
+ std::future<void> triggerFuture{triggerPromise.get_future()};
+ auto triggerCallback = ndk::SharedRefBase::make<CompletionCallback>(
+ [&triggerPromise] { triggerPromise.set_value(); });
+
+ EXPECT_OK(manager->triggerSynced(triggerCallback));
+
+ auto timeout = std::chrono::milliseconds(durationMs) + VIBRATION_CALLBACK_TIMEOUT;
+ EXPECT_EQ(triggerFuture.wait_for(timeout), std::future_status::ready);
+ for (std::future<void>& future : vibrationFutures) {
+ EXPECT_EQ(future.wait_for(timeout), std::future_status::ready);
+ }
+
+ // Session callback not triggered.
+ EXPECT_EQ(sessionFuture.wait_for(VIBRATION_CALLBACK_TIMEOUT), std::future_status::timeout);
+
+ // Ending a session should not take long since the vibration was already completed
+ EXPECT_OK(session->close());
+ EXPECT_EQ(sessionFuture.wait_for(VIBRATION_CALLBACK_TIMEOUT), std::future_status::ready);
+}
+
+TEST_P(VibratorAidl, VibrationSessionWithMultipleIndependentVibrations) {
+ if (!(capabilities & IVibratorManager::CAP_START_SESSIONS)) return;
+ if (vibratorIds.empty()) return;
+
+ std::promise<void> sessionPromise;
+ std::future<void> sessionFuture{sessionPromise.get_future()};
+ auto sessionCallback = ndk::SharedRefBase::make<CompletionCallback>(
+ [&sessionPromise] { sessionPromise.set_value(); });
+
+ VibrationSessionConfig sessionConfig;
+ EXPECT_OK(manager->startSession(vibratorIds, sessionConfig, sessionCallback, &session));
+ ASSERT_NE(session, nullptr);
+
+ for (int32_t id : vibratorIds) {
+ std::shared_ptr<IVibrator> vibrator;
+ EXPECT_OK(manager->getVibrator(id, &vibrator));
+ ASSERT_NE(vibrator, nullptr);
+
+ EXPECT_OK(vibrator->on(100, nullptr));
+ EXPECT_OK(vibrator->on(200, nullptr));
+ EXPECT_OK(vibrator->on(300, nullptr));
+ }
+
+ // Session callback not triggered.
+ EXPECT_EQ(sessionFuture.wait_for(VIBRATION_CALLBACK_TIMEOUT), std::future_status::timeout);
+
+ EXPECT_OK(session->close());
+
+ int32_t maxDurationMs = 100 + 200 + 300;
+ auto timeout = std::chrono::milliseconds(maxDurationMs) + VIBRATION_CALLBACK_TIMEOUT;
+ EXPECT_EQ(sessionFuture.wait_for(timeout), std::future_status::ready);
+}
+
+TEST_P(VibratorAidl, VibrationSessionsIgnoresSecondSessionWhenFirstIsOngoing) {
+ if (!(capabilities & IVibratorManager::CAP_START_SESSIONS)) return;
+ if (vibratorIds.empty()) return;
+
+ std::promise<void> sessionPromise;
+ std::future<void> sessionFuture{sessionPromise.get_future()};
+ auto sessionCallback = ndk::SharedRefBase::make<CompletionCallback>(
+ [&sessionPromise] { sessionPromise.set_value(); });
+
+ VibrationSessionConfig sessionConfig;
+ EXPECT_OK(manager->startSession(vibratorIds, sessionConfig, sessionCallback, &session));
+ ASSERT_NE(session, nullptr);
+
+ std::shared_ptr<IVibrationSession> secondSession;
+ EXPECT_ILLEGAL_STATE(
+ manager->startSession(vibratorIds, sessionConfig, nullptr, &secondSession));
+ EXPECT_EQ(secondSession, nullptr);
+
+ // First session was not cancelled.
+ EXPECT_EQ(sessionFuture.wait_for(VIBRATION_CALLBACK_TIMEOUT), std::future_status::timeout);
+
+ // First session still ongoing, we can still vibrate.
+ int32_t durationMs = 100;
+ for (int32_t id : vibratorIds) {
+ std::shared_ptr<IVibrator> vibrator;
+ EXPECT_OK(manager->getVibrator(id, &vibrator));
+ ASSERT_NE(vibrator, nullptr);
+ EXPECT_OK(vibrator->on(durationMs, nullptr));
+ }
+
+ EXPECT_OK(session->close());
+
+ auto timeout = std::chrono::milliseconds(durationMs) + VIBRATION_CALLBACK_TIMEOUT;
+ EXPECT_EQ(sessionFuture.wait_for(timeout), std::future_status::ready);
+}
+
+TEST_P(VibratorAidl, VibrationSessionEndMultipleTimes) {
+ if (!(capabilities & IVibratorManager::CAP_START_SESSIONS)) return;
+ if (vibratorIds.empty()) return;
+
+ std::promise<void> sessionPromise;
+ std::future<void> sessionFuture{sessionPromise.get_future()};
+ auto sessionCallback = ndk::SharedRefBase::make<CompletionCallback>(
+ [&sessionPromise] { sessionPromise.set_value(); });
+
+ VibrationSessionConfig sessionConfig;
+ EXPECT_OK(manager->startSession(vibratorIds, sessionConfig, sessionCallback, &session));
+ ASSERT_NE(session, nullptr);
+
+ int32_t durationMs = 250;
+ std::vector<std::promise<void>> vibrationPromises;
+ std::vector<std::future<void>> vibrationFutures;
+ for (int32_t id : vibratorIds) {
+ std::shared_ptr<IVibrator> vibrator;
+ EXPECT_OK(manager->getVibrator(id, &vibrator));
+ ASSERT_NE(vibrator, nullptr);
+
+ std::promise<void>& vibrationPromise = vibrationPromises.emplace_back();
+ vibrationFutures.push_back(vibrationPromise.get_future());
+ auto vibrationCallback = ndk::SharedRefBase::make<CompletionCallback>(
+ [&vibrationPromise] { vibrationPromise.set_value(); });
+ EXPECT_OK(vibrator->on(durationMs, vibrationCallback));
+ }
+
+ // Session callback not triggered.
+ EXPECT_EQ(sessionFuture.wait_for(VIBRATION_CALLBACK_TIMEOUT), std::future_status::timeout);
+
+ // End session, this might take a while
+ EXPECT_OK(session->close());
+
+ // End session again
+ EXPECT_OK(session->close());
+
+ // Both callbacks triggered within timeout.
+ auto timeout = std::chrono::milliseconds(durationMs) + VIBRATION_CALLBACK_TIMEOUT;
+ EXPECT_EQ(sessionFuture.wait_for(timeout), std::future_status::ready);
+ for (std::future<void>& future : vibrationFutures) {
+ EXPECT_EQ(future.wait_for(timeout), std::future_status::ready);
+ }
+}
+
+TEST_P(VibratorAidl, VibrationSessionDeletedAfterEnded) {
+ if (!(capabilities & IVibratorManager::CAP_START_SESSIONS)) return;
+ if (vibratorIds.empty()) return;
+
+ std::promise<void> sessionPromise;
+ std::future<void> sessionFuture{sessionPromise.get_future()};
+ auto sessionCallback = ndk::SharedRefBase::make<CompletionCallback>(
+ [&sessionPromise] { sessionPromise.set_value(); });
+
+ VibrationSessionConfig sessionConfig;
+ EXPECT_OK(manager->startSession(vibratorIds, sessionConfig, sessionCallback, &session));
+ ASSERT_NE(session, nullptr);
+
+ int32_t durationMs = 250;
+ std::vector<std::promise<void>> vibrationPromises;
+ std::vector<std::future<void>> vibrationFutures;
+ for (int32_t id : vibratorIds) {
+ std::shared_ptr<IVibrator> vibrator;
+ EXPECT_OK(manager->getVibrator(id, &vibrator));
+ ASSERT_NE(vibrator, nullptr);
+
+ std::promise<void>& vibrationPromise = vibrationPromises.emplace_back();
+ vibrationFutures.push_back(vibrationPromise.get_future());
+ auto vibrationCallback = ndk::SharedRefBase::make<CompletionCallback>(
+ [&vibrationPromise] { vibrationPromise.set_value(); });
+ EXPECT_OK(vibrator->on(durationMs, vibrationCallback));
+ }
+
+ // Session callback not triggered.
+ EXPECT_EQ(sessionFuture.wait_for(VIBRATION_CALLBACK_TIMEOUT), std::future_status::timeout);
+
+ // End session, this might take a while
+ EXPECT_OK(session->close());
+
+ session.reset();
+
+ // Both callbacks triggered within timeout, even after session was deleted.
+ auto timeout = std::chrono::milliseconds(durationMs) + VIBRATION_CALLBACK_TIMEOUT;
+ EXPECT_EQ(sessionFuture.wait_for(timeout), std::future_status::ready);
+ for (std::future<void>& future : vibrationFutures) {
+ EXPECT_EQ(future.wait_for(timeout), std::future_status::ready);
+ }
+}
+
+TEST_P(VibratorAidl, VibrationSessionWrongVibratorIdsFail) {
+ if (!(capabilities & IVibratorManager::CAP_START_SESSIONS)) return;
+
+ auto maxIdIt = std::max_element(vibratorIds.begin(), vibratorIds.end());
+ int32_t wrongId = maxIdIt == vibratorIds.end() ? 0 : *maxIdIt + 1;
+
+ std::vector<int32_t> emptyIds;
+ std::vector<int32_t> wrongIds{wrongId};
+ VibrationSessionConfig sessionConfig;
+ EXPECT_ILLEGAL_ARGUMENT(manager->startSession(emptyIds, sessionConfig, nullptr, &session));
+ EXPECT_ILLEGAL_ARGUMENT(manager->startSession(wrongIds, sessionConfig, nullptr, &session));
+ EXPECT_EQ(session, nullptr);
+}
+
+TEST_P(VibratorAidl, VibrationSessionDuringPrepareSyncedFails) {
+ if (!(capabilities & IVibratorManager::CAP_SYNC)) return;
+ if (!(capabilities & IVibratorManager::CAP_START_SESSIONS)) return;
+ if (vibratorIds.empty()) return;
+
+ EXPECT_OK(manager->prepareSynced(vibratorIds));
+
+ VibrationSessionConfig sessionConfig;
+ EXPECT_ILLEGAL_STATE(manager->startSession(vibratorIds, sessionConfig, nullptr, &session));
+ EXPECT_EQ(session, nullptr);
+
+ EXPECT_OK(manager->cancelSynced());
+}
+
+TEST_P(VibratorAidl, VibrationSessionsUnsupported) {
+ if (version < VIBRATION_SESSIONS_MIN_VERSION) {
+ EXPECT_EQ(capabilities & IVibratorManager::CAP_START_SESSIONS, 0)
+ << "Vibrator manager version " << version
+ << " should not report start session capability";
+ }
+ if (capabilities & IVibratorManager::CAP_START_SESSIONS) return;
+
+ VibrationSessionConfig sessionConfig;
+ EXPECT_UNKNOWN_OR_UNSUPPORTED(
+ manager->startSession(vibratorIds, sessionConfig, nullptr, &session));
+ EXPECT_EQ(session, nullptr);
+ EXPECT_UNKNOWN_OR_UNSUPPORTED(manager->clearSessions());
+}
+
std::vector<std::string> FindVibratorManagerNames() {
std::vector<std::string> names;
constexpr auto callback = [](const char* instance, void* context) {
@@ -219,7 +679,7 @@
int main(int argc, char** argv) {
::testing::InitGoogleTest(&argc, argv);
- ABinderProcess_setThreadPoolMaxThreadCount(1);
+ ABinderProcess_setThreadPoolMaxThreadCount(2);
ABinderProcess_startThreadPool();
return RUN_ALL_TESTS();
}
diff --git a/vibrator/aidl/vts/test_utils.h b/vibrator/aidl/vts/test_utils.h
index aaf3211..e884bbd 100644
--- a/vibrator/aidl/vts/test_utils.h
+++ b/vibrator/aidl/vts/test_utils.h
@@ -57,4 +57,17 @@
#error Macro EXPECT_ILLEGAL_ARGUMENT already defined unexpectedly
#endif
+#if !defined(EXPECT_ILLEGAL_STATE)
+#define EXPECT_ILLEGAL_STATE(expression) \
+ GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
+ if (const ::ndk::ScopedAStatus&& _status = (expression); \
+ _status.getExceptionCode() == EX_ILLEGAL_STATE) \
+ ; \
+ else \
+ ADD_FAILURE() << "Expected EX_ILLEGAL_STATE for: " << #expression \
+ << "\n Actual: " << _status
+#else
+#error Macro EXPECT_ILLEGAL_STATE already defined unexpectedly
+#endif
+
#endif // VIBRATOR_HAL_TEST_UTILS_H
diff --git a/weaver/vts/VtsHalWeaverTargetTest.cpp b/weaver/vts/VtsHalWeaverTargetTest.cpp
index 8952dfc..faa8416 100644
--- a/weaver/vts/VtsHalWeaverTargetTest.cpp
+++ b/weaver/vts/VtsHalWeaverTargetTest.cpp
@@ -220,13 +220,10 @@
used_slots.insert(slot);
}
}
- // Starting in Android 14, the system will always use at least one Weaver slot if Weaver is
- // supported at all. This is true even if an LSKF hasn't been set yet, since Weaver is used to
- // protect the initial binding of each user's synthetic password to ensure that binding can be
- // securely deleted if an LSKF is set later. Make sure we saw at least one slot, as otherwise
- // the Weaver implementation must have a bug that makes it not fully usable by Android.
- ASSERT_FALSE(used_slots.empty())
- << "Could not determine which Weaver slots are in use by the system";
+
+ // We should assert !used_slots.empty() here, but that can't be done yet due to
+ // config_disableWeaverOnUnsecuredUsers being supported. The value of that option is not
+ // accessible from here, so we have to assume it might be set to true.
// Find the first free slot.
int found = 0;
diff --git a/wifi/aidl/Android.bp b/wifi/aidl/Android.bp
index 392d2e9..b77e935 100644
--- a/wifi/aidl/Android.bp
+++ b/wifi/aidl/Android.bp
@@ -64,5 +64,5 @@
},
],
- frozen: true,
+ frozen: false,
}
diff --git a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiChip.aidl b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiChip.aidl
index 5ed7517..5fe7c53 100644
--- a/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiChip.aidl
+++ b/wifi/aidl/aidl_api/android.hardware.wifi/current/android/hardware/wifi/IWifiChip.aidl
@@ -98,6 +98,7 @@
SET_AFC_CHANNEL_ALLOWANCE = (1 << 7) /* 128 */,
T2LM_NEGOTIATION = (1 << 8) /* 256 */,
SET_VOIP_MODE = (1 << 9) /* 512 */,
+ MLO_SAP = (1 << 10) /* 1024 */,
}
@VintfStability
parcelable ChipConcurrencyCombinationLimit {
diff --git a/wifi/aidl/android/hardware/wifi/IWifiChip.aidl b/wifi/aidl/android/hardware/wifi/IWifiChip.aidl
index d12d26c..4e418d8 100644
--- a/wifi/aidl/android/hardware/wifi/IWifiChip.aidl
+++ b/wifi/aidl/android/hardware/wifi/IWifiChip.aidl
@@ -87,6 +87,10 @@
* Chip supports voip mode setting.
*/
SET_VOIP_MODE = 1 << 9,
+ /**
+ * Chip supports Wi-Fi 7 MLO SoftAp.
+ */
+ MLO_SAP = 1 << 10,
}
/**
diff --git a/wifi/aidl/default/Android.bp b/wifi/aidl/default/Android.bp
index 3fcb77f..0711bde 100644
--- a/wifi/aidl/default/Android.bp
+++ b/wifi/aidl/default/Android.bp
@@ -106,7 +106,7 @@
"libwifi-hal",
"libwifi-system-iface",
"libxml2",
- "android.hardware.wifi-V2-ndk",
+ "android.hardware.wifi-V3-ndk",
],
export_include_dirs: ["."],
@@ -138,7 +138,7 @@
"libwifi-hal",
"libwifi-system-iface",
"libxml2",
- "android.hardware.wifi-V2-ndk",
+ "android.hardware.wifi-V3-ndk",
],
static_libs: ["android.hardware.wifi-service-lib"],
init_rc: ["android.hardware.wifi-service.rc"],
@@ -167,7 +167,7 @@
"libwifi-hal",
"libwifi-system-iface",
"libxml2",
- "android.hardware.wifi-V2-ndk",
+ "android.hardware.wifi-V3-ndk",
],
static_libs: ["android.hardware.wifi-service-lib"],
init_rc: ["android.hardware.wifi-service-lazy.rc"],
@@ -199,7 +199,7 @@
static_libs: [
"libgmock",
"libgtest",
- "android.hardware.wifi-V2-ndk",
+ "android.hardware.wifi-V3-ndk",
"android.hardware.wifi.common-V1-ndk",
"android.hardware.wifi-service-lib",
],
diff --git a/wifi/aidl/default/aidl_struct_util.cpp b/wifi/aidl/default/aidl_struct_util.cpp
index d99edaa..0455be7 100644
--- a/wifi/aidl/default/aidl_struct_util.cpp
+++ b/wifi/aidl/default/aidl_struct_util.cpp
@@ -61,6 +61,8 @@
return IWifiChip::FeatureSetMask::SET_AFC_CHANNEL_ALLOWANCE;
case WIFI_FEATURE_SET_VOIP_MODE:
return IWifiChip::FeatureSetMask::SET_VOIP_MODE;
+ case WIFI_FEATURE_MLO_SAP:
+ return IWifiChip::FeatureSetMask::MLO_SAP;
};
CHECK(false) << "Unknown legacy feature: " << feature;
return {};
diff --git a/wifi/aidl/default/android.hardware.wifi-service.xml b/wifi/aidl/default/android.hardware.wifi-service.xml
index 3b68c8e..9bfffb6 100644
--- a/wifi/aidl/default/android.hardware.wifi-service.xml
+++ b/wifi/aidl/default/android.hardware.wifi-service.xml
@@ -1,7 +1,7 @@
<manifest version="1.0" type="device">
<hal format="aidl">
<name>android.hardware.wifi</name>
- <version>2</version>
+ <version>3</version>
<fqname>IWifi/default</fqname>
</hal>
</manifest>
diff --git a/wifi/aidl/vts/functional/Android.bp b/wifi/aidl/vts/functional/Android.bp
index 9994d09..66eb970 100644
--- a/wifi/aidl/vts/functional/Android.bp
+++ b/wifi/aidl/vts/functional/Android.bp
@@ -41,7 +41,7 @@
static_libs: [
"VtsHalWifiTargetTestUtil",
"android.hardware.wifi.common-V1-ndk",
- "android.hardware.wifi-V2-ndk",
+ "android.hardware.wifi-V3-ndk",
"libwifi-system-iface",
],
test_suites: [
@@ -67,7 +67,7 @@
static_libs: [
"VtsHalWifiTargetTestUtil",
"android.hardware.wifi.common-V1-ndk",
- "android.hardware.wifi-V2-ndk",
+ "android.hardware.wifi-V3-ndk",
"libwifi-system-iface",
],
test_suites: [
@@ -93,7 +93,7 @@
static_libs: [
"VtsHalWifiTargetTestUtil",
"android.hardware.wifi.common-V1-ndk",
- "android.hardware.wifi-V2-ndk",
+ "android.hardware.wifi-V3-ndk",
"libwifi-system-iface",
],
test_suites: [
@@ -119,7 +119,7 @@
static_libs: [
"VtsHalWifiTargetTestUtil",
"android.hardware.wifi.common-V1-ndk",
- "android.hardware.wifi-V2-ndk",
+ "android.hardware.wifi-V3-ndk",
"libwifi-system-iface",
],
test_suites: [
@@ -145,7 +145,7 @@
static_libs: [
"VtsHalWifiTargetTestUtil",
"android.hardware.wifi.common-V1-ndk",
- "android.hardware.wifi-V2-ndk",
+ "android.hardware.wifi-V3-ndk",
"libwifi-system-iface",
],
test_suites: [
@@ -170,7 +170,7 @@
],
static_libs: [
"android.hardware.wifi.common-V1-ndk",
- "android.hardware.wifi-V2-ndk",
+ "android.hardware.wifi-V3-ndk",
"libwifi-system-iface",
],
}
diff --git a/wifi/hostapd/aidl/vts/functional/Android.bp b/wifi/hostapd/aidl/vts/functional/Android.bp
index bf1b0d0..b1c9c5d 100644
--- a/wifi/hostapd/aidl/vts/functional/Android.bp
+++ b/wifi/hostapd/aidl/vts/functional/Android.bp
@@ -38,7 +38,7 @@
"android.hardware.wifi@1.5",
"android.hardware.wifi@1.6",
"android.hardware.wifi.common-V1-ndk",
- "android.hardware.wifi-V2-ndk",
+ "android.hardware.wifi-V3-ndk",
"libwifi-system",
"libwifi-system-iface",
"VtsHalWifiTargetTestUtil",
diff --git a/wifi/legacy_headers/include/hardware_legacy/wifi_hal.h b/wifi/legacy_headers/include/hardware_legacy/wifi_hal.h
index 9baa2c7..c68cdf6 100644
--- a/wifi/legacy_headers/include/hardware_legacy/wifi_hal.h
+++ b/wifi/legacy_headers/include/hardware_legacy/wifi_hal.h
@@ -494,6 +494,7 @@
#define WIFI_FEATURE_ROAMING_MODE_CONTROL (uint64_t)0x800000000 // Support for configuring roaming mode
#define WIFI_FEATURE_SET_VOIP_MODE (uint64_t)0x1000000000 // Support Voip mode setting
#define WIFI_FEATURE_CACHED_SCAN_RESULTS (uint64_t)0x2000000000 // Support cached scan result report
+#define WIFI_FEATURE_MLO_SAP (uint64_t)0x4000000000 // Support MLO SoftAp
// Add more features here
#define IS_MASK_SET(mask, flags) (((flags) & (mask)) == (mask))
diff --git a/wifi/supplicant/aidl/Android.bp b/wifi/supplicant/aidl/Android.bp
index b7242ed..8d16cb7 100644
--- a/wifi/supplicant/aidl/Android.bp
+++ b/wifi/supplicant/aidl/Android.bp
@@ -71,5 +71,5 @@
},
],
- frozen: true,
+ frozen: false,
}
diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantP2pIface.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantP2pIface.aidl
index 0b068e0..0462fd3 100644
--- a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantP2pIface.aidl
+++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/ISupplicantP2pIface.aidl
@@ -123,4 +123,7 @@
void configureExtListenWithParams(in android.hardware.wifi.supplicant.P2pExtListenInfo extListenInfo);
void addGroupWithConfigurationParams(in android.hardware.wifi.supplicant.P2pAddGroupConfigurationParams groupConfigurationParams);
void createGroupOwner(in android.hardware.wifi.supplicant.P2pCreateGroupOwnerInfo groupOwnerInfo);
+ long getFeatureSet();
+ const long P2P_FEATURE_V2 = (1 << 0) /* 1 */;
+ const long P2P_FEATURE_PCC_MODE_WPA3_COMPATIBILITY = (1 << 1) /* 2 */;
}
diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/P2pGroupStartedEventParams.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/P2pGroupStartedEventParams.aidl
index e19ae44..227626c 100644
--- a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/P2pGroupStartedEventParams.aidl
+++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/P2pGroupStartedEventParams.aidl
@@ -46,4 +46,5 @@
boolean isP2pClientEapolIpAddressInfoPresent;
android.hardware.wifi.supplicant.P2pClientEapolIpAddressInfo p2pClientIpInfo;
@nullable android.hardware.wifi.common.OuiKeyedData[] vendorData;
+ int keyMgmtMask;
}
diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/P2pPeerClientJoinedEventParams.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/P2pPeerClientJoinedEventParams.aidl
index 40c8ff6..578176a 100644
--- a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/P2pPeerClientJoinedEventParams.aidl
+++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/P2pPeerClientJoinedEventParams.aidl
@@ -39,4 +39,5 @@
byte[6] clientDeviceAddress;
int clientIpAddress;
@nullable android.hardware.wifi.common.OuiKeyedData[] vendorData;
+ int keyMgmtMask;
}
diff --git a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/WpaDriverCapabilitiesMask.aidl b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/WpaDriverCapabilitiesMask.aidl
index 330f2aa..6bae4cf 100644
--- a/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/WpaDriverCapabilitiesMask.aidl
+++ b/wifi/supplicant/aidl/aidl_api/android.hardware.wifi.supplicant/current/android/hardware/wifi/supplicant/WpaDriverCapabilitiesMask.aidl
@@ -41,4 +41,5 @@
TRUST_ON_FIRST_USE = (1 << 4) /* 16 */,
SET_TLS_MINIMUM_VERSION = (1 << 5) /* 32 */,
TLS_V1_3 = (1 << 6) /* 64 */,
+ RSN_OVERRIDING = (1 << 7) /* 128 */,
}
diff --git a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantP2pIface.aidl b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantP2pIface.aidl
index 1230793..6a9406a 100644
--- a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantP2pIface.aidl
+++ b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/ISupplicantP2pIface.aidl
@@ -39,6 +39,15 @@
@VintfStability
interface ISupplicantP2pIface {
/**
+ * P2P features exposed by wpa_supplicant/chip.
+ */
+ /* Support for P2P2 (Wi-Fi Alliance P2P v2.0) */
+ const long P2P_FEATURE_V2 = 1 << 0;
+
+ /* Support for WPA3 Compatibility Mode in PCC Mode */
+ const long P2P_FEATURE_PCC_MODE_WPA3_COMPATIBILITY = 1 << 1;
+
+ /**
* This command can be used to add a bonjour service.
*
* @param query Hex dump of the query data.
@@ -938,4 +947,14 @@
* |SupplicantStatusCode.FAILURE_IFACE_INVALID|
*/
void createGroupOwner(in P2pCreateGroupOwnerInfo groupOwnerInfo);
+
+ /**
+ * Get the features supported by P2P interface.
+ *
+ * @return The bitmask of ISupplicantP2pIface.P2P_FEATURE_* values.
+ *
+ * @throws ServiceSpecificException with one of the following values:
+ * |SupplicantStatusCode.FAILURE_UNKNOWN|
+ */
+ long getFeatureSet();
}
diff --git a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/P2pGroupStartedEventParams.aidl b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/P2pGroupStartedEventParams.aidl
index 9db7a1e..55e2b23 100644
--- a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/P2pGroupStartedEventParams.aidl
+++ b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/P2pGroupStartedEventParams.aidl
@@ -70,4 +70,10 @@
* that no vendor data is provided.
*/
@nullable OuiKeyedData[] vendorData;
+
+ /**
+ * Authentication key management protocol used to secure the group.
+ * This is a bitmask of |KeyMgmtMask| values.
+ */
+ int keyMgmtMask;
}
diff --git a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/P2pPeerClientJoinedEventParams.aidl b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/P2pPeerClientJoinedEventParams.aidl
index 4f46d70..2b04461 100644
--- a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/P2pPeerClientJoinedEventParams.aidl
+++ b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/P2pPeerClientJoinedEventParams.aidl
@@ -47,4 +47,10 @@
* that no vendor data is provided.
*/
@nullable OuiKeyedData[] vendorData;
+
+ /**
+ * Authentication key management protocol used in connection.
+ * This is a bitmask of |KeyMgmtMask| values.
+ */
+ int keyMgmtMask;
}
diff --git a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/WpaDriverCapabilitiesMask.aidl b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/WpaDriverCapabilitiesMask.aidl
index a9434c4..b6e57c6 100644
--- a/wifi/supplicant/aidl/android/hardware/wifi/supplicant/WpaDriverCapabilitiesMask.aidl
+++ b/wifi/supplicant/aidl/android/hardware/wifi/supplicant/WpaDriverCapabilitiesMask.aidl
@@ -50,4 +50,8 @@
* TLS V1.3
*/
TLS_V1_3 = 1 << 6,
+ /**
+ * RSN Overriding
+ */
+ RSN_OVERRIDING = 1 << 7,
}
diff --git a/wifi/supplicant/aidl/vts/functional/Android.bp b/wifi/supplicant/aidl/vts/functional/Android.bp
index 4166850..8bfe805 100644
--- a/wifi/supplicant/aidl/vts/functional/Android.bp
+++ b/wifi/supplicant/aidl/vts/functional/Android.bp
@@ -46,14 +46,14 @@
"android.hardware.wifi.common-V1-ndk",
"android.hardware.wifi.supplicant@1.0",
"android.hardware.wifi.supplicant@1.1",
- "android.hardware.wifi.supplicant-V3-ndk",
+ "android.hardware.wifi.supplicant-V4-ndk",
"libwifi-system",
"libwifi-system-iface",
"VtsHalWifiV1_0TargetTestUtil",
"VtsHalWifiV1_5TargetTestUtil",
"VtsHalWifiSupplicantV1_0TargetTestUtil",
"android.hardware.wifi.common-V1-ndk",
- "android.hardware.wifi-V2-ndk",
+ "android.hardware.wifi-V3-ndk",
"VtsHalWifiTargetTestUtil",
],
test_suites: [
@@ -84,14 +84,14 @@
"android.hardware.wifi.common-V1-ndk",
"android.hardware.wifi.supplicant@1.0",
"android.hardware.wifi.supplicant@1.1",
- "android.hardware.wifi.supplicant-V3-ndk",
+ "android.hardware.wifi.supplicant-V4-ndk",
"libwifi-system",
"libwifi-system-iface",
"VtsHalWifiV1_0TargetTestUtil",
"VtsHalWifiV1_5TargetTestUtil",
"VtsHalWifiSupplicantV1_0TargetTestUtil",
"android.hardware.wifi.common-V1-ndk",
- "android.hardware.wifi-V2-ndk",
+ "android.hardware.wifi-V3-ndk",
"VtsHalWifiTargetTestUtil",
],
test_suites: [
@@ -122,14 +122,14 @@
"android.hardware.wifi.common-V1-ndk",
"android.hardware.wifi.supplicant@1.0",
"android.hardware.wifi.supplicant@1.1",
- "android.hardware.wifi.supplicant-V3-ndk",
+ "android.hardware.wifi.supplicant-V4-ndk",
"libwifi-system",
"libwifi-system-iface",
"VtsHalWifiV1_0TargetTestUtil",
"VtsHalWifiV1_5TargetTestUtil",
"VtsHalWifiSupplicantV1_0TargetTestUtil",
"android.hardware.wifi.common-V1-ndk",
- "android.hardware.wifi-V2-ndk",
+ "android.hardware.wifi-V3-ndk",
"VtsHalWifiTargetTestUtil",
],
test_suites: [
diff --git a/wifi/supplicant/aidl/vts/functional/supplicant_p2p_iface_aidl_test.cpp b/wifi/supplicant/aidl/vts/functional/supplicant_p2p_iface_aidl_test.cpp
index 8f1c4bd..a8132aa 100644
--- a/wifi/supplicant/aidl/vts/functional/supplicant_p2p_iface_aidl_test.cpp
+++ b/wifi/supplicant/aidl/vts/functional/supplicant_p2p_iface_aidl_test.cpp
@@ -814,6 +814,17 @@
LOG(INFO) << "SupplicantP2pIfaceAidlTest::SetVendorElements end";
}
+/*
+ * getFeatureSet
+ */
+TEST_P(SupplicantP2pIfaceAidlTest, getFeatureSet) {
+ if (interface_version_ < 4) {
+ GTEST_SKIP() << "getFeatureSet is available as of Supplicant V4";
+ }
+ int64_t featureSet;
+ EXPECT_TRUE(p2p_iface_->getFeatureSet(&featureSet).isOk());
+}
+
GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(SupplicantP2pIfaceAidlTest);
INSTANTIATE_TEST_SUITE_P(Supplicant, SupplicantP2pIfaceAidlTest,
testing::ValuesIn(android::getAidlHalInstanceNames(