Loading media/libaudioclient/Android.bp +18 −0 Original line number Diff line number Diff line Loading @@ -451,6 +451,8 @@ aidl_interface { "aidl/android/media/IAudioRecord.aidl", "aidl/android/media/IAudioTrack.aidl", "aidl/android/media/IAudioTrackCallback.aidl", "aidl/android/media/ISoundDoseCallback.aidl", ], imports: [ "android.media.audio.common.types-V2", Loading Loading @@ -542,3 +544,19 @@ aidl_interface { }, }, } aidl_interface { name: "sounddose-aidl", unstable: true, local_include_dir: "aidl", srcs: [ "aidl/android/media/ISoundDoseCallback.aidl", ], double_loadable: true, backend: { java: { sdk_version: "module_current", }, }, } media/libaudioclient/AudioSystem.cpp +9 −0 Original line number Diff line number Diff line Loading @@ -2374,6 +2374,15 @@ status_t AudioSystem::canBeSpatialized(const audio_attributes_t *attr, return OK; } status_t AudioSystem::registerSoundDoseCallback(const sp<media::ISoundDoseCallback>& callback) { const sp<IAudioFlinger>& af = AudioSystem::get_audio_flinger(); if (af == nullptr) { return PERMISSION_DENIED; } return af->registerSoundDoseCallback(callback); } status_t AudioSystem::getDirectPlaybackSupport(const audio_attributes_t *attr, const audio_config_t *config, audio_direct_mode_t* directMode) { Loading media/libaudioclient/IAudioFlinger.cpp +11 −0 Original line number Diff line number Diff line Loading @@ -850,6 +850,11 @@ status_t AudioFlingerClientAdapter::getSupportedLatencyModes( return NO_ERROR; } status_t AudioFlingerClientAdapter::registerSoundDoseCallback( const sp<media::ISoundDoseCallback> &callback) { return statusTFromBinderStatus(mDelegate->registerSoundDoseCallback(callback)); } //////////////////////////////////////////////////////////////////////////////////////////////////// // AudioFlingerServerAdapter AudioFlingerServerAdapter::AudioFlingerServerAdapter( Loading Loading @@ -1370,4 +1375,10 @@ Status AudioFlingerServerAdapter::getSupportedLatencyModes( return Status::ok(); } Status AudioFlingerServerAdapter::registerSoundDoseCallback( const sp<media::ISoundDoseCallback>& callback) { return Status::fromStatusT(mDelegate->registerSoundDoseCallback(callback)); } } // namespace android media/libaudioclient/aidl/android/media/IAudioFlingerService.aidl +4 −0 Original line number Diff line number Diff line Loading @@ -35,6 +35,7 @@ import android.media.EffectDescriptor; import android.media.IAudioFlingerClient; import android.media.IAudioRecord; import android.media.IAudioTrack; import android.media.ISoundDoseCallback; import android.media.LatencyMode; import android.media.MicrophoneInfoData; import android.media.RenderPosition; Loading Loading @@ -246,6 +247,9 @@ interface IAudioFlingerService { */ LatencyMode[] getSupportedLatencyModes(int output); /** Registers the sound dose callback. */ oneway void registerSoundDoseCallback(ISoundDoseCallback callback); // When adding a new method, please review and update // IAudioFlinger.h AudioFlingerServerAdapter::Delegate::TransactionCode // AudioFlinger.cpp AudioFlinger::onTransactWrapper() Loading media/libaudioclient/aidl/android/media/ISoundDoseCallback.aidl 0 → 100644 +26 −0 Original line number Diff line number Diff line /* * Copyright 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. */ package android.media; /** * Interface used to push the sound dose related information from the audio * server to the AudioService#SoundDoseHelper. */ interface ISoundDoseCallback { /** Called whenever the momentary exposure exceeds the RS2 value. */ oneway void onMomentaryExposure(float currentMel, int deviceId); } Loading
media/libaudioclient/Android.bp +18 −0 Original line number Diff line number Diff line Loading @@ -451,6 +451,8 @@ aidl_interface { "aidl/android/media/IAudioRecord.aidl", "aidl/android/media/IAudioTrack.aidl", "aidl/android/media/IAudioTrackCallback.aidl", "aidl/android/media/ISoundDoseCallback.aidl", ], imports: [ "android.media.audio.common.types-V2", Loading Loading @@ -542,3 +544,19 @@ aidl_interface { }, }, } aidl_interface { name: "sounddose-aidl", unstable: true, local_include_dir: "aidl", srcs: [ "aidl/android/media/ISoundDoseCallback.aidl", ], double_loadable: true, backend: { java: { sdk_version: "module_current", }, }, }
media/libaudioclient/AudioSystem.cpp +9 −0 Original line number Diff line number Diff line Loading @@ -2374,6 +2374,15 @@ status_t AudioSystem::canBeSpatialized(const audio_attributes_t *attr, return OK; } status_t AudioSystem::registerSoundDoseCallback(const sp<media::ISoundDoseCallback>& callback) { const sp<IAudioFlinger>& af = AudioSystem::get_audio_flinger(); if (af == nullptr) { return PERMISSION_DENIED; } return af->registerSoundDoseCallback(callback); } status_t AudioSystem::getDirectPlaybackSupport(const audio_attributes_t *attr, const audio_config_t *config, audio_direct_mode_t* directMode) { Loading
media/libaudioclient/IAudioFlinger.cpp +11 −0 Original line number Diff line number Diff line Loading @@ -850,6 +850,11 @@ status_t AudioFlingerClientAdapter::getSupportedLatencyModes( return NO_ERROR; } status_t AudioFlingerClientAdapter::registerSoundDoseCallback( const sp<media::ISoundDoseCallback> &callback) { return statusTFromBinderStatus(mDelegate->registerSoundDoseCallback(callback)); } //////////////////////////////////////////////////////////////////////////////////////////////////// // AudioFlingerServerAdapter AudioFlingerServerAdapter::AudioFlingerServerAdapter( Loading Loading @@ -1370,4 +1375,10 @@ Status AudioFlingerServerAdapter::getSupportedLatencyModes( return Status::ok(); } Status AudioFlingerServerAdapter::registerSoundDoseCallback( const sp<media::ISoundDoseCallback>& callback) { return Status::fromStatusT(mDelegate->registerSoundDoseCallback(callback)); } } // namespace android
media/libaudioclient/aidl/android/media/IAudioFlingerService.aidl +4 −0 Original line number Diff line number Diff line Loading @@ -35,6 +35,7 @@ import android.media.EffectDescriptor; import android.media.IAudioFlingerClient; import android.media.IAudioRecord; import android.media.IAudioTrack; import android.media.ISoundDoseCallback; import android.media.LatencyMode; import android.media.MicrophoneInfoData; import android.media.RenderPosition; Loading Loading @@ -246,6 +247,9 @@ interface IAudioFlingerService { */ LatencyMode[] getSupportedLatencyModes(int output); /** Registers the sound dose callback. */ oneway void registerSoundDoseCallback(ISoundDoseCallback callback); // When adding a new method, please review and update // IAudioFlinger.h AudioFlingerServerAdapter::Delegate::TransactionCode // AudioFlinger.cpp AudioFlinger::onTransactWrapper() Loading
media/libaudioclient/aidl/android/media/ISoundDoseCallback.aidl 0 → 100644 +26 −0 Original line number Diff line number Diff line /* * Copyright 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. */ package android.media; /** * Interface used to push the sound dose related information from the audio * server to the AudioService#SoundDoseHelper. */ interface ISoundDoseCallback { /** Called whenever the momentary exposure exceeds the RS2 value. */ oneway void onMomentaryExposure(float currentMel, int deviceId); }