title: How to check whether Android phone supports TEE?
body: <p>I have read this two posts: <a href="https://stackoverflow.com/questions/39828453/how-check-programmaticallly-tee-support-on-android">One</a> and <a href="https://stackoverflow.com/questions/39957052/does-the-android-keystore-make-use-of-the-trusted-execution-environment-tee-an">Two</a>, but I still have question.</p>
  
  <p>I use KeyStore (Android 9) to generate an AES key, and use <a href="https://developer.android.com/reference/android/security/keystore/KeyInfo#isInsideSecureHardware()" rel="noreferrer">isInsideSecureHardware()</a> method to check whether the key <strong><em>isInsideSecureHardware</em></strong>. I got return <strong><em>False</em></strong>. Sample code can be found <a href="https://blog.csdn.net/u012672300/article/details/62226309" rel="noreferrer">here</a>, and <a href="https://www.codota.com/code/java/methods/android.security.keystore.KeyInfo/isInsideSecureHardware" rel="noreferrer">here</a>.</p>
  
  <blockquote>
    <p>public boolean isInsideSecureHardware ()</p>
    
    <p>Returns true if the key resides inside secure hardware (e.g., Trusted Execution Environment (TEE) or Secure Element (SE)). Key material of such keys is available in plaintext only inside the secure hardware and is not exposed outside of it.</p>
  </blockquote>
  
  <p>Thus, I want to further confirm whether my phone device (Huawei P20) supports TEE.</p>
  
  <p>Question:</p>
  
  <ol>
  <li><p>If the phone supports TEE, the key generated by KeyStore will be store into TEE automatically? Do I Need any manually configuration in Java? I heard that keys will be automatically stored in TEE, as long as you use <strong><em>KeyStore.getInstance()</em></strong>, <strong><em>KeyGenerator
              .getInstance(algorithm, KeyStore Name)</em></strong>. But I am not sure this is True or Not?</p></li>
  <li><p>If the answer of Q1 is "Need manually configuration", it becomes the reason of <strong>isInsideSecureHardware</strong>() returns <strong>False</strong>, right? If the answer of Q1 is "automatically", ignore Q2.</p></li>
  <li><p>Any method to directly check whether the phone supports TEE, in Java? </p></li>
  </ol>