@Override
 protected void onHandleIntent(Intent intent) {
   LogUtils.i("ver: " + getMyVersion(this));
   LogUtils.i("rooted: " + ShellUtils.checkRooted());
   if (isVpnRunning()) {
     LogUtils.i("manager is already running in vpn mode");
     sendBroadcast(new LaunchedIntent(true));
     return;
   }
   if (ping(false)) {
     LogUtils.i("manager is already running in root mode");
     sendBroadcast(new LaunchedIntent(false));
     return;
   }
   if (ping(true)) {
     LogUtils.i("Restart manager");
     try {
       ManagerProcess.kill();
       Thread.sleep(1000);
       if (ManagerProcess.exists()) {
         LogUtils.e("failed to restart manager", null);
       } else {
         LaunchService.execute(this);
       }
     } catch (Exception e) {
       handleFatalError(LogUtils.e("failed to stop exiting process", e));
     }
     return;
   }
   deployAndLaunch();
 }
 private void deployAndLaunch() {
   try {
     LogUtils.i("Kill existing manager process");
     LogUtils.i("try to kill manager process before launch");
     ManagerProcess.kill();
   } catch (Exception e) {
     LogUtils.e("failed to kill manager process before launch", e);
     LogUtils.i("failed to kill manager process before launch");
   }
   Deployer deployer = new Deployer(this);
   String fatalError = deployer.deploy();
   if (!fatalError.isEmpty()) {
     handleFatalError(fatalError);
     return;
   }
   updateConfigFile(this);
   LogUtils.i("Launching...");
   if (ShellUtils.checkRooted()) {
     fatalError = launch(false);
     if (fatalError.isEmpty()) {
       sendBroadcast(new LaunchedIntent(false));
     } else {
       handleFatalError(fatalError);
     }
   } else {
     if (Build.VERSION.SDK_INT < 14) {
       handleFatalError("[ROOT] is required");
       return;
     }
     fatalError = launch(true);
     if (fatalError.isEmpty()) {
       sendBroadcast(new LaunchedIntent(true));
     } else {
       handleFatalError(fatalError);
     }
   }
 }