mirror of
https://github.com/Evolution-X/hardware_interfaces
synced 2026-02-02 20:24:19 +00:00
The multihal framework is a HAL interface for the sensors framework that allows multiple vendors to package their HAL implementation into a subHAL dynamic library that will be loaded and used to pass on method calls to the appropriate subHAL. The HalProxy object, that will act as the main proxy sensors wrapper for the multiHAL handles writing sensor events to the event FMQ and wakelock acquisition and releasing via a callback object it passes to the subHALs. In order to turn your HAL 2.0 executable into a subHAL to be used by the multiHAL, implement the Return<Result> initialize(sp<HalProxyCallback>& callback) method of the ISensorsSubHal derived class. Implement the ISensorsSubHal* sensorsHalGetSubHal(uint32_t* version)method and have it return a pointer to your subHAL object. Build this into a dynamic library and list its filename under /vendor/etc/sensors/hals.conf. Squashed commits:07b442e96(refs/published/mh2_2) MH2 | Write processedEvents instead of original events.b38f2e251Merge "MH2 | Check that subhal index is in range"d38f99474Merge "MH2 | Implement debug method of HalProxy"bf46132fe(refs/published/mh2_4, mh2_4) MH2 | Implement debug method of HalProxy1de5bb334MH2 | Fix wakelock namee07215347(refs/published/mh2_3, mh2_3) MH2 | Check that subhal index is in range336c1c71eMH2 | Add restart logic in HalProxy::initialize method.731d7125bMH2 | Change rc file to more appropriate settingsf09465d11MH2 | Add makeFMQ helpers to HalProxy_test75cc7bf2fMH2 | Implement wakelock processing threade93fdf9a4MH2 | Implement dynamic sensors callbacks on HalProxy82b84148cRemove libhwbinder/libhidltransport depsd45e49b4bMerge "MH2 | Implement pending writes thread"597142692MH2 | Implement pending writes threaddb23aa825MH2 | Implement direct channel and direct report methods83e4370aeMH2 | Implement injectSensorData method of HalProxyd0cd57d4cMH2 | Implement ScopeWakelock ctor and dtor537c0274bMH2 | Add rough proxy callback postEvents methodf97a3f357Multihal 2.0 - Small tweaks to sensorHandle handling7a7235461MultiHal 2.0 - setOperationMode and init direct channel flagsdc7a8e789MultiHal 2.0 - Get sensors list from subhals4b4c7b744MultiHal 2.0 - activate, batch, flush methods of HalProxy1638531dfMultiHal 2.0 - proxying api calls helper methodsaacbf9485Set up shell to use for unit tests2879067ddMultihal 2.0 - Implement SubHal discoveryc34e6683bAdd a sub-HAL implementation for testing multi-HALa689f8a65Add skeleton for multihal 2.0 Bug: 136511617 Test: atest android.hardware.sensors@2.0-halproxy-unit-tests && vts-tradefed run commandAndExit vts --skip-all-system-status-check --primary-abi-only --skip-preconditions --module VtsHalSensorsV2_0Target Change-Id: Ibe92d40c92b70848526b0e941bbcffbaf81ffaf2
40 lines
1.3 KiB
C++
40 lines
1.3 KiB
C++
/*
|
|
* Copyright (C) 2019 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 <android/hardware/sensors/2.0/ISensors.h>
|
|
#include <hidl/HidlTransportSupport.h>
|
|
#include <log/log.h>
|
|
#include <utils/StrongPointer.h>
|
|
#include "HalProxy.h"
|
|
|
|
using android::hardware::configureRpcThreadpool;
|
|
using android::hardware::joinRpcThreadpool;
|
|
using android::hardware::sensors::V2_0::ISensors;
|
|
using android::hardware::sensors::V2_0::implementation::HalProxy;
|
|
|
|
int main(int /* argc */, char** /* argv */) {
|
|
configureRpcThreadpool(1, true);
|
|
|
|
android::sp<ISensors> halProxy = new HalProxy();
|
|
if (halProxy->registerAsService() != ::android::OK) {
|
|
ALOGE("Failed to register Sensors HAL instance");
|
|
return -1;
|
|
}
|
|
|
|
joinRpcThreadpool();
|
|
return 1; // joinRpcThreadpool shouldn't exit
|
|
}
|