Home | History | Annotate | Download | only in system
      1 /*
      2  * Copyright (C) 2011 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 #ifndef ANDROID_AUDIO_POLICY_CORE_H
     19 #define ANDROID_AUDIO_POLICY_CORE_H
     20 
     21 #include <stdint.h>
     22 #include <sys/cdefs.h>
     23 #include <sys/types.h>
     24 
     25 #include <cutils/bitops.h>
     26 
     27 __BEGIN_DECLS
     28 
     29 /* The enums were moved here mostly from
     30  * frameworks/base/include/media/AudioSystem.h
     31  */
     32 
     33 /* request to open a direct output with get_output() (by opposition to
     34  * sharing an output with other AudioTracks)
     35  */
     36 typedef enum {
     37     AUDIO_POLICY_OUTPUT_FLAG_INDIRECT = 0x0,
     38     AUDIO_POLICY_OUTPUT_FLAG_DIRECT = 0x1
     39 } audio_policy_output_flags_t;
     40 
     41 /* device categories used for audio_policy->set_force_use() */
     42 typedef enum {
     43     AUDIO_POLICY_FORCE_NONE,
     44     AUDIO_POLICY_FORCE_SPEAKER,
     45     AUDIO_POLICY_FORCE_HEADPHONES,
     46     AUDIO_POLICY_FORCE_BT_SCO,
     47     AUDIO_POLICY_FORCE_BT_A2DP,
     48     AUDIO_POLICY_FORCE_WIRED_ACCESSORY,
     49     AUDIO_POLICY_FORCE_BT_CAR_DOCK,
     50     AUDIO_POLICY_FORCE_BT_DESK_DOCK,
     51     AUDIO_POLICY_FORCE_ANALOG_DOCK,
     52     AUDIO_POLICY_FORCE_DIGITAL_DOCK,
     53 
     54     AUDIO_POLICY_FORCE_CFG_CNT,
     55     AUDIO_POLICY_FORCE_CFG_MAX = AUDIO_POLICY_FORCE_CFG_CNT - 1,
     56 
     57     AUDIO_POLICY_FORCE_DEFAULT = AUDIO_POLICY_FORCE_NONE,
     58 } audio_policy_forced_cfg_t;
     59 
     60 /* usages used for audio_policy->set_force_use() */
     61 typedef enum {
     62     AUDIO_POLICY_FORCE_FOR_COMMUNICATION,
     63     AUDIO_POLICY_FORCE_FOR_MEDIA,
     64     AUDIO_POLICY_FORCE_FOR_RECORD,
     65     AUDIO_POLICY_FORCE_FOR_DOCK,
     66 
     67     AUDIO_POLICY_FORCE_USE_CNT,
     68     AUDIO_POLICY_FORCE_USE_MAX = AUDIO_POLICY_FORCE_USE_CNT - 1,
     69 } audio_policy_force_use_t;
     70 
     71 /* device connection states used for audio_policy->set_device_connection_state()
     72  */
     73 typedef enum {
     74     AUDIO_POLICY_DEVICE_STATE_UNAVAILABLE,
     75     AUDIO_POLICY_DEVICE_STATE_AVAILABLE,
     76 
     77     AUDIO_POLICY_DEVICE_STATE_CNT,
     78     AUDIO_POLICY_DEVICE_STATE_MAX = AUDIO_POLICY_DEVICE_STATE_CNT - 1,
     79 } audio_policy_dev_state_t;
     80 
     81 typedef enum {
     82     /* Used to generate a tone to notify the user of a
     83      * notification/alarm/ringtone while they are in a call. */
     84     AUDIO_POLICY_TONE_IN_CALL_NOTIFICATION = 0,
     85 
     86     AUDIO_POLICY_TONE_CNT,
     87     AUDIO_POLICY_TONE_MAX                  = AUDIO_POLICY_TONE_CNT - 1,
     88 } audio_policy_tone_t;
     89 
     90 
     91 static inline bool audio_is_low_visibility(audio_stream_type_t stream)
     92 {
     93     switch (stream) {
     94     case AUDIO_STREAM_SYSTEM:
     95     case AUDIO_STREAM_NOTIFICATION:
     96     case AUDIO_STREAM_RING:
     97         return true;
     98     default:
     99         return false;
    100     }
    101 }
    102 
    103 
    104 __END_DECLS
    105 
    106 #endif  // ANDROID_AUDIO_POLICY_CORE_H
    107