Beispiel #1
0
 public static String identFromRecognition() {
   Enumeration<Object> e = Devices.listDevices(true);
   if (!e.hasMoreElements()) {
     MyLogger.getLogger().error("No device is registered in Flashtool.");
     MyLogger.getLogger().error("You can only flash devices.");
     return "";
   }
   boolean found = false;
   Properties founditems = new Properties();
   founditems.clear();
   Properties buildprop = new Properties();
   buildprop.clear();
   while (e.hasMoreElements()) {
     DeviceEntry current = Devices.getDevice((String) e.nextElement());
     String prop = current.getBuildProp();
     if (!buildprop.containsKey(prop)) {
       String readprop = DeviceProperties.getProperty(prop);
       buildprop.setProperty(prop, readprop);
     }
     Iterator<String> i = current.getRecognitionList().iterator();
     String localdev = buildprop.getProperty(prop);
     while (i.hasNext()) {
       String pattern = i.next().toUpperCase();
       if (localdev.toUpperCase().equals(pattern)) {
         founditems.put(current.getId(), current.getName());
       }
     }
   }
   if (founditems.size() == 1) {
     return (String) founditems.keys().nextElement();
   } else return "";
 }
Beispiel #2
0
 public static String getVariantName(String dev) {
   Enumeration<Object> e = Devices.listDevices(true);
   while (e.hasMoreElements()) {
     DeviceEntry current = Devices.getDevice((String) e.nextElement());
     if (current.getVariantList().contains(dev)) return current.getName() + " (" + dev + ")";
   }
   return dev;
 }
Beispiel #3
0
 public static void doIdent() {
   Enumeration<Object> e = Devices.listDevices(true);
   if (!e.hasMoreElements()) {
     MyLogger.getLogger().error("No device is registered in Flashtool.");
     MyLogger.getLogger().error("You can only flash devices.");
     return;
   }
   boolean found = false;
   Properties founditems = new Properties();
   founditems.clear();
   Properties buildprop = new Properties();
   buildprop.clear();
   while (e.hasMoreElements()) {
     DeviceEntry current = Devices.getDevice((String) e.nextElement());
     String prop = current.getBuildProp();
     if (!buildprop.containsKey(prop)) {
       String readprop = DeviceProperties.getProperty(prop);
       buildprop.setProperty(prop, readprop);
     }
     Iterator<String> i = current.getRecognitionList().iterator();
     String localdev = buildprop.getProperty(prop);
     while (i.hasNext()) {
       String pattern = i.next().toUpperCase();
       if (localdev.toUpperCase().contains(pattern)) {
         founditems.put(current.getId(), current.getName());
       }
     }
   }
   if (founditems.size() == 1) {
     found = true;
     Devices.setCurrent((String) founditems.keys().nextElement());
     if (!Devices.isWaitingForReboot())
       MyLogger.getLogger().info("Connected device : " + Devices.getCurrent().getId());
   } else {
     MyLogger.getLogger().error("Cannot identify your device.");
     MyLogger.getLogger().error("You can only flash devices.");
   }
   if (found) {
     if (!Devices.isWaitingForReboot()) {
       MyLogger.getLogger()
           .info(
               "Installed version of busybox : "
                   + Devices.getCurrent().getInstalledBusyboxVersion());
       MyLogger.getLogger()
           .info(
               "Android version : "
                   + Devices.getCurrent().getVersion()
                   + " / kernel version : "
                   + Devices.getCurrent().getKernelVersion());
     }
     if (Devices.getCurrent().isRecovery()) {
       MyLogger.getLogger().info("Phone in recovery mode");
       if (!Devices.isWaitingForReboot()) MyLogger.getLogger().info("Root Access Allowed");
     } else {
       boolean hasSU = Devices.getCurrent().hasSU();
       if (hasSU) {
         boolean hasRoot = Devices.getCurrent().hasRoot();
         if (hasRoot)
           if (!Devices.isWaitingForReboot()) MyLogger.getLogger().info("Root Access Allowed");
       }
     }
     plugins.clear();
     addDevicesPlugins();
     addGenericPlugins();
     MyLogger.getLogger().debug("Stop waiting for device");
     if (Devices.isWaitingForReboot()) Devices.stopWaitForReboot();
     MyLogger.getLogger().debug("End of identification");
   }
 }