Files
Andreas Schneider 523d2d59c4 a71-common: Replace prebuilt libsensorndkbridge with a shim
Change-Id: Id94ed43336e84934f42f56c58e506b50af3c59fd
2024-10-01 03:11:08 +02:00

37 lines
881 B
C++

/*
* Copyright (C) 2020-2024 The LineageOS Project
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <ALooper.h>
#define LOG_TAG "libshim_sensorndkbridge"
#include <android-base/logging.h>
using android::Mutex;
static Mutex gLock;
extern "C" ALooper* ALooper_forCamera() {
Mutex::Autolock autoLock(gLock);
LOG(VERBOSE) << "ALooper_forCamera";
return new ALooper;
}
extern "C" int ALooper_release_forCamera(ALooper* sLooper) {
if (sLooper != nullptr) {
Mutex::Autolock autoLock(gLock);
delete sLooper;
}
return 0;
}
extern "C" int ALooper_pollOnce_camera(ALooper* sLooper, int timeoutMillis, int* outFd,
int* outEvents, void** outData) {
int res = sLooper->pollOnce(timeoutMillis, outFd, outEvents, outData);
LOG(VERBOSE) << "ALooper_pollOnce_camera => " << res;
return res;
}