1 /*
2  * Copyright (C) 2018 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 
18 #pragma once
19 
20 #include <media/AudioProductStrategy.h>
21 #include <system/audio.h>
22 #include <system/audio_policy.h>
23 #include <binder/Parcelable.h>
24 
25 namespace android {
26 
27 class AudioVolumeGroup : public Parcelable
28 {
29 public:
AudioVolumeGroup()30     AudioVolumeGroup() {}
AudioVolumeGroup(const std::string & name,volume_group_t group,const AttributesVector & attributes,const StreamTypeVector & streams)31     AudioVolumeGroup(const std::string &name,
32                      volume_group_t group,
33                      const AttributesVector &attributes,
34                      const StreamTypeVector &streams) :
35         mName(name), mGroupId(group), mAudioAttributes(attributes), mStreams(streams) {}
36 
getName()37     const std::string &getName() const { return mName; }
getId()38     volume_group_t getId() const { return mGroupId; }
getAudioAttributes()39     AttributesVector getAudioAttributes() const { return mAudioAttributes; }
getStreamTypes()40     StreamTypeVector getStreamTypes() const { return mStreams; }
41 
42     status_t readFromParcel(const Parcel *parcel) override;
43     status_t writeToParcel(Parcel *parcel) const override;
44 
45 private:
46     std::string mName;
47     volume_group_t mGroupId = VOLUME_GROUP_NONE;
48     AttributesVector mAudioAttributes;
49     StreamTypeVector mStreams;
50 };
51 
52 using AudioVolumeGroupVector = std::vector<AudioVolumeGroup>;
53 
54 } // namespace android
55