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