2 * Copyright (C) 2011 The Android Open Source Project
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
18 #ifndef ANDROID_AUDIO_POLICY_CORE_H
19 #define ANDROID_AUDIO_POLICY_CORE_H
22 #include <sys/cdefs.h>
23 #include <sys/types.h>
25 #include <cutils/bitops.h>
29 /* The enums were moved here mostly from
30 * frameworks/base/include/media/AudioSystem.h
33 /* device categories used for audio_policy->set_force_use()
34 * These must match the values in AudioSystem.java
37 AUDIO_POLICY_FORCE_NONE,
38 AUDIO_POLICY_FORCE_SPEAKER,
39 AUDIO_POLICY_FORCE_HEADPHONES,
40 AUDIO_POLICY_FORCE_BT_SCO,
41 AUDIO_POLICY_FORCE_BT_A2DP,
42 AUDIO_POLICY_FORCE_WIRED_ACCESSORY,
43 AUDIO_POLICY_FORCE_BT_CAR_DOCK,
44 AUDIO_POLICY_FORCE_BT_DESK_DOCK,
45 AUDIO_POLICY_FORCE_ANALOG_DOCK,
46 AUDIO_POLICY_FORCE_DIGITAL_DOCK,
47 AUDIO_POLICY_FORCE_NO_BT_A2DP, /* A2DP sink is not preferred to speaker or wired HS */
48 AUDIO_POLICY_FORCE_SYSTEM_ENFORCED,
49 AUDIO_POLICY_FORCE_HDMI_SYSTEM_AUDIO_ENFORCED,
50 AUDIO_POLICY_FORCE_ENCODED_SURROUND_NEVER,
51 AUDIO_POLICY_FORCE_ENCODED_SURROUND_ALWAYS,
52 AUDIO_POLICY_FORCE_ENCODED_SURROUND_MANUAL,
54 AUDIO_POLICY_FORCE_CFG_CNT,
55 AUDIO_POLICY_FORCE_CFG_MAX = AUDIO_POLICY_FORCE_CFG_CNT - 1,
57 AUDIO_POLICY_FORCE_DEFAULT = AUDIO_POLICY_FORCE_NONE,
58 } audio_policy_forced_cfg_t;
60 /* usages used for audio_policy->set_force_use()
61 * These must match the values in AudioSystem.java
64 AUDIO_POLICY_FORCE_FOR_COMMUNICATION,
65 AUDIO_POLICY_FORCE_FOR_MEDIA,
66 AUDIO_POLICY_FORCE_FOR_RECORD,
67 AUDIO_POLICY_FORCE_FOR_DOCK,
68 AUDIO_POLICY_FORCE_FOR_SYSTEM,
69 AUDIO_POLICY_FORCE_FOR_HDMI_SYSTEM_AUDIO,
70 AUDIO_POLICY_FORCE_FOR_ENCODED_SURROUND,
71 AUDIO_POLICY_FORCE_FOR_VIBRATE_RINGING,
73 AUDIO_POLICY_FORCE_USE_CNT,
74 AUDIO_POLICY_FORCE_USE_MAX = AUDIO_POLICY_FORCE_USE_CNT - 1,
75 } audio_policy_force_use_t;
77 /* device connection states used for audio_policy->set_device_connection_state()
80 AUDIO_POLICY_DEVICE_STATE_UNAVAILABLE,
81 AUDIO_POLICY_DEVICE_STATE_AVAILABLE,
83 AUDIO_POLICY_DEVICE_STATE_CNT,
84 AUDIO_POLICY_DEVICE_STATE_MAX = AUDIO_POLICY_DEVICE_STATE_CNT - 1,
85 } audio_policy_dev_state_t;
88 /* Used to generate a tone to notify the user of a
89 * notification/alarm/ringtone while they are in a call. */
90 AUDIO_POLICY_TONE_IN_CALL_NOTIFICATION = 0,
92 AUDIO_POLICY_TONE_CNT,
93 AUDIO_POLICY_TONE_MAX = AUDIO_POLICY_TONE_CNT - 1,
94 } audio_policy_tone_t;
97 static inline bool audio_is_low_visibility(audio_stream_type_t stream)
100 case AUDIO_STREAM_SYSTEM:
101 case AUDIO_STREAM_NOTIFICATION:
102 case AUDIO_STREAM_RING:
112 #endif // ANDROID_AUDIO_POLICY_CORE_H