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

Commit 20f06f99 authored by François Gaffie's avatar François Gaffie Committed by Eric Laurent
Browse files

Add a configurable version of the policy engine based on PFW



This patch adds a configurable version of the policy engine
based on the parameter framework.
This configurable engine shall be activated with a flag
USE_CONFIGURABLE_AUDIO_POLICY within BoardConfig.mk

This patch provides the generic configuration as an example.
This configuration provides the same user experience as the default
policy engine.

- Fix M Issue on configurable policy engine version.

- Remove the "empty static lib include trick" hack

The code was using a hack to import headers only through an empty lib.
This trick was used not only by the PFW and its plugin but also internally
with policy.

This patch removes this hack and either links againts the real libraries if exist
or point on the path of the header.
However, since header directories are not recursively detected on Andoid, we need to manually
add all necessary libraries. (for example libicuuc needed by libxml2)

- let the build system decide which compiler and which stl is to be used

- Disable by default Audio Policy Settings XML file generation at compilation time

In order not to depend on python tool for the configurable policy example,
this patch adds the generated Settings XML file and disables the generation
from .pfw files at compile time.
If the user wishes to regenerate it, he may use the pfw_rebuild_settings
option.

- Fix Clang issues within Configurable Audio Policy

Fix compilation issues revealed when switching to CLANG compiler
within the configurable version of policy engine.

Change-Id: I3edc26db94c0bf8a76430ab8081bae52e9193705
Signed-off-by: default avatarFrançois Gaffie <francois.gaffie@intel.com>
parent 3fc792fe
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -64,8 +64,23 @@ LOCAL_SHARED_LIBRARIES := \
    liblog \
    libsoundtrigger

ifeq ($(USE_CONFIGURABLE_AUDIO_POLICY), 1)

LOCAL_REQUIRED_MODULES := \
    parameter-framework.policy \
    audio_policy_criteria.conf \

LOCAL_C_INCLUDES += \
    $(TOPDIR)frameworks/av/services/audiopolicy/engineconfigurable/include \

LOCAL_SHARED_LIBRARIES += libaudiopolicyengineconfigurable

else

LOCAL_SHARED_LIBRARIES += libaudiopolicyenginedefault

endif

LOCAL_C_INCLUDES += \
    $(TOPDIR)frameworks/av/services/audiopolicy/common/include \
    $(TOPDIR)frameworks/av/services/audiopolicy/engine/interface \
+2 −2
Original line number Diff line number Diff line
@@ -107,8 +107,8 @@ public:
     * @param[in] usage for which a configuration shall be forced.
     * @param[in] config wished to be forced for the given usage.
     *
     * @return NO_ERROR if the Force Use config was set correctly, error code otherwise (e.g. config not
     * allowed a given usage...)
     * @return NO_ERROR if the Force Use config was set correctly, error code otherwise (e.g. config
     * not allowed a given usage...)
     */
    virtual status_t setForceUse(audio_policy_force_use_t usage,
                                 audio_policy_forced_cfg_t config) = 0;
+59 −0
Original line number Diff line number Diff line
ifeq ($(USE_CONFIGURABLE_AUDIO_POLICY), 1)

LOCAL_PATH := $(call my-dir)

# Component build
#######################################################################

include $(CLEAR_VARS)

LOCAL_SRC_FILES := \
    src/Engine.cpp \
    src/EngineInstance.cpp \
    src/Stream.cpp \
    src/Strategy.cpp \
    src/Usage.cpp \
    src/InputSource.cpp \

audio_policy_engine_includes_common := \
    $(TOPDIR)frameworks/av/services/audiopolicy/engineconfigurable/include \
    $(TOPDIR)frameworks/av/services/audiopolicy/engineconfigurable/interface \
    $(TOPDIR)frameworks/av/services/audiopolicy/engine/interface

LOCAL_CFLAGS += \
    -Wall \
    -Werror \
    -Wextra \

LOCAL_EXPORT_C_INCLUDE_DIRS := \
    $(audio_policy_engine_includes_common)

LOCAL_C_INCLUDES := \
    $(audio_policy_engine_includes_common) \
    $(TARGET_OUT_HEADERS)/hw \
    $(call include-path-for, frameworks-av) \
    $(call include-path-for, audio-utils) \
    $(TOPDIR)frameworks/av/services/audiopolicy/common/include


LOCAL_MODULE := libaudiopolicyengineconfigurable
LOCAL_MODULE_TAGS := optional
LOCAL_STATIC_LIBRARIES := \
    libmedia_helper \
    libaudiopolicypfwwrapper \
    libaudiopolicycomponents

LOCAL_SHARED_LIBRARIES := \
    libcutils \
    libutils \
    libaudioutils \
    libparameter

include $(BUILD_SHARED_LIBRARY)

#######################################################################
# Recursive call sub-folder Android.mk
#
include $(call all-makefiles-under,$(LOCAL_PATH))

endif
+81 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2015 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

class AudioPolicyManagerInterface;
class AudioPolicyPluginInterface;

namespace android
{
namespace audio_policy
{

class Engine;

class EngineInstance
{
protected:
    EngineInstance();

public:
    virtual ~EngineInstance();

    /**
     * Get Audio Policy Engine instance.
     *
     * @return pointer to Route Manager Instance object.
     */
    static EngineInstance *getInstance();

    /**
     * Interface query.
     * The first client of an interface of the policy engine will start the singleton.
     *
     * @tparam RequestedInterface: interface that the client is wishing to retrieve.
     *
     * @return interface handle.
     */
    template <class RequestedInterface>
    RequestedInterface *queryInterface() const;

protected:
    /**
     * Get Audio Policy Engine instance.
     *
     * @return Audio Policy Engine singleton.
     */
    Engine *getEngine() const;

private:
    /* Copy facilities are put private to disable copy. */
    EngineInstance(const EngineInstance &object);
    EngineInstance &operator=(const EngineInstance &object);
};

/**
 * Limit template instantation to supported type interfaces.
 * Compile time error will claim if invalid interface is requested.
 */
template <>
AudioPolicyManagerInterface *EngineInstance::queryInterface() const;

template <>
AudioPolicyPluginInterface *EngineInstance::queryInterface() const;

}; // namespace audio_policy

}; // namespace android
+22 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2015 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

#include <Volume.h>
#include <vector>

typedef std::vector<VolumeCurvePoint> VolumeCurvePoints;
Loading