public static void exit() { DeviceChangedListener.stop(); if (phoneWatchdog != null) { phoneWatchdog.done(); try { phoneWatchdog.join(); } catch (Exception e) { } } MyLogger.writeFile(); System.exit(0); }
public static void init(boolean withadb) { MyLogger.disableTextArea(); MyLogger.setLevel("info"); MyLogger.getLogger().info("Flashtool " + About.getVersion()); FlasherGUI.guimode = false; if (withadb) { StatusListener phoneStatus = new StatusListener() { public void statusChanged(StatusEvent e) { if (!e.isDriverOk()) { MyLogger.getLogger().error("Drivers need to be installed for connected device."); MyLogger.getLogger().error("You can find them in the drivers folder of Flashtool."); } else { if (e.getNew().equals("adb")) { MyLogger.getLogger().info("Device connected with USB debugging on"); MyLogger.getLogger().debug("Device connected, continuing with identification"); doIdent(); } if (e.getNew().equals("none")) { MyLogger.getLogger().info("Device disconnected"); } if (e.getNew().equals("flash")) { MyLogger.getLogger().info("Device connected in flash mode"); } if (e.getNew().equals("fastboot")) { MyLogger.getLogger().info("Device connected in fastboot mode"); } if (e.getNew().equals("normal")) { MyLogger.getLogger().info("Device connected with USB debugging off"); MyLogger.getLogger() .info("For 2011 devices line, be sure you are not in MTP mode"); } } } }; phoneWatchdog = new AdbPhoneThread(); phoneWatchdog.start(); phoneWatchdog.addStatusListener(phoneStatus); } else DeviceChangedListener.start(); }