1 /* 2 * Copyright (c) 2023 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef ST_AUDIO_POLICY_CLIENT_PROXY_H 17 #define ST_AUDIO_POLICY_CLIENT_PROXY_H 18 19 #include "audio_interrupt_info.h" 20 #include "audio_interrupt_callback.h" 21 #include "audio_policy_client.h" 22 23 namespace OHOS { 24 namespace AudioStandard { 25 class AudioPolicyClientProxy : public IRemoteProxy<IAudioPolicyClient> { 26 public: 27 AudioPolicyClientProxy(const sptr<IRemoteObject> &impl); 28 virtual ~AudioPolicyClientProxy(); 29 int32_t RegisterPolicyCallbackClient(const sptr<IRemoteObject> &object); 30 void UnregisterPolicyCallbackClient(); 31 32 void OnVolumeKeyEvent(VolumeEvent volumeEvent) override; 33 void OnAudioFocusInfoChange(const std::list<std::pair<AudioInterrupt, AudioFocuState>> &focusInfoList) override; 34 void OnAudioFocusRequested(const AudioInterrupt &requestFocus) override; 35 void OnAudioFocusAbandoned(const AudioInterrupt &abandonFocus) override; 36 void OnDeviceChange(const DeviceChangeAction &deviceChangeAction) override; 37 void OnRingerModeUpdated(const AudioRingerMode &ringerMode) override; 38 void OnMicrophoneBlocked(const MicrophoneBlockedInfo µphoneBlockedInfo) override; 39 void OnMicStateUpdated(const MicStateChangeEvent &micStateChangeEvent) override; 40 void OnPreferredOutputDeviceUpdated(const std::vector<sptr<AudioDeviceDescriptor>> &desc) override; 41 void OnPreferredInputDeviceUpdated(const std::vector<sptr<AudioDeviceDescriptor>> &desc) override; 42 void OnRendererStateChange( 43 std::vector<std::unique_ptr<AudioRendererChangeInfo>> &audioRendererChangeInfos) override; 44 void OnCapturerStateChange( 45 std::vector<std::unique_ptr<AudioCapturerChangeInfo>> &audioCapturerChangeInfos) override; 46 void OnRendererDeviceChange(const uint32_t sessionId, 47 const DeviceInfo &deviceInfo, const AudioStreamDeviceChangeReasonExt reason) override; 48 void OnRecreateRendererStreamEvent(const uint32_t sessionId, const int32_t streamFlag, 49 const AudioStreamDeviceChangeReasonExt) override; 50 void OnRecreateCapturerStreamEvent(const uint32_t sessionId, const int32_t streamFlag, 51 const AudioStreamDeviceChangeReasonExt) override; 52 void OnHeadTrackingDeviceChange(const std::unordered_map<std::string, bool> &changeInfo) override; 53 void OnSpatializationEnabledChange(const bool &enabled) override; 54 void OnSpatializationEnabledChangeForAnyDevice(const sptr<AudioDeviceDescriptor> &deviceDescriptor, 55 const bool &enabled) override; 56 void OnHeadTrackingEnabledChange(const bool &enabled) override; 57 void OnHeadTrackingEnabledChangeForAnyDevice(const sptr<AudioDeviceDescriptor> &deviceDescriptor, 58 const bool &enabled) override; 59 void OnAudioSessionDeactive(const AudioSessionDeactiveEvent &deactiveEvent) override; 60 61 private: 62 static inline BrokerDelegator<AudioPolicyClientProxy> delegator_; 63 }; 64 } // namespace AudioStandard 65 } // namespace OHOS 66 #endif // ST_AUDIO_POLICY_CLIENT_PROXY_H 67