Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 80d3e9a8 authored by Mikhail Naganov's avatar Mikhail Naganov Committed by android-build-merger
Browse files

Merge changes I0b8ae921,Ib8bda8ab am: 402fd7c9 am: 7f8a396d

am: a09e71cf

Change-Id: Ic5571d8b095c7714985c04234b271cc87e9cb87e
parents 0a5c1237 a09e71cf
Loading
Loading
Loading
Loading
+0 −145
Original line number Diff line number Diff line
#
# Template audio policy configuration file
#

# Global configuration section:
# - before audio HAL version 3.0:
#   lists input and output devices always present on the device
#   as well as the output device selected by default.
#   Devices are designated by a string that corresponds to the enum in audio.h
#
#  global_configuration {
#    attached_output_devices AUDIO_DEVICE_OUT_SPEAKER
#    default_output_device AUDIO_DEVICE_OUT_SPEAKER
#    attached_input_devices AUDIO_DEVICE_IN_BUILTIN_MIC|AUDIO_DEVICE_IN_REMOTE_SUBMIX
#  }
#
# - after and including audio HAL 3.0 the global_configuration section is included in each
#   hardware module section.
#   it also includes the audio HAL version of this hw module:
#  global_configuration {
#    ...
#     audio_hal_version <major.minor>  # audio HAL version in e.g. 3.0
#  }
#   other attributes (attached devices, default device) have to be included in the
#   global_configuration section of each hardware module


# audio hardware module section: contains descriptors for all audio hw modules present on the
# device. Each hw module node is named after the corresponding hw module library base name.
# For instance, "primary" corresponds to audio.primary.<device>.so.
# The "primary" module is mandatory and must include at least one output with
# AUDIO_OUTPUT_FLAG_PRIMARY flag.
# Each module descriptor contains one or more output profile descriptors and zero or more
# input profile descriptors. Each profile lists all the parameters supported by a given output
# or input stream category.
# The "channel_masks", "formats", "devices" and "flags" are specified using strings corresponding
# to enums in audio.h and audio_policy.h. They are concatenated by use of "|" without space or "\n".
#
# For audio HAL version posterior to 3.0 the following sections or sub sections can be present in
# a hw module section:
# - A "global_configuration" section: see above
# - Optionally a "devices" section:
#   This section contains descriptors for audio devices with attributes like an address or a
#   gain controller. The syntax for the devices section and device descriptor is as follows:
#    devices {
#      <device name> {              # <device name>: any string without space
#        type <device type>         # <device type> e.g. AUDIO_DEVICE_OUT_SPEAKER
#        address <address>          # optional: device address, char string less than 64 in length
#      }
#    }
# - one or more "gains" sections can be present in a device descriptor section.
#   If present, they describe the capabilities of gain controllers attached to this input or
#   output device. e.g. :
#   <device name> {                  # <device name>: any string without space
#     type <device type>             # <device type> e.g. AUDIO_DEVICE_OUT_SPEAKER
#     address <address>              # optional: device address, char string less than 64 in length
#     gains {
#       <gain name> {
#         mode <gain modes supported>              # e.g. AUDIO_GAIN_MODE_CHANNELS
#         channel_mask <controlled channels>       # needed if mode AUDIO_GAIN_MODE_CHANNELS
#         min_value_mB <min value in millibel>
#         max_value_mB <max value in millibel>
#         default_value_mB <default value in millibel>
#         step_value_mB <step value in millibel>
#         min_ramp_ms <min duration in ms>         # needed if mode AUDIO_GAIN_MODE_RAMP
#         max_ramp_ms <max duration ms>            # needed if mode AUDIO_GAIN_MODE_RAMP
#       }
#     }
#   }
# - when a device descriptor is present, output and input profiles can refer to this device by
# its name in their "devices" section instead of specifying a device type. e.g. :
#   outputs {
#     primary {
#       sampling_rates 44100
#       channel_masks AUDIO_CHANNEL_OUT_STEREO
#       formats AUDIO_FORMAT_PCM_16_BIT
#       devices <device name>
#       flags AUDIO_OUTPUT_FLAG_PRIMARY
#     }
#   }
# sample audio_policy.conf file below

