ashishpnd7 / sandrop

Automatically exported from code.google.com/p/sandrop
0 stars 0 forks source link

'/system/app/Superuser.apk' is not the way to detect 'su' #33

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
My phone is rooted, and so has 'su' program, but sandrop don't detect it 
because of its root detection method.

I had to link /system/app/Superuser.apk to the actual file that is for me : 
com.noshufou.android.su.apk

Original issue reported on code.google.com by bate...@bat.fr.eu.org on 11 Jul 2012 at 1:10

GoogleCodeExporter commented 9 years ago
Yes.
There should be better checking of su. Also caching result looks not so right.
Sorry for that. It will be improved. Any sugesstions? Looking for file 
/system/xbin/su

Now it is:

/**
* Checks if the phone is rooted.
* 
* @return <code>true</code> if the phone is rooted, <code>false</code>
* otherwise.
*/
public static boolean isPhoneRooted() {

     if (phoneRooted || (lastRootCheck != null && lastRootCheck.getTime() > System.currentTimeMillis() - 5000))
     {
         return phoneRooted;
     }

      // get from build info
      String buildTags = android.os.Build.TAGS;
      if (buildTags != null && buildTags.contains("test-keys")) {
          phoneRooted = true;
          lastRootCheck = new Date(System.currentTimeMillis());
          return true;
      }

      // check if /system/app/Superuser.apk is present
      try {
        File file = new File("/system/app/Superuser.apk");
        if (file.exists()) {
          phoneRooted = true;
          lastRootCheck = new Date(System.currentTimeMillis());
          return true;
        }
      } catch (Throwable e1) {
        // ignore
      }
      phoneRooted = false;
      lastRootCheck = new Date(System.currentTimeMillis());
      return false;
}

Original comment by supp.san...@gmail.com on 11 Jul 2012 at 5:47

GoogleCodeExporter commented 9 years ago
Probably something like this code.

// public static boolean findBinary(String binaryName) { //

http://code.google.com/p/roottools/source/browse/trunk/Stable/RootTools-sdk3-gen
eric/src/com/stericson/RootTools/RootTools.java#578

Original comment by supp.san...@gmail.com on 11 Jul 2012 at 5:58

GoogleCodeExporter commented 9 years ago

Original comment by supp.san...@gmail.com on 11 Jul 2012 at 5:58

GoogleCodeExporter commented 9 years ago

Original comment by supp.san...@gmail.com on 12 Jul 2012 at 8:44

GoogleCodeExporter commented 9 years ago

Original comment by supp.san...@gmail.com on 13 Jul 2012 at 5:02