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 **
18 ** The original Work has been changed by NXP.
19 **
20 ** Licensed under the Apache License, Version 2.0 (the "License");
21 ** you may not use this file except in compliance with the License.
22 ** You may obtain a copy of the License at
23 **
24 ** http://www.apache.org/licenses/LICENSE-2.0
25 **
26 ** Unless required by applicable law or agreed to in writing, software
27 ** distributed under the License is distributed on an "AS IS" BASIS,
28 ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
29 ** See the License for the specific language governing permissions and
30 ** limitations under the License.
31 **
32 ** Copyright 2022 NXP
33 **
34 *********************************************************************************/
35 #define LOG_TAG "authsecret.nxp-service"
36
37 #include <android-base/logging.h>
38 #include <android/binder_manager.h>
39 #include <android/binder_process.h>
40
41 #include "AuthSecret.h"
42
43 using ::aidl::android::hardware::authsecret::AuthSecret;
44
main()45 int main() {
46 ABinderProcess_setThreadPoolMaxThreadCount(0);
47 std::shared_ptr<AuthSecret> authsecret = ndk::SharedRefBase::make<AuthSecret>();
48
49 const std::string instance = std::string() + AuthSecret::descriptor + "/default";
50 LOG(INFO) << "adding authsecret service instance: " << instance;
51 binder_status_t status = AServiceManager_addService(
52 authsecret->asBinder().get(), instance.c_str());
53 CHECK_EQ(status, STATUS_OK);
54
55 ABinderProcess_joinThreadPool();
56 return -1; // Should never be reached
57 }
58