audio_hw_modules {
  primary {
    global_configuration {
      attached_output_devices AUDIO_DEVICE_OUT_SPEAKER
      default_output_device AUDIO_DEVICE_OUT_SPEAKER
      attached_input_devices AUDIO_DEVICE_IN_BUILTIN_MIC
      audio_hal_version 3.0
    }
    devices {
      speaker {
        type AUDIO_DEVICE_OUT_SPEAKER
        gains {
          gain_1 {
            mode AUDIO_GAIN_MODE_JOINT
            min_value_mB -8400
            max_value_mB 4000
            default_value_mB 0
            step_value_mB 100
          }
        }
      }
    }
    outputs {
      primary {
        sampling_rates 48000
        channel_masks AUDIO_CHANNEL_OUT_STEREO
        formats AUDIO_FORMAT_PCM_16_BIT
        devices speaker
        flags AUDIO_OUTPUT_FLAG_PRIMARY
      }
    }
    inputs {
      primary {
        sampling_rates 8000|16000
        channel_masks AUDIO_CHANNEL_IN_MONO
        formats AUDIO_FORMAT_PCM_16_BIT
        devices AUDIO_DEVICE_IN_BUILTIN_MIC
      }
    }
  }
  r_submix {
    global_configuration {
      attached_input_devices AUDIO_DEVICE_IN_REMOTE_SUBMIX
      audio_hal_version 2.0
    }
    outputs {
      submix {
        sampling_rates 48000
        channel_masks AUDIO_CHANNEL_OUT_STEREO
        formats AUDIO_FORMAT_PCM_16_BIT
        devices AUDIO_DEVICE_OUT_REMOTE_SUBMIX
      }
    }
    inputs {
      submix {
        sampling_rates 48000
        channel_masks AUDIO_CHANNEL_IN_STEREO
        formats AUDIO_FORMAT_PCM_16_BIT
        devices AUDIO_DEVICE_IN_REMOTE_SUBMIX
      }
    }
  }
}
+0 −71
Original line number Diff line number Diff line
/*
 * Copyright (C) 2012 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#pragma once


/////////////////////////////////////////////////
//      Definitions for audio policy configuration file (audio_policy.conf)
/////////////////////////////////////////////////

#define AUDIO_HARDWARE_MODULE_ID_MAX_LEN 32

#define AUDIO_POLICY_CONFIG_FILE "/system/etc/audio_policy.conf"
#define AUDIO_POLICY_VENDOR_CONFIG_FILE "/vendor/etc/audio_policy.conf"

// global configuration
#define GLOBAL_CONFIG_TAG "global_configuration"

#define ATTACHED_OUTPUT_DEVICES_TAG "attached_output_devices"
#define DEFAULT_OUTPUT_DEVICE_TAG "default_output_device"
#define ATTACHED_INPUT_DEVICES_TAG "attached_input_devices"
#define SPEAKER_DRC_ENABLED_TAG "speaker_drc_enabled"
#define AUDIO_HAL_VERSION_TAG "audio_hal_version"

// hw modules descriptions
#define AUDIO_HW_MODULE_TAG "audio_hw_modules"

#define OUTPUTS_TAG "outputs"
#define INPUTS_TAG "inputs"

#define SAMPLING_RATES_TAG "sampling_rates"
#define FORMATS_TAG "formats"
#define CHANNELS_TAG "channel_masks"
#define DEVICES_TAG "devices"
#define FLAGS_TAG "flags"

#define APM_DEVICES_TAG "devices"
#define APM_DEVICE_TYPE "type"
#define APM_DEVICE_ADDRESS "address"

#define MIXERS_TAG "mixers"
#define MIXER_TYPE "type"
#define MIXER_TYPE_MUX "mux"
#define MIXER_TYPE_MIX "mix"

#define GAINS_TAG "gains"
#define GAIN_MODE "mode"
#define GAIN_CHANNELS "channel_mask"
#define GAIN_MIN_VALUE "min_value_mB"
#define GAIN_MAX_VALUE "max_value_mB"
#define GAIN_DEFAULT_VALUE "default_value_mB"
#define GAIN_STEP_VALUE "step_value_mB"
#define GAIN_MIN_RAMP_MS "min_ramp_ms"
#define GAIN_MAX_RAMP_MS "max_ramp_ms"

#define DYNAMIC_VALUE_TAG "dynamic" // special value for "channel_masks", "sampling_rates" and
                                    // "formats" in outputs descriptors indicating that supported
                                    // values should be queried after opening the output.
+0 −8
Original line number Diff line number Diff line
@@ -15,10 +15,6 @@ LOCAL_SHARED_LIBRARIES := \

ifeq ($(USE_CONFIGURABLE_AUDIO_POLICY), 1)

ifneq ($(USE_XML_AUDIO_POLICY_CONF), 1)
$(error Configurable policy does not support legacy conf file)
endif #ifneq ($(USE_XML_AUDIO_POLICY_CONF), 1)

LOCAL_SHARED_LIBRARIES += libaudiopolicyengineconfigurable

else
@@ -43,10 +39,6 @@ LOCAL_SHARED_LIBRARIES += libmediametrics

LOCAL_SHARED_LIBRARIES += libbinder libhidlbase libxml2

ifeq ($(USE_XML_AUDIO_POLICY_CONF), 1)
LOCAL_CFLAGS += -DUSE_XML_AUDIO_POLICY_CONF
endif #ifeq ($(USE_XML_AUDIO_POLICY_CONF), 1)

LOCAL_CFLAGS += -Wall -Werror

LOCAL_MULTILIB := $(AUDIOSERVER_MULTILIB)
+0 −9
Original line number Diff line number Diff line
@@ -50,7 +50,6 @@
#include <private/android_filesystem_config.h>
#include <soundtrigger/SoundTrigger.h>
#include <system/audio.h>
#include <audio_policy_conf.h>
#include "AudioPolicyManager.h"
#include <Serializer.h>
#include "TypeConverter.h"
@@ -4297,14 +4296,6 @@ AudioPolicyManager::AudioPolicyManager(AudioPolicyClientInterface *clientInterfa
    initialize();
}

//  This check is to catch any legacy platform updating to Q without having
//  switched to XML since its deprecation on O.
// TODO: after Q release, remove this check and flag as XML is now the only
//        option and all legacy platform should have transitioned to XML.
#ifndef USE_XML_AUDIO_POLICY_CONF
#error Audio policy no longer supports legacy .conf configuration format
#endif

void AudioPolicyManager::loadConfig() {
    if (deserializeAudioPolicyXmlConfig(getConfig()) != NO_ERROR) {
        ALOGE("could not load audio policy configuration file, setting defaults");