1 /* 2 * Copyright (C) 2024 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at: 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 * 16 */ 17 #include <aidl/android/hardware/audio/core/BnModule.h> 18 19 using namespace aidl::android::media::audio::common; 20 using namespace aidl::android::hardware::audio::core; 21 using namespace aidl::android::hardware::audio::core::sounddose; 22 using namespace aidl::android::hardware::audio::effect; 23 24 namespace aidl::android::hardware::audio::core { 25 26 class ModuleMock : public BnModule { 27 public: 28 ModuleMock(); 29 30 private: 31 ndk::ScopedAStatus getTelephony(std::shared_ptr<ITelephony>*) override; 32 ndk::ScopedAStatus getBluetooth(std::shared_ptr<IBluetooth>*) override; 33 ndk::ScopedAStatus getBluetoothA2dp(std::shared_ptr<IBluetoothA2dp>*) override; 34 ndk::ScopedAStatus getBluetoothLe(std::shared_ptr<IBluetoothLe>*) override; 35 ndk::ScopedAStatus openInputStream(const OpenInputStreamArguments&, 36 OpenInputStreamReturn*) override; 37 ndk::ScopedAStatus openOutputStream(const OpenOutputStreamArguments&, 38 OpenOutputStreamReturn*) override; 39 ndk::ScopedAStatus getMasterMute(bool*) override; 40 ndk::ScopedAStatus setMasterMute(bool) override; 41 ndk::ScopedAStatus getMasterVolume(float*) override; 42 ndk::ScopedAStatus setMasterVolume(float) override; 43 ndk::ScopedAStatus getMicMute(bool*) override; 44 ndk::ScopedAStatus setMicMute(bool) override; 45 ndk::ScopedAStatus getSoundDose(std::shared_ptr<ISoundDose>*) override; 46 ndk::ScopedAStatus getMmapPolicyInfos(AudioMMapPolicyType, 47 std::vector<AudioMMapPolicyInfo>*) override; 48 ndk::ScopedAStatus supportsVariableLatency(bool*) override; 49 setModuleDebug(const ModuleDebug &)50 ndk::ScopedAStatus setModuleDebug(const ModuleDebug&) override { 51 return ndk::ScopedAStatus::ok(); 52 } connectExternalDevice(const AudioPort &,AudioPort *)53 ndk::ScopedAStatus connectExternalDevice(const AudioPort&, AudioPort*) override { 54 return ndk::ScopedAStatus::ok(); 55 } disconnectExternalDevice(int32_t)56 ndk::ScopedAStatus disconnectExternalDevice(int32_t) override { 57 return ndk::ScopedAStatus::ok(); 58 } getAudioPatches(std::vector<AudioPatch> *)59 ndk::ScopedAStatus getAudioPatches(std::vector<AudioPatch>*) override { 60 return ndk::ScopedAStatus::ok(); 61 } getAudioPort(int32_t,AudioPort *)62 ndk::ScopedAStatus getAudioPort(int32_t, AudioPort*) override { 63 return ndk::ScopedAStatus::ok(); 64 } getAudioPortConfigs(std::vector<AudioPortConfig> *)65 ndk::ScopedAStatus getAudioPortConfigs(std::vector<AudioPortConfig>*) override { 66 return ndk::ScopedAStatus::ok(); 67 } getAudioPorts(std::vector<AudioPort> *)68 ndk::ScopedAStatus getAudioPorts(std::vector<AudioPort>*) override { 69 return ndk::ScopedAStatus::ok(); 70 } getAudioRoutes(std::vector<AudioRoute> *)71 ndk::ScopedAStatus getAudioRoutes(std::vector<AudioRoute>*) override { 72 return ndk::ScopedAStatus::ok(); 73 } getAudioRoutesForAudioPort(int32_t,std::vector<AudioRoute> *)74 ndk::ScopedAStatus getAudioRoutesForAudioPort(int32_t, std::vector<AudioRoute>*) override { 75 return ndk::ScopedAStatus::ok(); 76 } getSupportedPlaybackRateFactors(SupportedPlaybackRateFactors *)77 ndk::ScopedAStatus getSupportedPlaybackRateFactors(SupportedPlaybackRateFactors*) override { 78 return ndk::ScopedAStatus::ok(); 79 } setAudioPatch(const AudioPatch &,AudioPatch *)80 ndk::ScopedAStatus setAudioPatch(const AudioPatch&, AudioPatch*) override { 81 return ndk::ScopedAStatus::ok(); 82 } setAudioPortConfig(const AudioPortConfig &,AudioPortConfig *,bool *)83 ndk::ScopedAStatus setAudioPortConfig(const AudioPortConfig&, AudioPortConfig*, 84 bool*) override { 85 return ndk::ScopedAStatus::ok(); 86 } resetAudioPatch(int32_t)87 ndk::ScopedAStatus resetAudioPatch(int32_t) override { return ndk::ScopedAStatus::ok(); } resetAudioPortConfig(int32_t)88 ndk::ScopedAStatus resetAudioPortConfig(int32_t) override { return ndk::ScopedAStatus::ok(); } getMicrophones(std::vector<MicrophoneInfo> *)89 ndk::ScopedAStatus getMicrophones(std::vector<MicrophoneInfo>*) override { 90 return ndk::ScopedAStatus::ok(); 91 } updateAudioMode(AudioMode)92 ndk::ScopedAStatus updateAudioMode(AudioMode) override { return ndk::ScopedAStatus::ok(); } updateScreenRotation(ScreenRotation)93 ndk::ScopedAStatus updateScreenRotation(ScreenRotation) override { 94 return ndk::ScopedAStatus::ok(); 95 } updateScreenState(bool)96 ndk::ScopedAStatus updateScreenState(bool) override { return ndk::ScopedAStatus::ok(); } generateHwAvSyncId(int32_t *)97 ndk::ScopedAStatus generateHwAvSyncId(int32_t*) override { 98 return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION); 99 } getVendorParameters(const std::vector<std::string> &,std::vector<VendorParameter> *)100 ndk::ScopedAStatus getVendorParameters(const std::vector<std::string>&, 101 std::vector<VendorParameter>*) override { 102 return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION); 103 } setVendorParameters(const std::vector<VendorParameter> &,bool)104 ndk::ScopedAStatus setVendorParameters(const std::vector<VendorParameter>&, bool) override { 105 return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION); 106 } addDeviceEffect(int32_t,const std::shared_ptr<IEffect> &)107 ndk::ScopedAStatus addDeviceEffect(int32_t, const std::shared_ptr<IEffect>&) override { 108 return ndk::ScopedAStatus::ok(); 109 } removeDeviceEffect(int32_t,const std::shared_ptr<IEffect> &)110 ndk::ScopedAStatus removeDeviceEffect(int32_t, const std::shared_ptr<IEffect>&) override { 111 return ndk::ScopedAStatus::ok(); 112 } getAAudioMixerBurstCount(int32_t *)113 ndk::ScopedAStatus getAAudioMixerBurstCount(int32_t*) override { 114 return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION); 115 } getAAudioHardwareBurstMinUsec(int32_t *)116 ndk::ScopedAStatus getAAudioHardwareBurstMinUsec(int32_t*) override { 117 return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION); 118 } prepareToDisconnectExternalDevice(int32_t)119 ndk::ScopedAStatus prepareToDisconnectExternalDevice(int32_t) override { 120 return ndk::ScopedAStatus::ok(); 121 } 122 123 AudioPortExt createDeviceExt(AudioDeviceType devType, int32_t flags); 124 AudioPort createPort(int32_t id, const std::string& name, int32_t flags, bool isInput, 125 const AudioPortExt& ext); 126 127 bool mMasterMute; 128 float mMasterVolume; 129 bool mMicMute; 130 std::vector<AudioPort> mPorts; 131 }; 132 133 } // namespace aidl::android::hardware::audio::core 134