summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEtan Cohen <etancohen@google.com>2019-11-27 09:44:55 -0800
committerEtan Cohen <etancohen@google.com>2019-12-01 21:12:29 -0800
commitfcbf7d2f22d957a1f04a0eb5638c28a95622dafa (patch)
tree4f6c522f7d1d0a932d97d63109d169bc14fe3ad4
parent547dd792ac36cee3d618e06e4bd07311fd430146 (diff)
downloadwificond-fcbf7d2f22d957a1f04a0eb5638c28a95622dafa.tar.gz
Revert "Revert "wificond: Move wifi keystore HAL service to wificond""
This reverts commit 2d21f55c8bc80611000246b6c125ff31af36a798. Change-Id: I9f2ddf5157e2b9040cb2f0dc5eb0b947591c9451
-rw-r--r--Android.bp16
-rw-r--r--main.cpp5
-rw-r--r--wifi_keystore_hal_connector.cpp50
-rw-r--r--wifi_keystore_hal_connector.h37
4 files changed, 106 insertions, 2 deletions
diff --git a/Android.bp b/Android.bp
index f021f4a..08e48da 100644
--- a/Android.bp
+++ b/Android.bp
@@ -30,17 +30,29 @@ cc_binary {
name: "wificond",
defaults: ["wificond_defaults"],
init_rc: ["wificond.rc"],
- srcs: ["main.cpp"],
+ srcs: [
+ "main.cpp",
+ "wifi_keystore_hal_connector.cpp"
+ ],
+ include_dirs: ["system/security/keystore/include"],
shared_libs: [
"libbinder",
"libbase",
"libcutils",
+ "libhidlbase",
+ "libkeystore_aidl",
+ "libkeystore_binder",
+ "libkeystore_parcelables",
"libminijail",
"libutils",
"libwifi-system-iface",
+ "android.system.wifi.keystore@1.0",
+ ],
+ static_libs: [
+ "libwificond", // Wificond daemon
+ "libwifikeystorehal" // Wifi Keystore HAL service
],
- static_libs: ["libwificond"],
}
//
diff --git a/main.cpp b/main.cpp
index f20a890..b6054b1 100644
--- a/main.cpp
+++ b/main.cpp
@@ -36,10 +36,12 @@
#include "wificond/net/netlink_utils.h"
#include "wificond/scanning/scan_utils.h"
#include "wificond/server.h"
+#include "wifi_keystore_hal_connector.h"
using android::net::wifi::IWificond;
using android::wifi_system::InterfaceTool;
using android::wificond::ipc_constants::kServiceName;
+using android::wificond::WifiKeystoreHalConnector;
using std::unique_ptr;
namespace {
@@ -128,6 +130,9 @@ int main(int argc, char** argv) {
&scan_utils));
RegisterServiceOrCrash(server.get());
+ WifiKeystoreHalConnector keystore_connector;
+ keystore_connector.start();
+
event_dispatcher->Poll();
LOG(INFO) << "wificond is about to exit";
return 0;
diff --git a/wifi_keystore_hal_connector.cpp b/wifi_keystore_hal_connector.cpp
new file mode 100644
index 0000000..271e444
--- /dev/null
+++ b/wifi_keystore_hal_connector.cpp
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <unistd.h>
+#include <sys/capability.h>
+
+#include <android-base/logging.h>
+#include <android-base/macros.h>
+#include <android/hidl/manager/1.2/IServiceManager.h>
+#include <android/system/wifi/keystore/1.0/IKeystore.h>
+#include <hidl/HidlTransportSupport.h>
+
+#include <wifikeystorehal/keystore.h>
+
+#include "wifi_keystore_hal_connector.h"
+
+using android::hardware::configureRpcThreadpool;
+using android::system::wifi::keystore::V1_0::IKeystore;
+using android::system::wifi::keystore::V1_0::implementation::Keystore;
+
+namespace android {
+namespace wificond {
+
+void WifiKeystoreHalConnector::start() {
+ /**
+ * Register the wifi keystore HAL service to run in passthrough mode.
+ * This will spawn off a new thread which will service the HIDL
+ * transactions.
+ */
+ configureRpcThreadpool(1, false /* callerWillJoin */);
+ android::sp<IKeystore> wifiKeystoreHalService = new Keystore();
+ android::status_t err = wifiKeystoreHalService->registerAsService();
+ CHECK(err == android::OK) << "Cannot register wifi keystore HAL service: " << err;
+}
+} // namespace wificond
+} // namespace android
+
diff --git a/wifi_keystore_hal_connector.h b/wifi_keystore_hal_connector.h
new file mode 100644
index 0000000..58c026e
--- /dev/null
+++ b/wifi_keystore_hal_connector.h
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef WIFICOND_WIFI_KEYSTORE_HAL_CONNECTOR_H_
+#define WIFICOND_WIFI_KEYSTORE_HAL_CONNECTOR_H_
+
+namespace android {
+namespace wificond {
+
+// Class for loading the wifi keystore HAL service.
+class WifiKeystoreHalConnector {
+ public:
+ WifiKeystoreHalConnector() = default;
+ ~WifiKeystoreHalConnector() = default;
+
+ void start();
+
+ DISALLOW_COPY_AND_ASSIGN(WifiKeystoreHalConnector);
+};
+
+} // namespace wificond
+} // namespace android
+
+#endif // WIFICOND_WIFI_KEYSTORE_HAL_CONNECTOR_H_