I am testing the android Key & Id attestation on several devices (phones & latest chromecast) with that sample code : https://github.com/vvb2060/KeyAttestation.
While the Key attestation works (generating a pair of key, getting the attestation and parsing the data, etc.), the ID attestation does not (obtaining the Hardware Identifiers of the device, Serial Number, IMEI, etc.).
Basically, I get the same result as the first answer to this question : Sample code showing how to use Android ID Attestation
From the other answers, I understand that these HW Identifiers must be provisioned to the TEE by the vendor prior the release of the device, which is optional and is confirmed here : https://source.android.com/security/keystore/attestation#hardware-identifiers. It means that if the device was not provisioned, it won't be possible to get these HW IDs, even if you make your app a system app (necessary condition to access the HW IDs number 2).
So, since the question I cited earlier is 3yrs old and I could not find more about that subject, did someone managed to make this work? With or without a system-app ?
Thx