• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2017 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 #include <unistd.h>
17 
18 #include <hidl/HidlTransportSupport.h>
19 #include <log/log.h>
20 #include <utils/Errors.h>
21 #include <utils/StrongPointer.h>
22 
23 #include "AudioControl.h"
24 
25 
26 // libhidl:
27 using android::hardware::configureRpcThreadpool;
28 using android::hardware::joinRpcThreadpool;
29 
30 // Generated HIDL files
31 using android::hardware::automotive::audiocontrol::V1_0::IAudioControl;
32 
33 // The namespace in which all our implementation code lives
34 using namespace android::hardware::automotive::audiocontrol::V1_0::implementation;
35 using namespace android;
36 
37 
38 // Main service entry point
main()39 int main() {
40     // Create an instance of our service class
41     android::sp<IAudioControl> service = new AudioControl();
42     configureRpcThreadpool(1, true /*callerWillJoin*/);
43 
44     if (service->registerAsService() != OK) {
45         ALOGE("registerAsService failed");
46         return 1;
47     }
48 
49     // Join (forever) the thread pool we created for the service above
50     joinRpcThreadpool();
51 
52     // We don't ever actually expect to return, so return an error if we do get here
53     return 2;
54 }