blob: cca9c44004476aff52459af23c7776464ce67450 [file] [log] [blame]
Hayden Gomesaeeb9b02020-10-27 13:08:34 -07001/*
2 * Copyright (C) 2020 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#ifndef ANDROID_HARDWARE_AUTOMOTIVE_AUDIOCONTROL_AUDIOCONTROL_H
17#define ANDROID_HARDWARE_AUTOMOTIVE_AUDIOCONTROL_AUDIOCONTROL_H
18
19#include <aidl/android/hardware/automotive/audiocontrol/AudioFocusChange.h>
20#include <aidl/android/hardware/automotive/audiocontrol/BnAudioControl.h>
Hayden Gomesad816702020-12-14 15:29:29 -080021#include <aidl/android/hardware/automotive/audiocontrol/DuckingInfo.h>
Oscar Azucenab8e5cd02020-12-16 13:53:14 -080022#include <aidl/android/hardware/automotive/audiocontrol/MutingInfo.h>
Hayden Gomesaeeb9b02020-10-27 13:08:34 -070023
24namespace aidl::android::hardware::automotive::audiocontrol {
25
Hayden Gomesaeeb9b02020-10-27 13:08:34 -070026class AudioControl : public BnAudioControl {
27 public:
28 ndk::ScopedAStatus onAudioFocusChange(const std::string& in_usage, int32_t in_zoneId,
29 AudioFocusChange in_focusChange) override;
Hayden Gomesad816702020-12-14 15:29:29 -080030 ndk::ScopedAStatus onDevicesToDuckChange(
31 const std::vector<DuckingInfo>& in_duckingInfos) override;
Oscar Azucenab8e5cd02020-12-16 13:53:14 -080032 ndk::ScopedAStatus onDevicesToMuteChange(
33 const std::vector<MutingInfo>& in_mutingInfos) override;
Hayden Gomesaeeb9b02020-10-27 13:08:34 -070034 ndk::ScopedAStatus registerFocusListener(
Hayden Gomes6333eed2021-03-25 11:27:59 -070035 const std::shared_ptr<IFocusListener>& in_listener) override;
Hayden Gomesaeeb9b02020-10-27 13:08:34 -070036 ndk::ScopedAStatus setBalanceTowardRight(float in_value) override;
37 ndk::ScopedAStatus setFadeTowardFront(float in_value) override;
38 binder_status_t dump(int fd, const char** args, uint32_t numArgs) override;
39
40 private:
41 // This focus listener will only be used by this HAL instance to communicate with
42 // a single instance of CarAudioService. As such, it doesn't have explicit serialization.
43 // If a different AudioControl implementation were to have multiple threads leveraging this
44 // listener, then it should also include mutexes or make the listener atomic.
Hayden Gomes6333eed2021-03-25 11:27:59 -070045 std::shared_ptr<IFocusListener> mFocusListener;
Hayden Gomesaeeb9b02020-10-27 13:08:34 -070046
47 binder_status_t cmdHelp(int fd) const;
48 binder_status_t cmdRequestFocus(int fd, const char** args, uint32_t numArgs);
49 binder_status_t cmdAbandonFocus(int fd, const char** args, uint32_t numArgs);
50 binder_status_t dumpsys(int fd);
51};
52
53} // namespace aidl::android::hardware::automotive::audiocontrol
54
55#endif // ANDROID_HARDWARE_AUTOMOTIVE_AUDIOCONTROL_AUDIOCONTROL_H