1 /*
2  * Copyright (C) 2019 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.input.classifier@1.0"
18 
19 #include <inttypes.h>
20 
21 #include <hidl/HidlTransportSupport.h>
22 #include <log/log.h>
23 
24 #include "InputClassifier.h"
25 #include "android/hardware/input/classifier/1.0/IInputClassifier.h"
26 
27 using android::sp;
28 using android::status_t;
29 using android::hardware::configureRpcThreadpool;
30 using android::hardware::joinRpcThreadpool;
31 using android::hardware::input::classifier::V1_0::IInputClassifier;
32 using android::hardware::input::classifier::V1_0::implementation::InputClassifier;
33 
main()34 int main() {
35     sp<IInputClassifier> classifier = new InputClassifier();
36 
37     configureRpcThreadpool(1, true);
38     const status_t status = classifier->registerAsService();
39 
40     if (status != android::OK) {
41         ALOGE("Could not register InputClassifier HAL!");
42         return EXIT_FAILURE;  // or handle error
43     }
44 
45     joinRpcThreadpool();
46     LOG_ALWAYS_FATAL("Under normal operation, joinRpcThreadpool should never return");
47     return EXIT_FAILURE;
48 }
49