• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #pragma once
18 
19 #include <EngineConfig.h>
20 
21 #include <system/audio.h>
22 
23 namespace android {
24 /**
25  * @brief AudioProductStrategies hard coded array of strategies to fill new engine API contract.
26  */
27 const engineConfig::ProductStrategies gOrderedStrategies = {
28     {"STRATEGY_PHONE",
29      {
30          {AUDIO_STREAM_VOICE_CALL, "AUDIO_STREAM_VOICE_CALL",
31           {{AUDIO_CONTENT_TYPE_UNKNOWN, AUDIO_USAGE_VOICE_COMMUNICATION, AUDIO_SOURCE_DEFAULT,
32             AUDIO_FLAG_NONE, ""}},
33          },
34          {AUDIO_STREAM_BLUETOOTH_SCO, "AUDIO_STREAM_BLUETOOTH_SCO",
35           {{AUDIO_CONTENT_TYPE_UNKNOWN, AUDIO_USAGE_UNKNOWN, AUDIO_SOURCE_DEFAULT, AUDIO_FLAG_SCO,
36             ""}},
37          }
38      },
39     },
40     {"STRATEGY_SONIFICATION",
41      {
42          {AUDIO_STREAM_RING, "AUDIO_STREAM_RING",
43           {{AUDIO_CONTENT_TYPE_UNKNOWN, AUDIO_USAGE_NOTIFICATION_TELEPHONY_RINGTONE,
44             AUDIO_SOURCE_DEFAULT, AUDIO_FLAG_NONE, ""}}
45          },
46          {AUDIO_STREAM_ALARM, "AUDIO_STREAM_ALARM",
47           {{AUDIO_CONTENT_TYPE_UNKNOWN, AUDIO_USAGE_ALARM, AUDIO_SOURCE_DEFAULT,
48             AUDIO_FLAG_NONE, ""}},
49          }
50      },
51     },
52     {"STRATEGY_ENFORCED_AUDIBLE",
53      {
54          {AUDIO_STREAM_ENFORCED_AUDIBLE, "AUDIO_STREAM_ENFORCED_AUDIBLE",
55           {{AUDIO_CONTENT_TYPE_UNKNOWN, AUDIO_USAGE_UNKNOWN, AUDIO_SOURCE_DEFAULT,
56             AUDIO_FLAG_AUDIBILITY_ENFORCED, ""}}
57          }
58      },
59     },
60     {"STRATEGY_ACCESSIBILITY",
61      {
62          {AUDIO_STREAM_ACCESSIBILITY, "AUDIO_STREAM_ACCESSIBILITY",
63           {{AUDIO_CONTENT_TYPE_UNKNOWN, AUDIO_USAGE_ASSISTANCE_ACCESSIBILITY,
64             AUDIO_SOURCE_DEFAULT, AUDIO_FLAG_NONE, ""}}
65          }
66      },
67     },
68     {"STRATEGY_SONIFICATION_RESPECTFUL",
69      {
70          {AUDIO_STREAM_NOTIFICATION, "AUDIO_STREAM_NOTIFICATION",
71           {
72               {AUDIO_CONTENT_TYPE_UNKNOWN, AUDIO_USAGE_NOTIFICATION, AUDIO_SOURCE_DEFAULT,
73                AUDIO_FLAG_NONE, ""},
74               {AUDIO_CONTENT_TYPE_UNKNOWN, AUDIO_USAGE_NOTIFICATION_EVENT,
75                AUDIO_SOURCE_DEFAULT, AUDIO_FLAG_NONE, ""}
76           }
77          }
78      },
79     },
80     {"STRATEGY_MEDIA",
81      {
82          {AUDIO_STREAM_ASSISTANT, "AUDIO_STREAM_ASSISTANT",
83           {{AUDIO_CONTENT_TYPE_SPEECH, AUDIO_USAGE_ASSISTANT,
84             AUDIO_SOURCE_DEFAULT, AUDIO_FLAG_NONE, ""}}
85          },
86          {AUDIO_STREAM_MUSIC, "AUDIO_STREAM_MUSIC",
87           {
88               {AUDIO_CONTENT_TYPE_UNKNOWN, AUDIO_USAGE_MEDIA, AUDIO_SOURCE_DEFAULT,
89                AUDIO_FLAG_NONE, ""},
90               {AUDIO_CONTENT_TYPE_UNKNOWN, AUDIO_USAGE_GAME, AUDIO_SOURCE_DEFAULT,
91                AUDIO_FLAG_NONE, ""},
92               {AUDIO_CONTENT_TYPE_UNKNOWN, AUDIO_USAGE_ASSISTANT, AUDIO_SOURCE_DEFAULT,
93                AUDIO_FLAG_NONE, ""},
94               {AUDIO_CONTENT_TYPE_UNKNOWN, AUDIO_USAGE_ASSISTANCE_NAVIGATION_GUIDANCE,
95                AUDIO_SOURCE_DEFAULT, AUDIO_FLAG_NONE, ""},
96               {AUDIO_CONTENT_TYPE_UNKNOWN, AUDIO_USAGE_UNKNOWN, AUDIO_SOURCE_DEFAULT,
97                AUDIO_FLAG_NONE, ""}
98           },
99          },
100          {AUDIO_STREAM_SYSTEM, "AUDIO_STREAM_SYSTEM",
101           {{AUDIO_CONTENT_TYPE_UNKNOWN, AUDIO_USAGE_ASSISTANCE_SONIFICATION,
102             AUDIO_SOURCE_DEFAULT, AUDIO_FLAG_NONE, ""}}
103          }
104      },
105     },
106     {"STRATEGY_DTMF",
107      {
108          {AUDIO_STREAM_DTMF, "AUDIO_STREAM_DTMF",
109           {
110               {AUDIO_CONTENT_TYPE_UNKNOWN, AUDIO_USAGE_VOICE_COMMUNICATION_SIGNALLING,
111                AUDIO_SOURCE_DEFAULT, AUDIO_FLAG_NONE, ""}
112           }
113          }
114      },
115     },
116     {"STRATEGY_CALL_ASSISTANT",
117      {
118          {AUDIO_STREAM_CALL_ASSISTANT, "AUDIO_STREAM_CALL_ASSISTANT",
119           {{AUDIO_CONTENT_TYPE_UNKNOWN, AUDIO_USAGE_CALL_ASSISTANT, AUDIO_SOURCE_DEFAULT,
120             AUDIO_FLAG_NONE, ""}}
121          }
122      },
123     },
124     {"STRATEGY_TRANSMITTED_THROUGH_SPEAKER",
125      {
126          {AUDIO_STREAM_TTS, "AUDIO_STREAM_TTS",
127           {
128               {AUDIO_CONTENT_TYPE_UNKNOWN, AUDIO_USAGE_UNKNOWN, AUDIO_SOURCE_DEFAULT,
129                 AUDIO_FLAG_BEACON, ""},
130               {AUDIO_CONTENT_TYPE_ULTRASOUND, AUDIO_USAGE_UNKNOWN, AUDIO_SOURCE_DEFAULT,
131                 AUDIO_FLAG_NONE, ""}
132           }
133          }
134      },
135     }
136 };
137 
138 /**
139  * For Internal use of respectively audio policy and audioflinger
140  * For compatibility reason why apm volume config file, volume group name is the stream type.
141  */
142 const engineConfig::ProductStrategies gOrderedSystemStrategies = {
143     {"STRATEGY_REROUTING",
144      {
145          {AUDIO_STREAM_REROUTING, "AUDIO_STREAM_REROUTING",
146           {{AUDIO_CONTENT_TYPE_UNKNOWN, AUDIO_USAGE_VIRTUAL_SOURCE, AUDIO_SOURCE_DEFAULT,
147             AUDIO_FLAG_NONE, AUDIO_TAG_APM_RESERVED_INTERNAL}}
148          }
149      },
150     },
151     {"STRATEGY_PATCH",
152      {
153          {AUDIO_STREAM_PATCH, "AUDIO_STREAM_PATCH",
154           {{AUDIO_CONTENT_TYPE_UNKNOWN, AUDIO_USAGE_UNKNOWN, AUDIO_SOURCE_DEFAULT,
155             AUDIO_FLAG_NONE, AUDIO_TAG_APM_RESERVED_INTERNAL}}
156          }
157      },
158     }
159 };
160 const engineConfig::VolumeGroups gSystemVolumeGroups = {
161     {"AUDIO_STREAM_REROUTING", 0, 1,
162      {
163          {"DEVICE_CATEGORY_SPEAKER", {{0,0}, {100, 0}}},
164          {"DEVICE_CATEGORY_HEADSET", {{0,0}, {100, 0}}},
165          {"DEVICE_CATEGORY_EARPIECE", {{0,0}, {100, 0}}},
166          {"DEVICE_CATEGORY_EXT_MEDIA", {{0,0}, {100, 0}}},
167          {"DEVICE_CATEGORY_HEARING_AID", {{0,0}, {100, 0}}},
168 
169      }
170     },
171     {"AUDIO_STREAM_PATCH", 0, 1,
172      {
173          {"DEVICE_CATEGORY_SPEAKER", {{0,0}, {100, 0}}},
174          {"DEVICE_CATEGORY_HEADSET", {{0,0}, {100, 0}}},
175          {"DEVICE_CATEGORY_EARPIECE", {{0,0}, {100, 0}}},
176          {"DEVICE_CATEGORY_EXT_MEDIA", {{0,0}, {100, 0}}},
177          {"DEVICE_CATEGORY_HEARING_AID", {{0,0}, {100, 0}}},
178 
179      }
180     }
181 };
182 
183 const engineConfig::Config gDefaultEngineConfig = {
184     1.0,
185     gOrderedStrategies,
186     {},
187     {},
188     {}
189 };
190 } // namespace android
191