diff options
Diffstat (limited to 'services/audiopolicy/engineconfigurable/parameter-framework/plugin')
15 files changed, 0 insertions, 820 deletions
diff --git a/services/audiopolicy/engineconfigurable/parameter-framework/plugin/Android.mk b/services/audiopolicy/engineconfigurable/parameter-framework/plugin/Android.mk deleted file mode 100755 index a41e6b5..0000000 --- a/services/audiopolicy/engineconfigurable/parameter-framework/plugin/Android.mk +++ /dev/null @@ -1,40 +0,0 @@ -LOCAL_PATH := $(call my-dir) - -include $(CLEAR_VARS) - -LOCAL_MODULE_TAGS := optional -LOCAL_SRC_FILES := \ - PolicySubsystemBuilder.cpp \ - PolicySubsystem.cpp \ - Strategy.cpp \ - InputSource.cpp \ - VolumeProfile.cpp \ - Stream.cpp \ - Usage.cpp - -LOCAL_CFLAGS += \ - -Wall \ - -Werror \ - -Wextra \ - -LOCAL_C_INCLUDES := \ - $(TOPDIR)frameworks/av/services/audiopolicy/common/include \ - $(TOPDIR)frameworks/av/services/audiopolicy/engineconfigurable/include \ - $(TOPDIR)frameworks/av/services/audiopolicy/engineconfigurable/interface \ - -LOCAL_SHARED_LIBRARIES := \ - libaudiopolicyengineconfigurable \ - libparameter \ - liblog \ - -LOCAL_STATIC_LIBRARIES := \ - libparameter_includes \ - libxmlserializer_includes \ - libpfw_utility \ - -LOCAL_MODULE_TAGS := optional -LOCAL_MODULE := libpolicy-subsystem - -include external/stlport/libstlport.mk -include $(BUILD_SHARED_LIBRARY) - diff --git a/services/audiopolicy/engineconfigurable/parameter-framework/plugin/InputSource.cpp b/services/audiopolicy/engineconfigurable/parameter-framework/plugin/InputSource.cpp deleted file mode 100755 index 497d555..0000000 --- a/services/audiopolicy/engineconfigurable/parameter-framework/plugin/InputSource.cpp +++ /dev/null @@ -1,53 +0,0 @@ -/* - * 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. - */ - -#include "InputSource.h" -#include "PolicyMappingKeys.h" -#include "PolicySubsystem.h" - -using std::string; - -InputSource::InputSource(const string &mappingValue, - CInstanceConfigurableElement *instanceConfigurableElement, - const CMappingContext &context) - : CFormattedSubsystemObject(instanceConfigurableElement, - mappingValue, - MappingKeyAmend1, - (MappingKeyAmendEnd - MappingKeyAmend1 + 1), - context), - mPolicySubsystem(static_cast<const PolicySubsystem *>( - instanceConfigurableElement->getBelongingSubsystem())), - mPolicyPluginInterface(mPolicySubsystem->getPolicyPluginInterface()), - mApplicableInputDevice(mDefaultApplicableInputDevice) -{ - mId = static_cast<audio_source_t>(context.getItemAsInteger(MappingKeyIdentifier)); - // Declares the strategy to audio policy engine - mPolicyPluginInterface->addInputSource(getFormattedMappingValue(), mId); -} - -bool InputSource::receiveFromHW(string & /*error*/) -{ - blackboardWrite(&mApplicableInputDevice, sizeof(mApplicableInputDevice)); - return true; -} - -bool InputSource::sendToHW(string & /*error*/) -{ - uint32_t applicableInputDevice; - blackboardRead(&applicableInputDevice, sizeof(applicableInputDevice)); - mApplicableInputDevice = applicableInputDevice; - return mPolicyPluginInterface->setDeviceForInputSource(mId, mApplicableInputDevice); -} diff --git a/services/audiopolicy/engineconfigurable/parameter-framework/plugin/InputSource.h b/services/audiopolicy/engineconfigurable/parameter-framework/plugin/InputSource.h deleted file mode 100755 index 67c5b50..0000000 --- a/services/audiopolicy/engineconfigurable/parameter-framework/plugin/InputSource.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * 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 "FormattedSubsystemObject.h" -#include "InstanceConfigurableElement.h" -#include "MappingContext.h" -#include <AudioPolicyPluginInterface.h> -#include <string> - -class PolicySubsystem; - -class InputSource : public CFormattedSubsystemObject -{ -public: - InputSource(const std::string &mappingValue, - CInstanceConfigurableElement *instanceConfigurableElement, - const CMappingContext &context); - -protected: - virtual bool receiveFromHW(std::string &error); - virtual bool sendToHW(std::string &error); - -private: - const PolicySubsystem *mPolicySubsystem; /**< Route subsytem plugin. */ - - /** - * Interface to communicate with Audio Policy Engine. - */ - android::AudioPolicyPluginInterface *mPolicyPluginInterface; - - audio_source_t mId; /**< input source identifier to link with audio.h. */ - uint32_t mApplicableInputDevice; /**< applicable input device for this strategy. */ - static const uint32_t mDefaultApplicableInputDevice = 0; /**< default input device. */ -}; diff --git a/services/audiopolicy/engineconfigurable/parameter-framework/plugin/PolicyMappingKeys.h b/services/audiopolicy/engineconfigurable/parameter-framework/plugin/PolicyMappingKeys.h deleted file mode 100755 index 53944e9..0000000 --- a/services/audiopolicy/engineconfigurable/parameter-framework/plugin/PolicyMappingKeys.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * 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 - -/** - * Mapping item types - */ -enum PolicyItemType -{ - MappingKeyName, - MappingKeyCategory, - MappingKeyIdentifier, - MappingKeyAmend1, - MappingKeyAmend2, - MappingKeyAmend3 -}; - -static const uint8_t MappingKeyAmendEnd = MappingKeyAmend3; diff --git a/services/audiopolicy/engineconfigurable/parameter-framework/plugin/PolicySubsystem.cpp b/services/audiopolicy/engineconfigurable/parameter-framework/plugin/PolicySubsystem.cpp deleted file mode 100755 index a5dab36..0000000 --- a/services/audiopolicy/engineconfigurable/parameter-framework/plugin/PolicySubsystem.cpp +++ /dev/null @@ -1,105 +0,0 @@ -/* - * 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. - */ - -#include "PolicySubsystem.h" -#include "SubsystemObjectFactory.h" -#include "PolicyMappingKeys.h" -#include "Strategy.h" -#include "Stream.h" -#include "InputSource.h" -#include "VolumeProfile.h" -#include "Usage.h" -#include <AudioPolicyPluginInterface.h> -#include <AudioPolicyEngineInstance.h> -#include <utils/Log.h> - -using android::audio_policy::EngineInstance; - -const char *const PolicySubsystem::mKeyName = "Name"; -const char *const PolicySubsystem::mKeyIdentifier = "Identifier"; -const char *const PolicySubsystem::mKeyCategory = "Category"; -const char *const PolicySubsystem::mKeyAmend1 = "Amend1"; -const char *const PolicySubsystem::mKeyAmend2 = "Amend2"; -const char *const PolicySubsystem::mKeyAmend3 = "Amend3"; - - -const char *const PolicySubsystem::mStreamComponentName = "Stream"; -const char *const PolicySubsystem::mStrategyComponentName = "Strategy"; -const char *const PolicySubsystem::mInputSourceComponentName = "InputSource"; -const char *const PolicySubsystem::mUsageComponentName = "Usage"; -const char *const PolicySubsystem::mVolumeProfileComponentName = "VolumeProfile"; - -PolicySubsystem::PolicySubsystem(const std::string &name) - : CSubsystem(name), - mPluginInterface(NULL) -{ - // Try to connect a Plugin Interface from Audio Policy Engine - EngineInstance *engineInstance = EngineInstance::getInstance(); - - if (engineInstance == NULL) { - ALOG_ASSERT(engineInstance != NULL, "NULL Plugin Interface"); - return; - } - // Retrieve the Route Interface - mPluginInterface = engineInstance->queryInterface<android::AudioPolicyPluginInterface>(); - if (mPluginInterface == NULL) { - // bailing out - ALOG_ASSERT(mPluginInterface != NULL, "NULL Plugin Interface"); - return; - } - - // Provide mapping keys to the core, necessary when parsing the XML Structure files. - addContextMappingKey(mKeyName); - addContextMappingKey(mKeyCategory); - addContextMappingKey(mKeyIdentifier); - addContextMappingKey(mKeyAmend1); - addContextMappingKey(mKeyAmend2); - addContextMappingKey(mKeyAmend3); - - // Provide creators to upper layer - addSubsystemObjectFactory( - new TSubsystemObjectFactory<Stream>( - mStreamComponentName, - (1 << MappingKeyAmend1) | (1 << MappingKeyIdentifier)) - ); - addSubsystemObjectFactory( - new TSubsystemObjectFactory<Strategy>( - mStrategyComponentName, - (1 << MappingKeyAmend1) | (1 << MappingKeyIdentifier)) - ); - addSubsystemObjectFactory( - new TSubsystemObjectFactory<Usage>( - mUsageComponentName, - (1 << MappingKeyAmend1) | (1 << MappingKeyIdentifier)) - ); - addSubsystemObjectFactory( - new TSubsystemObjectFactory<InputSource>( - mInputSourceComponentName, - (1 << MappingKeyAmend1) | (1 << MappingKeyIdentifier)) - ); - addSubsystemObjectFactory( - new TSubsystemObjectFactory<VolumeProfile>( - mVolumeProfileComponentName, - (1 << MappingKeyAmend1) | (1 << MappingKeyIdentifier) | (1 << MappingKeyIdentifier)) - ); -} - -// Retrieve Route interface -android::AudioPolicyPluginInterface *PolicySubsystem::getPolicyPluginInterface() const -{ - ALOG_ASSERT(mPluginInterface != NULL, "NULL Plugin Interface"); - return mPluginInterface; -} diff --git a/services/audiopolicy/engineconfigurable/parameter-framework/plugin/PolicySubsystem.h b/services/audiopolicy/engineconfigurable/parameter-framework/plugin/PolicySubsystem.h deleted file mode 100755 index 3c26fe1..0000000 --- a/services/audiopolicy/engineconfigurable/parameter-framework/plugin/PolicySubsystem.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - * 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 "Subsystem.h" -#include <string> - -namespace android { - -class AudioPolicyPluginInterface; - -} - -class PolicySubsystem : public CSubsystem -{ -public: - PolicySubsystem(const std::string &strName); - - /** - * Retrieve Route Manager interface. - * - * @return RouteManager interface for the route plugin. - */ - android::AudioPolicyPluginInterface *getPolicyPluginInterface() const; - -private: - /* Copy facilities are put private to disable copy. */ - PolicySubsystem(const PolicySubsystem &object); - PolicySubsystem &operator=(const PolicySubsystem &object); - - android::AudioPolicyPluginInterface *mPluginInterface; /**< Audio Policy Plugin Interface. */ - - static const char *const mKeyName; /**< name key mapping string. */ - static const char *const mKeyIdentifier; - static const char *const mKeyCategory; - - static const char *const mKeyAmend1; /**< amend1 key mapping string. */ - static const char *const mKeyAmend2; /**< amend2 key mapping string. */ - static const char *const mKeyAmend3; /**< amend3 key mapping string. */ - - static const char *const mStreamComponentName; - static const char *const mStrategyComponentName; - static const char *const mInputSourceComponentName; - static const char *const mUsageComponentName; - static const char *const mVolumeProfileComponentName; -}; diff --git a/services/audiopolicy/engineconfigurable/parameter-framework/plugin/PolicySubsystemBuilder.cpp b/services/audiopolicy/engineconfigurable/parameter-framework/plugin/PolicySubsystemBuilder.cpp deleted file mode 100755 index b14d446..0000000 --- a/services/audiopolicy/engineconfigurable/parameter-framework/plugin/PolicySubsystemBuilder.cpp +++ /dev/null @@ -1,29 +0,0 @@ -/* - * 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. - */ - -#include "SubsystemLibrary.h" -#include "NamedElementBuilderTemplate.h" -#include "PolicySubsystem.h" - -static const char *const POLICY_SUBSYSTEM_NAME = "Policy"; -extern "C" -{ -void getPOLICYSubsystemBuilder(CSubsystemLibrary *subsystemLibrary) -{ - subsystemLibrary->addElementBuilder(POLICY_SUBSYSTEM_NAME, - new TNamedElementBuilderTemplate<PolicySubsystem>()); -} -} diff --git a/services/audiopolicy/engineconfigurable/parameter-framework/plugin/Strategy.cpp b/services/audiopolicy/engineconfigurable/parameter-framework/plugin/Strategy.cpp deleted file mode 100755 index 1848813..0000000 --- a/services/audiopolicy/engineconfigurable/parameter-framework/plugin/Strategy.cpp +++ /dev/null @@ -1,54 +0,0 @@ -/* - * 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. - */ - -#include "Strategy.h" -#include "PolicyMappingKeys.h" -#include "PolicySubsystem.h" - -using std::string; -using android::routing_strategy; - -Strategy::Strategy(const string &mappingValue, - CInstanceConfigurableElement *instanceConfigurableElement, - const CMappingContext &context) - : CFormattedSubsystemObject(instanceConfigurableElement, - mappingValue, - MappingKeyAmend1, - (MappingKeyAmendEnd - MappingKeyAmend1 + 1), - context), - mPolicySubsystem(static_cast<const PolicySubsystem *>( - instanceConfigurableElement->getBelongingSubsystem())), - mPolicyPluginInterface(mPolicySubsystem->getPolicyPluginInterface()), - mApplicableOutputDevice(mDefaultApplicableOutputDevice) -{ - mId = static_cast<routing_strategy>(context.getItemAsInteger(MappingKeyIdentifier)); - - // Declares the strategy to audio policy engine - mPolicyPluginInterface->addStrategy(getFormattedMappingValue(), mId); -} - -bool Strategy::receiveFromHW(string & /*error*/) -{ - blackboardWrite(&mApplicableOutputDevice, sizeof(mApplicableOutputDevice)); - return true; -} - -bool Strategy::sendToHW(string & /*error*/) -{ - uint32_t applicableOutputDevice; - blackboardRead(&applicableOutputDevice, sizeof(applicableOutputDevice)); - return mPolicyPluginInterface->setDeviceForStrategy(mId, applicableOutputDevice); -} diff --git a/services/audiopolicy/engineconfigurable/parameter-framework/plugin/Strategy.h b/services/audiopolicy/engineconfigurable/parameter-framework/plugin/Strategy.h deleted file mode 100755 index 9a9b3e4..0000000 --- a/services/audiopolicy/engineconfigurable/parameter-framework/plugin/Strategy.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * 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 "FormattedSubsystemObject.h" -#include "InstanceConfigurableElement.h" -#include "MappingContext.h" -#include <AudioPolicyPluginInterface.h> -#include <string> - -class PolicySubsystem; - -class Strategy : public CFormattedSubsystemObject -{ -public: - Strategy(const std::string &mappingValue, - CInstanceConfigurableElement *instanceConfigurableElement, - const CMappingContext &context); - -protected: - virtual bool receiveFromHW(std::string &error); - virtual bool sendToHW(std::string &error); - -private: - const PolicySubsystem *mPolicySubsystem; /**< Route subsytem plugin. */ - - /** - * Interface to communicate with Audio Policy Engine. - */ - android::AudioPolicyPluginInterface *mPolicyPluginInterface; - - android::routing_strategy mId; /**< strategy identifier to link with audio.h.*/ - uint32_t mApplicableOutputDevice; /**< applicable output device for this strategy. */ - static const uint32_t mDefaultApplicableOutputDevice = 0; /**< default output device. */ -}; diff --git a/services/audiopolicy/engineconfigurable/parameter-framework/plugin/Stream.cpp b/services/audiopolicy/engineconfigurable/parameter-framework/plugin/Stream.cpp deleted file mode 100755 index 575b0bb..0000000 --- a/services/audiopolicy/engineconfigurable/parameter-framework/plugin/Stream.cpp +++ /dev/null @@ -1,56 +0,0 @@ -/* - * 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. - */ - -#include "Stream.h" -#include "PolicyMappingKeys.h" -#include "PolicySubsystem.h" - -using std::string; -using android::routing_strategy; - -Stream::Stream(const string &mappingValue, - CInstanceConfigurableElement *instanceConfigurableElement, - const CMappingContext &context) - : CFormattedSubsystemObject(instanceConfigurableElement, - mappingValue, - MappingKeyAmend1, - (MappingKeyAmendEnd - MappingKeyAmend1 + 1), - context), - mPolicySubsystem(static_cast<const PolicySubsystem *>( - instanceConfigurableElement->getBelongingSubsystem())), - mPolicyPluginInterface(mPolicySubsystem->getPolicyPluginInterface()), - mApplicableStrategy(mDefaultApplicableStrategy) -{ - mId = static_cast<audio_stream_type_t>(context.getItemAsInteger(MappingKeyIdentifier)); - - // Declares the strategy to audio policy engine - mPolicyPluginInterface->addStream(getFormattedMappingValue(), mId); -} - -bool Stream::receiveFromHW(string & /*error*/) -{ - blackboardWrite(&mApplicableStrategy, sizeof(mApplicableStrategy)); - return true; -} - -bool Stream::sendToHW(string & /*error*/) -{ - uint32_t applicableStrategy; - blackboardRead(&applicableStrategy, sizeof(applicableStrategy)); - mApplicableStrategy = applicableStrategy; - return mPolicyPluginInterface->setStrategyForStream(mId, - static_cast<routing_strategy>(mApplicableStrategy)); -} diff --git a/services/audiopolicy/engineconfigurable/parameter-framework/plugin/Stream.h b/services/audiopolicy/engineconfigurable/parameter-framework/plugin/Stream.h deleted file mode 100755 index 7d90c36..0000000 --- a/services/audiopolicy/engineconfigurable/parameter-framework/plugin/Stream.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * 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 "FormattedSubsystemObject.h" -#include "InstanceConfigurableElement.h" -#include "MappingContext.h" -#include <AudioPolicyPluginInterface.h> -#include <string> - -class PolicySubsystem; - -class Stream : public CFormattedSubsystemObject -{ -public: - Stream(const std::string &mappingValue, - CInstanceConfigurableElement *instanceConfigurableElement, - const CMappingContext &context); - -protected: - virtual bool receiveFromHW(std::string &error); - virtual bool sendToHW(std::string &error); - -private: - const PolicySubsystem *mPolicySubsystem; /**< Route subsytem plugin. */ - - /** - * Interface to communicate with Audio Policy Engine. - */ - android::AudioPolicyPluginInterface *mPolicyPluginInterface; - - audio_stream_type_t mId; /**< stream type identifier to link with audio.h. */ - uint32_t mApplicableStrategy; /**< applicable strategy for this stream. */ - static const uint32_t mDefaultApplicableStrategy = 0; /**< default strategy. */ -}; diff --git a/services/audiopolicy/engineconfigurable/parameter-framework/plugin/Usage.cpp b/services/audiopolicy/engineconfigurable/parameter-framework/plugin/Usage.cpp deleted file mode 100755 index 1916b9b..0000000 --- a/services/audiopolicy/engineconfigurable/parameter-framework/plugin/Usage.cpp +++ /dev/null @@ -1,56 +0,0 @@ -/* - * 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. - */ - -#include "Usage.h" -#include "PolicyMappingKeys.h" -#include "PolicySubsystem.h" - -using std::string; -using android::routing_strategy; - -Usage::Usage(const string &mappingValue, - CInstanceConfigurableElement *instanceConfigurableElement, - const CMappingContext &context) - : CFormattedSubsystemObject(instanceConfigurableElement, - mappingValue, - MappingKeyAmend1, - (MappingKeyAmendEnd - MappingKeyAmend1 + 1), - context), - mPolicySubsystem(static_cast<const PolicySubsystem *>( - instanceConfigurableElement->getBelongingSubsystem())), - mPolicyPluginInterface(mPolicySubsystem->getPolicyPluginInterface()), - mApplicableStrategy(mDefaultApplicableStrategy) -{ - mId = static_cast<audio_usage_t>(context.getItemAsInteger(MappingKeyIdentifier)); - - // Declares the strategy to audio policy engine - mPolicyPluginInterface->addUsage(getFormattedMappingValue(), mId); -} - -bool Usage::receiveFromHW(string & /*error*/) -{ - blackboardWrite(&mApplicableStrategy, sizeof(mApplicableStrategy)); - return true; -} - -bool Usage::sendToHW(string & /*error*/) -{ - uint32_t applicableStrategy; - blackboardRead(&applicableStrategy, sizeof(applicableStrategy)); - mApplicableStrategy = applicableStrategy; - return mPolicyPluginInterface->setStrategyForUsage(mId, - static_cast<routing_strategy>(mApplicableStrategy)); -} diff --git a/services/audiopolicy/engineconfigurable/parameter-framework/plugin/Usage.h b/services/audiopolicy/engineconfigurable/parameter-framework/plugin/Usage.h deleted file mode 100755 index 8e9b638..0000000 --- a/services/audiopolicy/engineconfigurable/parameter-framework/plugin/Usage.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * 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 "FormattedSubsystemObject.h" -#include "InstanceConfigurableElement.h" -#include "MappingContext.h" -#include <AudioPolicyPluginInterface.h> -#include <string> - -class PolicySubsystem; - -class Usage : public CFormattedSubsystemObject -{ -public: - Usage(const std::string &mappingValue, - CInstanceConfigurableElement *instanceConfigurableElement, - const CMappingContext &context); - -protected: - virtual bool receiveFromHW(std::string &error); - virtual bool sendToHW(std::string &error); - -private: - const PolicySubsystem *mPolicySubsystem; /**< Route subsytem plugin. */ - - /** - * Interface to communicate with Audio Policy Engine. - */ - android::AudioPolicyPluginInterface *mPolicyPluginInterface; - - audio_usage_t mId; /**< usage identifier to link with audio.h. */ - uint32_t mApplicableStrategy; /**< applicable strategy for this usage. */ - static const uint32_t mDefaultApplicableStrategy = 0; /**< default strategy. */ -}; diff --git a/services/audiopolicy/engineconfigurable/parameter-framework/plugin/VolumeProfile.cpp b/services/audiopolicy/engineconfigurable/parameter-framework/plugin/VolumeProfile.cpp deleted file mode 100755 index 5c155c8..0000000 --- a/services/audiopolicy/engineconfigurable/parameter-framework/plugin/VolumeProfile.cpp +++ /dev/null @@ -1,75 +0,0 @@ -/* - * 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. - */ - -#include "VolumeProfile.h" -#include "PolicyMappingKeys.h" -#include "PolicySubsystem.h" -#include "ParameterBlockType.h" -#include <Volume.h> -#include <math.h> - -using std::string; - -VolumeProfile::VolumeProfile(const string &mappingValue, - CInstanceConfigurableElement *instanceConfigurableElement, - const CMappingContext &context) - : CFormattedSubsystemObject(instanceConfigurableElement, - mappingValue, - MappingKeyAmend1, - (MappingKeyAmendEnd - MappingKeyAmend1 + 1), - context), - mPolicySubsystem(static_cast<const PolicySubsystem *>( - instanceConfigurableElement->getBelongingSubsystem())), - mPolicyPluginInterface(mPolicySubsystem->getPolicyPluginInterface()) -{ - uint32_t categoryKey = context.getItemAsInteger(MappingKeyCategory); - if (categoryKey >= Volume::DEVICE_CATEGORY_CNT) { - mCategory = Volume::DEVICE_CATEGORY_SPEAKER; - } else { - mCategory = static_cast<Volume::device_category>(categoryKey); - } - mId = static_cast<audio_stream_type_t>(context.getItemAsInteger(MappingKeyIdentifier)); - - // (no exception support, defer the error) - if (instanceConfigurableElement->getType() != CInstanceConfigurableElement::EParameterBlock) { - return; - } - // Get actual element type - const CParameterBlockType *parameterType = static_cast<const CParameterBlockType *>( - instanceConfigurableElement->getTypeElement()); - mPoints = parameterType->getArrayLength(); -} - -bool VolumeProfile::receiveFromHW(string & /*error*/) -{ - return true; -} - -bool VolumeProfile::sendToHW(string & /*error*/) -{ - Point points[mPoints]; - blackboardRead(&points, sizeof(Point) * mPoints); - - VolumeCurvePoints pointsVector; - for (size_t i = 0; i < mPoints; i++) { - VolumeCurvePoint curvePoint; - curvePoint.mIndex = points[i].index; - curvePoint.mDBAttenuation = static_cast<float>(points[i].dbAttenuation) / - (1UL << gFractional); - pointsVector.push_back(curvePoint); - } - return mPolicyPluginInterface->setVolumeProfileForStream(mId, mCategory, pointsVector); -} diff --git a/services/audiopolicy/engineconfigurable/parameter-framework/plugin/VolumeProfile.h b/services/audiopolicy/engineconfigurable/parameter-framework/plugin/VolumeProfile.h deleted file mode 100755 index a00ae84..0000000 --- a/services/audiopolicy/engineconfigurable/parameter-framework/plugin/VolumeProfile.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * 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 "FormattedSubsystemObject.h" -#include "InstanceConfigurableElement.h" -#include "MappingContext.h" -#include <Volume.h> -#include <AudioPolicyPluginInterface.h> -#include <string> - -class PolicySubsystem; - -class VolumeProfile : public CFormattedSubsystemObject -{ -private: - struct Point - { - int index; - /** Volume is using FixedPointParameter until float parameters are available. */ - int16_t dbAttenuation; - } __attribute__((packed)); - -public: - VolumeProfile(const std::string &mappingValue, - CInstanceConfigurableElement *instanceConfigurableElement, - const CMappingContext &context); - -protected: - virtual bool receiveFromHW(std::string &error); - virtual bool sendToHW(std::string &error); - -private: - const PolicySubsystem *mPolicySubsystem; /**< Route subsytem plugin. */ - - /** - * Interface to communicate with Audio Policy Engine. - */ - android::AudioPolicyPluginInterface *mPolicyPluginInterface; - - /** - * volume profile identifier, which is in fact a stream type to link with audio.h. - */ - audio_stream_type_t mId; - - size_t mPoints; - Volume::device_category mCategory; - - static const uint32_t gFractional = 8; /**< Beware to align with the structure. */ -}; |