1 // Copyright 2020 The Android Open Source Project 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 #include <android-base/logging.h> 16 #include <android/binder_process.h> 17 #include <utils/Log.h> 18 19 #include "FaceTracker.h" 20 21 using android::automotive::computepipe::FaceTracker; 22 23 namespace { 24 terminationCallback(bool error,std::string errorMsg)25void terminationCallback(bool error, std::string errorMsg) { 26 if (error) { 27 LOG(ERROR) << errorMsg; 28 exit(2); 29 } 30 LOG(ERROR) << "Test completed"; 31 exit(0); 32 } 33 } // namespace main(int,char **)34int main(int /* argc */, char** /* argv */) { 35 std::function<void(bool, std::string)> cb = terminationCallback; 36 FaceTracker client; 37 38 ABinderProcess_startThreadPool(); 39 ndk::ScopedAStatus status = client.init(std::move(cb)); 40 if (!status.isOk()) { 41 LOG(ERROR) << "Unable to init client connection"; 42 return -1; 43 } 44 ABinderProcess_joinThreadPool(); 45 46 return 0; 47 } 48