mirror of
https://github.com/Evolution-X/hardware_interfaces
synced 2026-02-01 22:04:26 +00:00
Refactor the ISoundDose.aidl interface
This refactoring is fixing the hal_implementation_test workaround from aosp/2363076. Adjusted the package name to match the aidl_interface and declared the ISoundDose interface types only. Test: VtsHalSoundDoseFactoryTargetTest, VtsHalAudioCoreTargetTest, hal_implementation_test Bug: 263388737 Change-Id: Ibce4cd95aaf600de2096179f137243939114ba6a
This commit is contained in:
@@ -114,7 +114,6 @@ aidl_interface {
|
||||
"android/hardware/audio/core/AudioRoute.aidl",
|
||||
"android/hardware/audio/core/IConfig.aidl",
|
||||
"android/hardware/audio/core/IModule.aidl",
|
||||
"android/hardware/audio/core/ISoundDose.aidl",
|
||||
"android/hardware/audio/core/IStreamCallback.aidl",
|
||||
"android/hardware/audio/core/IStreamCommon.aidl",
|
||||
"android/hardware/audio/core/IStreamIn.aidl",
|
||||
@@ -133,6 +132,7 @@ aidl_interface {
|
||||
"android.hardware.common-V2",
|
||||
"android.hardware.common.fmq-V1",
|
||||
"android.hardware.audio.common-V1",
|
||||
"android.hardware.audio.core.sounddose-V1",
|
||||
"android.hardware.audio.effect-V1",
|
||||
"android.media.audio.common.types-V2",
|
||||
],
|
||||
@@ -178,7 +178,7 @@ aidl_interface {
|
||||
"android.hardware.audio_defaults",
|
||||
],
|
||||
srcs: [
|
||||
"android/hardware/audio/core/ISoundDose.aidl",
|
||||
"android/hardware/audio/core/sounddose/ISoundDose.aidl",
|
||||
],
|
||||
imports: [
|
||||
"android.media.audio.common.types-V2",
|
||||
|
||||
@@ -31,18 +31,18 @@
|
||||
// with such a backward incompatible change, it has a high risk of breaking
|
||||
// later when a module using the interface is updated, e.g., Mainline modules.
|
||||
|
||||
package android.hardware.audio.core;
|
||||
package android.hardware.audio.core.sounddose;
|
||||
@VintfStability
|
||||
interface ISoundDose {
|
||||
void setOutputRs2(float rs2ValueDbA);
|
||||
float getOutputRs2();
|
||||
void registerSoundDoseCallback(in android.hardware.audio.core.ISoundDose.IHalSoundDoseCallback callback);
|
||||
void registerSoundDoseCallback(in android.hardware.audio.core.sounddose.ISoundDose.IHalSoundDoseCallback callback);
|
||||
const int DEFAULT_MAX_RS2 = 100;
|
||||
const int MIN_RS2 = 80;
|
||||
@VintfStability
|
||||
interface IHalSoundDoseCallback {
|
||||
oneway void onMomentaryExposureWarning(float currentDbA, in android.media.audio.common.AudioDevice audioDevice);
|
||||
oneway void onNewMelValues(in android.hardware.audio.core.ISoundDose.IHalSoundDoseCallback.MelRecord melRecord, in android.media.audio.common.AudioDevice audioDevice);
|
||||
oneway void onNewMelValues(in android.hardware.audio.core.sounddose.ISoundDose.IHalSoundDoseCallback.MelRecord melRecord, in android.media.audio.common.AudioDevice audioDevice);
|
||||
@VintfStability
|
||||
parcelable MelRecord {
|
||||
float[] melValues;
|
||||
@@ -61,7 +61,7 @@ interface IModule {
|
||||
void updateAudioMode(android.hardware.audio.core.AudioMode mode);
|
||||
void updateScreenRotation(android.hardware.audio.core.IModule.ScreenRotation rotation);
|
||||
void updateScreenState(boolean isTurnedOn);
|
||||
@nullable android.hardware.audio.core.ISoundDose getSoundDose();
|
||||
@nullable android.hardware.audio.core.sounddose.ISoundDose getSoundDose();
|
||||
int generateHwAvSyncId();
|
||||
android.hardware.audio.core.VendorParameter[] getVendorParameters(in @utf8InCpp String[] ids);
|
||||
void setVendorParameters(in android.hardware.audio.core.VendorParameter[] parameters, boolean async);
|
||||
|
||||
@@ -1,52 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2022 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// This file is a snapshot of an AIDL file. Do not edit it manually. There are
|
||||
// two cases:
|
||||
// 1). this is a frozen version file - do not edit this in any case.
|
||||
// 2). this is a 'current' file. If you make a backwards compatible change to
|
||||
// the interface (from the latest frozen version), the build system will
|
||||
// prompt you to update this file with `m <name>-update-api`.
|
||||
//
|
||||
// You must not make a backward incompatible change to any AIDL file built
|
||||
// with the aidl_interface module type with versions property set. The module
|
||||
// type is used to build AIDL files in a way that they can be used across
|
||||
// independently updatable components of the system. If a device is shipped
|
||||
// with such a backward incompatible change, it has a high risk of breaking
|
||||
// later when a module using the interface is updated, e.g., Mainline modules.
|
||||
|
||||
package android.hardware.audio.core;
|
||||
@VintfStability
|
||||
interface ISoundDose {
|
||||
void setOutputRs2(float rs2ValueDbA);
|
||||
float getOutputRs2();
|
||||
void registerSoundDoseCallback(in android.hardware.audio.core.ISoundDose.IHalSoundDoseCallback callback);
|
||||
const int DEFAULT_MAX_RS2 = 100;
|
||||
const int MIN_RS2 = 80;
|
||||
@VintfStability
|
||||
interface IHalSoundDoseCallback {
|
||||
oneway void onMomentaryExposureWarning(float currentDbA, in android.media.audio.common.AudioDevice audioDevice);
|
||||
oneway void onNewMelValues(in android.hardware.audio.core.ISoundDose.IHalSoundDoseCallback.MelRecord melRecord, in android.media.audio.common.AudioDevice audioDevice);
|
||||
@VintfStability
|
||||
parcelable MelRecord {
|
||||
float[] melValues;
|
||||
long timestamp;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -43,7 +43,7 @@ interface IStreamIn {
|
||||
void updateMetadata(in android.hardware.audio.common.SinkMetadata sinkMetadata);
|
||||
float[] getHwGain();
|
||||
void setHwGain(in float[] channelGains);
|
||||
const int MIC_FIELD_DIMENSION_WIDE_ANGLE = -1;
|
||||
const int MIC_FIELD_DIMENSION_WIDE_ANGLE = (-1);
|
||||
const int MIC_FIELD_DIMENSION_NO_ZOOM = 0;
|
||||
const int MIC_FIELD_DIMENSION_MAX_ZOOM = 1;
|
||||
const int HW_GAIN_MIN = 0;
|
||||
|
||||
@@ -37,15 +37,15 @@ parcelable MicrophoneInfo {
|
||||
@utf8InCpp String id;
|
||||
android.media.audio.common.AudioDevice device;
|
||||
android.hardware.audio.core.MicrophoneInfo.Location location = android.hardware.audio.core.MicrophoneInfo.Location.UNKNOWN;
|
||||
int group = -1;
|
||||
int indexInTheGroup = -1;
|
||||
int group = GROUP_UNKNOWN;
|
||||
int indexInTheGroup = INDEX_IN_THE_GROUP_UNKNOWN;
|
||||
@nullable android.hardware.audio.core.MicrophoneInfo.Sensitivity sensitivity;
|
||||
android.hardware.audio.core.MicrophoneInfo.Directionality directionality = android.hardware.audio.core.MicrophoneInfo.Directionality.UNKNOWN;
|
||||
android.hardware.audio.core.MicrophoneInfo.FrequencyResponsePoint[] frequencyResponse;
|
||||
@nullable android.hardware.audio.core.MicrophoneInfo.Coordinate position;
|
||||
@nullable android.hardware.audio.core.MicrophoneInfo.Coordinate orientation;
|
||||
const int GROUP_UNKNOWN = -1;
|
||||
const int INDEX_IN_THE_GROUP_UNKNOWN = -1;
|
||||
const int GROUP_UNKNOWN = (-1);
|
||||
const int INDEX_IN_THE_GROUP_UNKNOWN = (-1);
|
||||
@Backing(type="int") @VintfStability
|
||||
enum Location {
|
||||
UNKNOWN = 0,
|
||||
|
||||
@@ -39,12 +39,12 @@ parcelable StreamDescriptor {
|
||||
int frameSizeBytes;
|
||||
long bufferSizeFrames;
|
||||
android.hardware.audio.core.StreamDescriptor.AudioBuffer audio;
|
||||
const int LATENCY_UNKNOWN = -1;
|
||||
const int LATENCY_UNKNOWN = (-1);
|
||||
@FixedSize @VintfStability
|
||||
parcelable Position {
|
||||
long frames = -1;
|
||||
long timeNs = -1;
|
||||
const long UNKNOWN = -1;
|
||||
long frames = UNKNOWN;
|
||||
long timeNs = UNKNOWN;
|
||||
const long UNKNOWN = (-1);
|
||||
}
|
||||
@Backing(type="int") @VintfStability
|
||||
enum State {
|
||||
|
||||
@@ -21,7 +21,6 @@ import android.hardware.audio.common.SourceMetadata;
|
||||
import android.hardware.audio.core.AudioMode;
|
||||
import android.hardware.audio.core.AudioPatch;
|
||||
import android.hardware.audio.core.AudioRoute;
|
||||
import android.hardware.audio.core.ISoundDose;
|
||||
import android.hardware.audio.core.IStreamCallback;
|
||||
import android.hardware.audio.core.IStreamIn;
|
||||
import android.hardware.audio.core.IStreamOut;
|
||||
@@ -31,6 +30,7 @@ import android.hardware.audio.core.MicrophoneInfo;
|
||||
import android.hardware.audio.core.ModuleDebug;
|
||||
import android.hardware.audio.core.StreamDescriptor;
|
||||
import android.hardware.audio.core.VendorParameter;
|
||||
import android.hardware.audio.core.sounddose.ISoundDose;
|
||||
import android.hardware.audio.effect.IEffect;
|
||||
import android.media.audio.common.AudioOffloadInfo;
|
||||
import android.media.audio.common.AudioPort;
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package android.hardware.audio.core;
|
||||
package android.hardware.audio.core.sounddose;
|
||||
|
||||
import android.media.audio.common.AudioDevice;
|
||||
|
||||
@@ -95,6 +95,7 @@ cc_binary {
|
||||
defaults: [
|
||||
"aidlaudioservice_defaults",
|
||||
"latest_android_media_audio_common_types_ndk_shared",
|
||||
"latest_android_hardware_audio_core_sounddose_ndk_shared",
|
||||
"latest_android_hardware_audio_core_ndk_shared",
|
||||
],
|
||||
static_libs: [
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
|
||||
using aidl::android::hardware::audio::common::SinkMetadata;
|
||||
using aidl::android::hardware::audio::common::SourceMetadata;
|
||||
using aidl::android::hardware::audio::core::sounddose::ISoundDose;
|
||||
using aidl::android::media::audio::common::AudioChannelLayout;
|
||||
using aidl::android::media::audio::common::AudioDevice;
|
||||
using aidl::android::media::audio::common::AudioFormatDescription;
|
||||
@@ -946,7 +947,7 @@ ndk::ScopedAStatus Module::updateScreenState(bool in_isTurnedOn) {
|
||||
|
||||
ndk::ScopedAStatus Module::getSoundDose(std::shared_ptr<ISoundDose>* _aidl_return) {
|
||||
if (mSoundDose == nullptr) {
|
||||
mSoundDose = ndk::SharedRefBase::make<SoundDose>();
|
||||
mSoundDose = ndk::SharedRefBase::make<sounddose::SoundDose>();
|
||||
mSoundDoseBinder = mSoundDose->asBinder();
|
||||
AIBinder_setMinSchedulerPolicy(mSoundDoseBinder.get(), SCHED_NORMAL,
|
||||
ANDROID_PRIORITY_AUDIO);
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
|
||||
#include <android-base/logging.h>
|
||||
|
||||
namespace aidl::android::hardware::audio::core {
|
||||
namespace aidl::android::hardware::audio::core::sounddose {
|
||||
|
||||
ndk::ScopedAStatus SoundDose::setOutputRs2(float in_rs2ValueDbA) {
|
||||
if (in_rs2ValueDbA < MIN_RS2 || in_rs2ValueDbA > DEFAULT_MAX_RS2) {
|
||||
@@ -54,4 +54,4 @@ ndk::ScopedAStatus SoundDose::registerSoundDoseCallback(
|
||||
return ndk::ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
} // namespace aidl::android::hardware::audio::core
|
||||
} // namespace aidl::android::hardware::audio::core::sounddose
|
||||
|
||||
@@ -88,7 +88,7 @@ class Module : public BnModule {
|
||||
ndk::ScopedAStatus updateScreenRotation(
|
||||
::aidl::android::hardware::audio::core::IModule::ScreenRotation in_rotation) override;
|
||||
ndk::ScopedAStatus updateScreenState(bool in_isTurnedOn) override;
|
||||
ndk::ScopedAStatus getSoundDose(std::shared_ptr<ISoundDose>* _aidl_return) override;
|
||||
ndk::ScopedAStatus getSoundDose(std::shared_ptr<sounddose::ISoundDose>* _aidl_return) override;
|
||||
ndk::ScopedAStatus generateHwAvSyncId(int32_t* _aidl_return) override;
|
||||
ndk::ScopedAStatus getVendorParameters(const std::vector<std::string>& in_ids,
|
||||
std::vector<VendorParameter>* _aidl_return) override;
|
||||
@@ -140,7 +140,7 @@ class Module : public BnModule {
|
||||
bool mMasterMute = false;
|
||||
float mMasterVolume = 1.0f;
|
||||
bool mMicMute = false;
|
||||
std::shared_ptr<ISoundDose> mSoundDose;
|
||||
std::shared_ptr<sounddose::ISoundDose> mSoundDose;
|
||||
ndk::SpAIBinder mSoundDoseBinder;
|
||||
};
|
||||
|
||||
|
||||
@@ -18,12 +18,12 @@
|
||||
|
||||
#include <mutex>
|
||||
|
||||
#include <aidl/android/hardware/audio/core/BnSoundDose.h>
|
||||
#include <aidl/android/hardware/audio/core/sounddose/BnSoundDose.h>
|
||||
#include <aidl/android/media/audio/common/AudioDevice.h>
|
||||
|
||||
using aidl::android::media::audio::common::AudioDevice;
|
||||
|
||||
namespace aidl::android::hardware::audio::core {
|
||||
namespace aidl::android::hardware::audio::core::sounddose {
|
||||
|
||||
class SoundDose : public BnSoundDose {
|
||||
public:
|
||||
@@ -39,4 +39,4 @@ class SoundDose : public BnSoundDose {
|
||||
float mRs2Value;
|
||||
};
|
||||
|
||||
} // namespace aidl::android::hardware::audio::core
|
||||
} // namespace aidl::android::hardware::audio::core::sounddose
|
||||
|
||||
@@ -34,5 +34,5 @@
|
||||
package android.hardware.audio.sounddose;
|
||||
@VintfStability
|
||||
interface ISoundDoseFactory {
|
||||
@nullable android.hardware.audio.core.ISoundDose getSoundDose(in @utf8InCpp String module);
|
||||
@nullable android.hardware.audio.core.sounddose.ISoundDose getSoundDose(in @utf8InCpp String module);
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
package android.hardware.audio.sounddose;
|
||||
|
||||
import android.hardware.audio.core.ISoundDose;
|
||||
import android.hardware.audio.core.sounddose.ISoundDose;
|
||||
|
||||
/**
|
||||
* This interface is used to provide an easy way to implement the ISoundDose interface
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
|
||||
namespace aidl::android::hardware::audio::sounddose {
|
||||
|
||||
using ::aidl::android::hardware::audio::core::SoundDose;
|
||||
using ::aidl::android::hardware::audio::core::sounddose::SoundDose;
|
||||
|
||||
ndk::ScopedAStatus SoundDoseFactory::getSoundDose(const std::string& in_module,
|
||||
std::shared_ptr<ISoundDose>* _aidl_return) {
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <aidl/android/hardware/audio/core/ISoundDose.h>
|
||||
#include <aidl/android/hardware/audio/core/sounddose/ISoundDose.h>
|
||||
#include <aidl/android/hardware/audio/sounddose/BnSoundDoseFactory.h>
|
||||
#include <android/binder_interface_utils.h>
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
|
||||
namespace aidl::android::hardware::audio::sounddose {
|
||||
|
||||
using ::aidl::android::hardware::audio::core::ISoundDose;
|
||||
using ::aidl::android::hardware::audio::core::sounddose::ISoundDose;
|
||||
|
||||
class SoundDoseFactory : public BnSoundDoseFactory {
|
||||
public:
|
||||
|
||||
@@ -47,7 +47,7 @@ inline ::testing::AssertionResult assertIsOk(const char* expr, const ::ndk::Scop
|
||||
|
||||
using namespace android;
|
||||
|
||||
using aidl::android::hardware::audio::core::ISoundDose;
|
||||
using aidl::android::hardware::audio::core::sounddose::ISoundDose;
|
||||
using aidl::android::hardware::audio::sounddose::ISoundDoseFactory;
|
||||
|
||||
class SoundDoseFactory : public testing::TestWithParam<std::string> {
|
||||
|
||||
@@ -44,6 +44,7 @@ cc_test {
|
||||
defaults: [
|
||||
"VtsHalAudioTargetTestDefaults",
|
||||
"latest_android_hardware_audio_core_ndk_static",
|
||||
"latest_android_hardware_audio_core_sounddose_ndk_static",
|
||||
],
|
||||
shared_libs: [
|
||||
"libcutils",
|
||||
|
||||
@@ -36,8 +36,8 @@
|
||||
#include <aidl/Vintf.h>
|
||||
#include <aidl/android/hardware/audio/core/BnStreamCallback.h>
|
||||
#include <aidl/android/hardware/audio/core/IModule.h>
|
||||
#include <aidl/android/hardware/audio/core/ISoundDose.h>
|
||||
#include <aidl/android/hardware/audio/core/ITelephony.h>
|
||||
#include <aidl/android/hardware/audio/core/sounddose/ISoundDose.h>
|
||||
#include <aidl/android/media/audio/common/AudioIoFlags.h>
|
||||
#include <aidl/android/media/audio/common/AudioOutputFlags.h>
|
||||
#include <android-base/chrono_utils.h>
|
||||
@@ -57,7 +57,6 @@ using aidl::android::hardware::audio::core::AudioMode;
|
||||
using aidl::android::hardware::audio::core::AudioPatch;
|
||||
using aidl::android::hardware::audio::core::AudioRoute;
|
||||
using aidl::android::hardware::audio::core::IModule;
|
||||
using aidl::android::hardware::audio::core::ISoundDose;
|
||||
using aidl::android::hardware::audio::core::IStreamCommon;
|
||||
using aidl::android::hardware::audio::core::IStreamIn;
|
||||
using aidl::android::hardware::audio::core::IStreamOut;
|
||||
@@ -67,6 +66,7 @@ using aidl::android::hardware::audio::core::MicrophoneInfo;
|
||||
using aidl::android::hardware::audio::core::ModuleDebug;
|
||||
using aidl::android::hardware::audio::core::StreamDescriptor;
|
||||
using aidl::android::hardware::audio::core::VendorParameter;
|
||||
using aidl::android::hardware::audio::core::sounddose::ISoundDose;
|
||||
using aidl::android::hardware::common::fmq::SynchronizedReadWrite;
|
||||
using aidl::android::media::audio::common::AudioContentType;
|
||||
using aidl::android::media::audio::common::AudioDevice;
|
||||
|
||||
@@ -52,6 +52,7 @@ bool ShouldCheckMissingHalsInFcm(const std::string& package) {
|
||||
"android.hardware.radio.config@1.2",
|
||||
// AIDL
|
||||
"android.hardware.audio.common",
|
||||
"android.hardware.audio.core.sounddose",
|
||||
"android.hardware.biometrics.common",
|
||||
"android.hardware.camera.metadata",
|
||||
"android.hardware.camera.device",
|
||||
|
||||
Reference in New Issue
Block a user