1 #include <Memtrack.h> 2 #include <android-base/logging.h> 3 #include <android/binder_manager.h> 4 #include <android/binder_process.h> 5 6 #undef LOG_TAG 7 #define LOG_TAG "memtrack-service" 8 9 using aidl::android::hardware::memtrack::Memtrack; 10 main()11int main() { 12 ABinderProcess_setThreadPoolMaxThreadCount(0); 13 std::shared_ptr<Memtrack> memtrack = ndk::SharedRefBase::make<Memtrack>(); 14 15 const std::string instance = std::string() + Memtrack::descriptor + "/default"; 16 binder_status_t status = 17 AServiceManager_addService(memtrack->asBinder().get(), instance.c_str()); 18 CHECK(status == STATUS_OK); 19 20 ABinderProcess_joinThreadPool(); 21 return EXIT_FAILURE; // Unreachable 22 } 23