1 /*
2  * Copyright (C) 2015 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 #pragma once
18 
19 #include <system/audio.h>
20 #include <Volume.h>
21 #include <utils/Errors.h>
22 
23 namespace android {
24 
25 class IVolumeCurvesCollection
26 {
27 public:
28     virtual ~IVolumeCurvesCollection() = default;
29 
30     virtual void clearCurrentVolumeIndex(audio_stream_type_t stream) = 0;
31     virtual void addCurrentVolumeIndex(audio_stream_type_t stream, audio_devices_t device,
32                                        int index) = 0;
33     virtual bool canBeMuted(audio_stream_type_t stream) = 0;
34     virtual int getVolumeIndexMin(audio_stream_type_t stream) const = 0;
35     virtual int getVolumeIndex(audio_stream_type_t stream, audio_devices_t device) = 0;
36     virtual int getVolumeIndexMax(audio_stream_type_t stream) const = 0;
37     virtual float volIndexToDb(audio_stream_type_t stream, device_category device,
38                                int indexInUi) const = 0;
39     virtual status_t initStreamVolume(audio_stream_type_t stream, int indexMin, int indexMax) = 0;
40 
initializeVolumeCurves(bool)41     virtual void initializeVolumeCurves(bool /*isSpeakerDrcEnabled*/) {}
42     virtual void switchVolumeCurve(audio_stream_type_t src, audio_stream_type_t dst) = 0;
restoreOriginVolumeCurve(audio_stream_type_t stream)43     virtual void restoreOriginVolumeCurve(audio_stream_type_t stream)
44     {
45         switchVolumeCurve(stream, stream);
46     }
47     virtual bool hasVolumeIndexForDevice(audio_stream_type_t stream,
48                                          audio_devices_t device) const = 0;
49 
50     virtual status_t dump(int fd) const = 0;
51 };
52 
53 } // namespace android
54