1 #define LOG_TAG "android.hidl.allocator@1.0-service" 2 3 #include "AshmemAllocator.h" 4 5 #include <android-base/logging.h> 6 #include <android/hidl/allocator/1.0/IAllocator.h> 7 #include <hidl/HidlTransportSupport.h> 8 9 using android::hardware::configureRpcThreadpool; 10 using android::hardware::joinRpcThreadpool; 11 using android::hidl::allocator::V1_0::IAllocator; 12 using android::hidl::allocator::V1_0::implementation::AshmemAllocator; 13 using android::sp; 14 using android::status_t; 15 main()16int main() { 17 configureRpcThreadpool(1, true /* callerWillJoin */); 18 19 sp<IAllocator> allocator = new AshmemAllocator(); 20 21 status_t status = allocator->registerAsService("ashmem"); 22 23 if (android::OK != status) { 24 LOG(FATAL) << "Unable to register allocator service: " << status; 25 } 26 27 joinRpcThreadpool(); 28 29 return -1; 30 } 31