1 // Copyright (C) 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 #define LOG_TAG "audio_proxy_service" 16 17 #include <hidl/HidlTransportSupport.h> 18 #include <utils/Log.h> 19 20 #include "AudioProxyDevicesManagerImpl.h" 21 #include "DevicesFactoryImpl.h" 22 23 using ::android::sp; 24 using ::android::status_t; 25 using ::audio_proxy::service::DevicesFactoryImpl; 26 27 namespace { registerAudioProxyDevicesManager()28status_t registerAudioProxyDevicesManager() { 29 sp<audio_proxy::service::AudioProxyDevicesManagerImpl> manager = 30 new audio_proxy::service::AudioProxyDevicesManagerImpl(); 31 return manager->registerAsService(); 32 } 33 } // namespace 34 main(int argc,char ** argv)35int main(int argc, char** argv) { 36 android::hardware::configureRpcThreadpool(1, true /* callerWillJoin */); 37 38 status_t status = registerAudioProxyDevicesManager(); 39 if (status != android::OK) { 40 ALOGE("fail to register devices factory manager: %x", status); 41 return -1; 42 } 43 44 ::android::hardware::joinRpcThreadpool(); 45 46 // `joinRpcThreadpool` should never return. Return -2 here for unexpected 47 // process exit. 48 return -2; 49 } 50