Both core and effect Hal now have one single point of entry. This point of entry is their respective factories: - DevicesFactoryHalInterface::create - EffectsFactoryHalInterface::create Each entry point looks for their respective services supported version, starting from the highest (currently only 2.0) and returning the subclass wrapping this version to the most recent audio.h framework api. Note that EffectBufferHalInterface were previously created from static methods (mirror and allocate) which broke the single point of entry requirement. As a result, buffers have now to be created from the factory like the other classes. Note that the death handler also need to be its own library as it is used by versioned code and is version independent. Bug: 38184704 Test: compile Change-Id: Iac9b1fda561bb486193d5b9e025a870f50cda530 Signed-off-by: Kevin Rocard <krocard@google.com>gugelfrei
parent
51ac542df4
commit
7588ff418a
@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright (C) 2017 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 "DevicesFactoryHalHybrid.h"
|
||||
#include <android/hardware/audio/2.0/IDevicesFactory.h>
|
||||
|
||||
using namespace ::android::hardware::audio;
|
||||
|
||||
namespace android {
|
||||
|
||||
// static
|
||||
sp<DevicesFactoryHalInterface> DevicesFactoryHalInterface::create() {
|
||||
if (V2_0::IDevicesFactory::getService() != nullptr) {
|
||||
return new DevicesFactoryHalHybrid();
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
} // namespace android
|
@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Copyright (C) 2016 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.
|
||||
*/
|
||||
|
||||
#define LOG_TAG "EffectsFactoryHalHidl"
|
||||
//#define LOG_NDEBUG 0
|
||||
|
||||
#include "EffectHalHidl.h"
|
||||
#include "EffectsFactoryHalHidl.h"
|
||||
|
||||
using ::android::hardware::Return;
|
||||
|
||||
using namespace ::android::hardware::audio::effect;
|
||||
|
||||
namespace android {
|
||||
|
||||
// static
|
||||
sp<EffectsFactoryHalInterface> EffectsFactoryHalInterface::create() {
|
||||
if (V2_0::IEffectsFactory::getService() != nullptr) {
|
||||
return new EffectsFactoryHalHidl();
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// static
|
||||
bool EffectsFactoryHalInterface::isNullUuid(const effect_uuid_t *pEffectUuid) {
|
||||
return memcmp(pEffectUuid, EFFECT_UUID_NULL, sizeof(effect_uuid_t)) == 0;
|
||||
}
|
||||
|
||||
} // namespace android
|
Loading…
Reference in new issue