1 /* 2 * Copyright (C) 2020 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #define LOG_TAG "android.hardware.automotive.sv@1.0-service" 18 19 #include <android/hardware/automotive/sv/1.0/ISurroundViewStream.h> 20 #include <android/hardware_buffer.h> 21 #include <hidl/HidlTransportSupport.h> 22 #include <log/log.h> 23 #include <thread> 24 #include <ui/GraphicBuffer.h> 25 #include <utils/Errors.h> 26 #include <utils/StrongPointer.h> 27 #include <utils/SystemClock.h> 28 29 #include "SurroundViewService.h" 30 31 // libhidl: 32 using android::hardware::configureRpcThreadpool; 33 using android::hardware::joinRpcThreadpool; 34 35 // implementation: 36 using android::hardware::automotive::sv::V1_0::implementation::SurroundViewService; 37 main()38int main() { 39 ALOGI("ISurroundViewService default implementation is starting"); 40 android::sp<ISurroundViewService> service = new SurroundViewService(); 41 42 configureRpcThreadpool(1, true /* callerWillJoin */); 43 44 // Register our service -- if somebody is already registered by our name, 45 // they will be killed (their thread pool will throw an exception). 46 android::status_t status = service->registerAsService(); 47 48 LOG_ALWAYS_FATAL_IF(status != android::OK, 49 "Could not register default Surround View Service (%d)", 50 status); 51 52 joinRpcThreadpool(); 53 54 // In normal operation, we don't expect the thread pool to exit 55 ALOGE("Surround View Service is shutting down"); 56 return 1; 57 } 58