You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
815 B
30 lines
815 B
#define LOG_TAG "android.hidl.allocator@1.0-service" |
|
|
|
#include "AshmemAllocator.h" |
|
|
|
#include <android-base/logging.h> |
|
#include <android/hidl/allocator/1.0/IAllocator.h> |
|
#include <hidl/HidlTransportSupport.h> |
|
|
|
using android::hardware::configureRpcThreadpool; |
|
using android::hardware::joinRpcThreadpool; |
|
using android::hidl::allocator::V1_0::IAllocator; |
|
using android::hidl::allocator::V1_0::implementation::AshmemAllocator; |
|
using android::sp; |
|
using android::status_t; |
|
|
|
int main() { |
|
configureRpcThreadpool(1, true /* callerWillJoin */); |
|
|
|
sp<IAllocator> allocator = new AshmemAllocator(); |
|
|
|
status_t status = allocator->registerAsService("ashmem"); |
|
|
|
if (android::OK != status) { |
|
LOG(FATAL) << "Unable to register allocator service: " << status; |
|
} |
|
|
|
joinRpcThreadpool(); |
|
|
|
return -1; |
|
}
|
|
|