• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #include <unistd.h>
18 #include <sys/capability.h>
19 
20 #include <android-base/logging.h>
21 #include <android-base/macros.h>
22 #include <android/hidl/manager/1.2/IServiceManager.h>
23 #include <android/system/wifi/keystore/1.0/IKeystore.h>
24 #include <hidl/HidlTransportSupport.h>
25 
26 #include <wifikeystorehal/keystore.h>
27 
28 #include "wifi_keystore_hal_connector.h"
29 
30 using android::hardware::configureRpcThreadpool;
31 using android::system::wifi::keystore::V1_0::IKeystore;
32 using android::system::wifi::keystore::V1_0::implementation::Keystore;
33 
34 namespace android {
35 namespace wificond {
36 
start()37 void WifiKeystoreHalConnector::start() {
38   /**
39    * Register the wifi keystore HAL service to run in passthrough mode.
40    * This will spawn off a new thread which will service the HIDL
41    * transactions.
42    */
43   configureRpcThreadpool(1, false /* callerWillJoin */);
44   android::sp<IKeystore> wifiKeystoreHalService = new Keystore();
45   android::status_t err = wifiKeystoreHalService->registerAsService();
46   CHECK(err == android::OK) << "Cannot register wifi keystore HAL service: " << err;
47 }
48 }  // namespace wificond
49 }  // namespace android
50 
51