Programmatically check if Android phone has TEE and what TEE vendor it is - Trustonic, OPTEE, Qualcomm's QSEE, etc?


Some features of my Android app are depending on a TEE (Trusted Execution Environment / ARM TrustZone) being present on the phone. How from my Java app can I detect if this phone has a TEE installed, and if so, what vendor's TEE it is? Thanks!




1 Answer

I would suggest the following approach (not tested):

1 - get a list of all running processes

List of system processes is not available through Android SDK API, so we would use Runtime.exec(...) to execute OS command and to capture its output into string variable. We would use /system/bin/ps (but we could have used /proc and then do some proc output parsing)

String cmd = "/system/bin/ps"; // alternative cmd would be "/proc" but then we would need to loop through proc subdirectories, etc
// run cmd and read its output into string
java.util.Scanner s = new java.util.Scanner(Runtime.getRuntime().exec(cmd).getInputStream()).useDelimiter("\\A");
String cmdRes = s.hasNext() ? : "";

2 - loop through the list trying to find known TEE client drivers


Too many commands? Learning new language? is a free tool that allows you to save your favorite scripts and commands, then quickly find and copy-paste your commands with just few clicks.

Boost your daily productivity with!

Post Answer