OSDN Git Service

Add OWNERS in system/connectivity/wificond am: 483bd8dcfd
[android-x86/system-connectivity-wificond.git] / main.cpp
index cf7db9b..9f10e4d 100644 (file)
--- a/main.cpp
+++ b/main.cpp
 #include <binder/ProcessState.h>
 #include <cutils/properties.h>
 #include <libminijail.h>
-#include <private/android_filesystem_config.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/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::wifi_system::SupplicantManager;
-using android::wificond::ipc_constants::kDevModePropertyKey;
-using android::wificond::ipc_constants::kDevModeServiceName;
 using android::wificond::ipc_constants::kServiceName;
 using std::unique_ptr;
 
@@ -100,19 +93,10 @@ void RegisterServiceOrCrash(const android::sp<android::IBinder>& service) {
   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);
 }
 
-void DoPrivilegedSetupOrCrash() {
-  // take ownership of the magic firmware change path
-  CHECK(chown(DriverTool::kFirmwareReloadPath, AID_WIFI, AID_WIFI) == 0)
-      << "Error changing ownership of '" << DriverTool::kFirmwareReloadPath
-      << "' to wifi:wifi, (" << strerror(errno) << ")";
-}
-
 void DropPrivilegesOrCrash() {
   minijail* j = minijail_new();
   CHECK(minijail_change_user(j, "wifi") == 0);
@@ -134,7 +118,6 @@ int main(int argc, char** argv) {
   android::base::InitLogging(argv, android::base::LogdLogger(android::base::SYSTEM));
   LOG(INFO) << "wificond is starting up...";
 
-  DoPrivilegedSetupOrCrash();
   DropPrivilegesOrCrash();
 
   unique_ptr<android::wificond::LooperBackedEventLoop> event_dispatcher(
@@ -153,13 +136,12 @@ int main(int argc, char** argv) {
   android::wificond::ScanUtils scan_utils(&netlink_manager);
 
   unique_ptr<android::wificond::Server> server(new android::wificond::Server(
-      unique_ptr<HalTool>(new HalTool),
       unique_ptr<InterfaceTool>(new InterfaceTool),
-      unique_ptr<DriverTool>(new DriverTool),
       unique_ptr<SupplicantManager>(new SupplicantManager()),
       unique_ptr<HostapdManager>(new HostapdManager()),
       &netlink_utils,
       &scan_utils));
+  server->CleanUpSystemState();
   RegisterServiceOrCrash(server.get());
 
   event_dispatcher->Poll();