9

The following method is one of the ways we can programatically detect if an android device is rooted:

public boolean checkRootMethod1(){
    String buildTags = android.os.Build.TAGS;

    if (buildTags != null && buildTags.contains("test-keys")) {
        return true;
    }
    return false;
}

Can someone explain what this is actually doing? What is the "test-keys" build tag, and what does it have to do with root? I couldn't find any relevant information from google.

2 Answers 2

10

Release-Keys and Test-Keys has to do with how the kernel is signed when it is compiled. Release-Keys means it was signed with an official Key from an official developer. Test-Keys means it was signed with a custom key generated by a third-party developer. From a security standpoint Release-Keys generally means the kernel is more secure, which is not always the case.

1
  • It says test-keys when the build is signed with the public AOSP test keys, not when a custom key is used. It will say release-keys when the build is signed using proper keys, third party or not.
    – strcat
    Jun 24, 2017 at 11:38
2
String buildTags = android.os.Build.TAGS;

This code is for getting build.prop located in /system/build.prop. As you can see you are getting android.os.Build.TAGS that means you are getting ro.build.tags value inside build.prop. here is the code of build.java

For your second question I can not make sure it will work because my ro.build.tags string is release-keys in my rooted device.

2
  • Do you know what the keys mean exactly? Sep 15, 2013 at 7:24
  • 4
    Better question - What is the difference between release-keys and test-keys? Sep 15, 2013 at 22:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.