Android root detection using assembly tags?

The following method is one of the ways in which we can programmatically determine if an Android device is connected:

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 assembly tag "test-keys" and what should it do with root? I could not find relevant information from Google.

+4
source share
2 answers

Release-Keys and Test-Keys are related to how the kernel is signed during compilation. Release-Keys means that it was signed with the official key from the official developer. Test-Keys means that it was signed using a custom key created by a third-party developer. From a security point of view, Release-Keys usually means that the kernel is more secure, which is not always the case.

+5
source
 String buildTags = android.os.Build.TAGS; 

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

For your second question, I cannot make sure that it will work, because my line is ro.build.tags release-keys in my root device.

+1
source

Source: https://habr.com/ru/post/1502226/


All Articles