*/
#include <unistd.h>
+#include <sys/capability.h>
#include <csignal>
#include <memory>
#include <binder/IServiceManager.h>
#include <binder/ProcessState.h>
#include <cutils/properties.h>
+#include <libminijail.h>
#include <utils/String16.h>
-#include <wifi_hal/driver_tool.h>
-#include <wifi_system/hal_tool.h>
#include <wifi_system/interface_tool.h>
#include "wificond/ipc_constants.h"
#include "wificond/looper_backed_event_loop.h"
+#include "wificond/net/netlink_manager.h"
+#include "wificond/net/netlink_utils.h"
+#include "wificond/scanning/scan_utils.h"
#include "wificond/server.h"
using android::net::wifi::IWificond;
-using android::wifi_hal::DriverTool;
-using android::wifi_system::HalTool;
+using android::wifi_system::HostapdManager;
using android::wifi_system::InterfaceTool;
-using android::wificond::ipc_constants::kDevModePropertyKey;
-using android::wificond::ipc_constants::kDevModeServiceName;
+using android::wifi_system::SupplicantManager;
using android::wificond::ipc_constants::kServiceName;
using std::unique_ptr;
android::sp<android::IServiceManager> sm = android::defaultServiceManager();
CHECK_EQ(sm != NULL, true) << "Could not obtain IServiceManager";
- const int8_t dev_mode_on = property_get_bool(kDevModePropertyKey, 0);
- const char* service_name = (dev_mode_on) ? kDevModeServiceName : kServiceName;
- CHECK_EQ(sm->addService(android::String16(service_name), service),
+ CHECK_EQ(sm->addService(android::String16(kServiceName), service),
android::NO_ERROR);
}
android::wificond::EventLoop::kModeInput,
&OnBinderReadReady)) << "Failed to watch binder FD";
+ android::wificond::NetlinkManager netlink_manager(event_dispatcher.get());
+ CHECK(netlink_manager.Start()) << "Failed to start netlink manager";
+ android::wificond::NetlinkUtils netlink_utils(&netlink_manager);
+ android::wificond::ScanUtils scan_utils(&netlink_manager);
- android::sp<android::IBinder> server = new android::wificond::Server(
- unique_ptr<HalTool>(new HalTool),
+ unique_ptr<android::wificond::Server> server(new android::wificond::Server(
unique_ptr<InterfaceTool>(new InterfaceTool),
- unique_ptr<DriverTool>(new DriverTool));
- RegisterServiceOrCrash(server);
+ unique_ptr<SupplicantManager>(new SupplicantManager()),
+ unique_ptr<HostapdManager>(new HostapdManager()),
+ &netlink_utils,
+ &scan_utils));
+ server->CleanUpSystemState();
+ RegisterServiceOrCrash(server.get());
event_dispatcher->Poll();
LOG(INFO) << "wificond is about to exit";