xref: /aosp_15_r20/frameworks/av/services/audioparameterparser/main.cpp (revision ec779b8e0859a360c3d303172224686826e6e0e1)
1*ec779b8eSAndroid Build Coastguard Worker /*
2*ec779b8eSAndroid Build Coastguard Worker  * Copyright (C) 2024 The Android Open Source Project
3*ec779b8eSAndroid Build Coastguard Worker  *
4*ec779b8eSAndroid Build Coastguard Worker  * Licensed under the Apache License, Version 2.0 (the "License");
5*ec779b8eSAndroid Build Coastguard Worker  * you may not use this file except in compliance with the License.
6*ec779b8eSAndroid Build Coastguard Worker  * You may obtain a copy of the License at
7*ec779b8eSAndroid Build Coastguard Worker  *
8*ec779b8eSAndroid Build Coastguard Worker  *      http://www.apache.org/licenses/LICENSE-2.0
9*ec779b8eSAndroid Build Coastguard Worker  *
10*ec779b8eSAndroid Build Coastguard Worker  * Unless required by applicable law or agreed to in writing, software
11*ec779b8eSAndroid Build Coastguard Worker  * distributed under the License is distributed on an "AS IS" BASIS,
12*ec779b8eSAndroid Build Coastguard Worker  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13*ec779b8eSAndroid Build Coastguard Worker  * See the License for the specific language governing permissions and
14*ec779b8eSAndroid Build Coastguard Worker  * limitations under the License.
15*ec779b8eSAndroid Build Coastguard Worker  */
16*ec779b8eSAndroid Build Coastguard Worker 
17*ec779b8eSAndroid Build Coastguard Worker #define LOG_TAG "Audio_ParameterParser"
18*ec779b8eSAndroid Build Coastguard Worker #include <android-base/logging.h>
19*ec779b8eSAndroid Build Coastguard Worker #include <android/binder_manager.h>
20*ec779b8eSAndroid Build Coastguard Worker #include <android/binder_process.h>
21*ec779b8eSAndroid Build Coastguard Worker 
22*ec779b8eSAndroid Build Coastguard Worker #include "ParameterParser.h"
23*ec779b8eSAndroid Build Coastguard Worker 
24*ec779b8eSAndroid Build Coastguard Worker using vendor::audio::parserservice::ParameterParser;
25*ec779b8eSAndroid Build Coastguard Worker 
main()26*ec779b8eSAndroid Build Coastguard Worker int main() {
27*ec779b8eSAndroid Build Coastguard Worker     // This is a debug implementation, always enable debug logging.
28*ec779b8eSAndroid Build Coastguard Worker     android::base::SetMinimumLogSeverity(::android::base::DEBUG);
29*ec779b8eSAndroid Build Coastguard Worker 
30*ec779b8eSAndroid Build Coastguard Worker     auto parser = ndk::SharedRefBase::make<ParameterParser>();
31*ec779b8eSAndroid Build Coastguard Worker     const std::string parserFqn =
32*ec779b8eSAndroid Build Coastguard Worker             std::string().append(ParameterParser::descriptor).append("/default");
33*ec779b8eSAndroid Build Coastguard Worker     binder_status_t status =
34*ec779b8eSAndroid Build Coastguard Worker             AServiceManager_addService(parser->asBinder().get(), parserFqn.c_str());
35*ec779b8eSAndroid Build Coastguard Worker     if (status != STATUS_OK) {
36*ec779b8eSAndroid Build Coastguard Worker         LOG(ERROR) << "failed to register service for \"" << parserFqn << "\"";
37*ec779b8eSAndroid Build Coastguard Worker     }
38*ec779b8eSAndroid Build Coastguard Worker 
39*ec779b8eSAndroid Build Coastguard Worker     ABinderProcess_joinThreadPool();
40*ec779b8eSAndroid Build Coastguard Worker     return EXIT_FAILURE;  // should not reach
41*ec779b8eSAndroid Build Coastguard Worker }
42