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 <android/media/AudioVolumeGroup.h> 21 #include <media/AidlConversionUtil.h> 22 #include <media/AudioProductStrategy.h> 23 #include <system/audio.h> 24 #include <system/audio_policy.h> 25 #include <binder/Parcelable.h> 26 27 namespace android { 28 29 class AudioVolumeGroup : public Parcelable 30 { 31 public: AudioVolumeGroup()32 AudioVolumeGroup() {} AudioVolumeGroup(const std::string & name,volume_group_t group,const AttributesVector & attributes,const StreamTypeVector & streams)33 AudioVolumeGroup(const std::string &name, 34 volume_group_t group, 35 const AttributesVector &attributes, 36 const StreamTypeVector &streams) : 37 mName(name), mGroupId(group), mAudioAttributes(attributes), mStreams(streams) {} 38 getName()39 const std::string &getName() const { return mName; } getId()40 volume_group_t getId() const { return mGroupId; } getAudioAttributes()41 AttributesVector getAudioAttributes() const { return mAudioAttributes; } getStreamTypes()42 StreamTypeVector getStreamTypes() const { return mStreams; } 43 44 status_t readFromParcel(const Parcel *parcel) override; 45 status_t writeToParcel(Parcel *parcel) const override; 46 47 private: 48 std::string mName; 49 volume_group_t mGroupId = VOLUME_GROUP_NONE; 50 AttributesVector mAudioAttributes; 51 StreamTypeVector mStreams; 52 }; 53 54 using AudioVolumeGroupVector = std::vector<AudioVolumeGroup>; 55 56 // AIDL conversion routines. 57 ConversionResult<media::AudioVolumeGroup> 58 legacy2aidl_AudioVolumeGroup(const AudioVolumeGroup& legacy); 59 ConversionResult<AudioVolumeGroup> 60 aidl2legacy_AudioVolumeGroup(const media::AudioVolumeGroup& aidl); 61 62 } // namespace android 63