Skip to content
This repository has been archived by the owner on Oct 4, 2021. It is now read-only.

Commit

Permalink
Added su version matching to recognize kinguser
Browse files Browse the repository at this point in the history
  • Loading branch information
d4rken committed May 9, 2015
1 parent c953dd7 commit 1e5412c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
public class SuBinary implements Parcelable {

public enum Type {
SUPERSU, SUPERUSER, KINGROOT, UNKNOWN
SUPERSU, SUPERUSER, KINGUSER, UNKNOWN
}

final File mPath;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ public class SuBinaryTest extends ATest {
private static final String TAG = "RV:SuBinaryTest";
private static final Pattern KOUSH_SUPERUSER_PATTERN = Pattern.compile("^([0-9]{1,2})\\s([\\S]+)$");
private static final Pattern CF_SUPERSU_PATTERN = Pattern.compile("^([0-9\\.]*):(SUPERSU)$");
private static final Pattern KINGUSERSU_PATTERN = Pattern.compile("^([0-9\\.]*):(kinguser_su)$");

private List<String> mRaw;

public SuBinaryTest(Context context) {
Expand Down Expand Up @@ -138,6 +140,14 @@ private void checkBinary(SuBinary binary) {
binary.mExtra = kuMatcher.group(2);
break;
}
// SUPERUSER from kinguser e.g. "3.43:kinguser_su"
Matcher kingMatcher = KINGUSERSU_PATTERN.matcher(line);
if (kingMatcher.matches()) {
binary.mType = SuBinary.Type.KINGUSER;
binary.mVersion = kingMatcher.group(1);
binary.mExtra = kingMatcher.group(2);
break;
}
}
}
}
Expand Down

0 comments on commit 1e5412c

Please sign in to comment.