• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2019 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 #ifndef ANDROID_LAST_REMOVABLE_MEDIA_DEVICES_H
18 #define ANDROID_LAST_REMOVABLE_MEDIA_DEVICES_H
19 
20 #include <vector>
21 #include <HwModule.h>
22 #include <system/audio_policy.h>
23 
24 namespace android {
25 
26 typedef enum {
27     GROUP_NONE = -1,
28     GROUP_WIRED,
29     GROUP_BT_A2DP,
30     NUM_GROUP
31 } device_out_group_t;
32 
33 class LastRemovableMediaDevices
34 {
35 public:
36     void setRemovableMediaDevices(sp<DeviceDescriptor> desc, audio_policy_dev_state_t state);
37     std::vector<audio_devices_t> getLastRemovableMediaDevices(
38             device_out_group_t group = GROUP_NONE) const;
39     sp<DeviceDescriptor> getLastRemovableMediaDevice(
40             const DeviceVector& excludedDevices, device_out_group_t group = GROUP_NONE) const;
41 
42 private:
43     struct DeviceGroupDescriptor {
44         sp<DeviceDescriptor> desc;
45         device_out_group_t group;
46     };
47     std::vector<DeviceGroupDescriptor> mMediaDevices;
48 
49     device_out_group_t getDeviceOutGroup(audio_devices_t device) const;
50 };
51 
52 } // namespace android
53 
54 #endif // ANDROID_LAST_REMOVABLE_MEDIA_DEVICES_H
55