@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(); }