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

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

audiopolicy: engine: Add ProductStrategy common code

-Adds new Engine APIs for Product Strategy management
-Adds a common engine code to handle product strategies
-Adds a parsing configuration library to feed the strategies
-Prepare both engine for the switch

Test: make
Change-Id: I00f57ece798893bc6f9aa9ed54a3e5237e8d5cf1
parent 612be7ff
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
../../media/libaudioclient/include/media/AudioCommonTypes.h
 No newline at end of file
+34 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2018 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 <system/audio.h>
#include <system/audio_policy.h>
#include <binder/Parcel.h>
#include <utils/String8.h>
#include <utils/Vector.h>

namespace android {

enum product_strategy_t : uint32_t;
const product_strategy_t PRODUCT_STRATEGY_NONE = static_cast<product_strategy_t>(-1);

using AttributesVector = std::vector<audio_attributes_t>;

} // namespace android
+9 −3
Original line number Diff line number Diff line
@@ -11,9 +11,11 @@ LOCAL_SRC_FILES:= \
LOCAL_C_INCLUDES := \
    frameworks/av/services/audioflinger \
    $(call include-path-for, audio-utils) \
    frameworks/av/services/audiopolicy/common/include \
    frameworks/av/services/audiopolicy/engine/interface \

LOCAL_HEADER_LIBRARIES := \
    libaudiopolicycommon

LOCAL_SHARED_LIBRARIES := \
    libcutils \
    libutils \
@@ -76,10 +78,12 @@ LOCAL_SHARED_LIBRARIES += libaudiopolicyenginedefault
endif # ifeq ($(USE_CONFIGURABLE_AUDIO_POLICY), 1)

LOCAL_C_INCLUDES += \
    frameworks/av/services/audiopolicy/common/include \
    frameworks/av/services/audiopolicy/engine/interface \
    $(call include-path-for, audio-utils) \

LOCAL_HEADER_LIBRARIES := \
    libaudiopolicycommon

LOCAL_STATIC_LIBRARIES := \
    libaudiopolicycomponents

@@ -114,10 +118,12 @@ LOCAL_STATIC_LIBRARIES := \
    libaudiopolicycomponents

LOCAL_C_INCLUDES += \
    frameworks/av/services/audiopolicy/common/include \
    frameworks/av/services/audiopolicy/engine/interface \
    $(call include-path-for, audio-utils) \

LOCAL_HEADER_LIBRARIES := \
    libaudiopolicycommon

LOCAL_CFLAGS := -Wall -Werror

LOCAL_MULTILIB := $(AUDIOSERVER_MULTILIB)
+0 −4
Original line number Diff line number Diff line
@@ -18,10 +18,6 @@

namespace android {

// Time in milliseconds after media stopped playing during which we consider that the
// sonification should be as unobtrusive as during the time media was playing.
#define SONIFICATION_RESPECTFUL_AFTER_MUSIC_DELAY 5000

enum routing_strategy {
    STRATEGY_NONE = -1,
    STRATEGY_MEDIA,
+18 −0
Original line number Diff line number Diff line
@@ -17,9 +17,21 @@
#pragma once

#include <system/audio.h>
#include <vector>

namespace android {

using StreamTypeVector = std::vector<audio_stream_type_t>;


static const audio_attributes_t defaultAttr = AUDIO_ATTRIBUTES_INITIALIZER;

} // namespace android

static const audio_format_t gDynamicFormat = AUDIO_FORMAT_DEFAULT;

static const uint32_t SONIFICATION_RESPECTFUL_AFTER_MUSIC_DELAY = 5000;

// For mixed output and inputs, the policy will use max mixer sampling rates.
// Do not limit sampling rate otherwise
#define SAMPLE_RATE_HZ_MAX 192000
@@ -151,3 +163,9 @@ static inline bool audio_formats_match(audio_format_t format1,
    }
    return format1 == format2;
}

constexpr bool operator==(const audio_attributes_t &lhs, const audio_attributes_t &rhs)
{
    return lhs.usage == rhs.usage && lhs.content_type == rhs.content_type &&
            lhs.flags == rhs.flags && (std::strcmp(lhs.tags, rhs.tags) == 0);
}
Loading