Allow native applications with UID as ROOT to perform attestation.

Attestation application ID is collected for the applications having
package names but for the native applications due to unavailibility of
package name, it was failing to get AAID. For example key attestation
tests were failing in native tests - keystore2_client_tests.

Changes are made to allow caller with UID as AID_ROOT to perform
attestaion with indicating caller package info as AndroidSystem.

Bug: 349350267
Test: atest keystore2_client_tests
Change-Id: I5cb8189c526df74f73c53f240df9665ba5ad0b79
diff --git a/keystore/keystore_attestation_id.cpp b/keystore/keystore_attestation_id.cpp
index d607fbf..bcd3318 100644
--- a/keystore/keystore_attestation_id.cpp
+++ b/keystore/keystore_attestation_id.cpp
@@ -49,7 +49,6 @@
 namespace {
 
 constexpr const char* kAttestationSystemPackageName = "AndroidSystem";
-constexpr const char* kUnknownPackageName = "UnknownPackage";
 constexpr const size_t kMaxAttempts = 3;
 constexpr const unsigned long kRetryIntervalUsecs = 500000;  // sleep for 500 ms
 
@@ -274,7 +273,7 @@
 StatusOr<std::vector<uint8_t>> gather_attestation_application_id(uid_t uid) {
     KeyAttestationApplicationId key_attestation_id;
 
-    if (uid == AID_SYSTEM) {
+    if (uid == AID_SYSTEM || uid == AID_ROOT) {
         /* Use a fixed ID for system callers */
         auto pinfo = KeyAttestationPackageInfo();
         pinfo.packageName = String16(kAttestationSystemPackageName);
@@ -301,8 +300,6 @@
             }
         }
 
-        // Package Manager call has failed, perform attestation but indicate that the
-        // caller is unknown.
         if (!status.isOk()) {
             ALOGW("package manager request for key attestation ID failed with: %s %d",
                   status.exceptionMessage().c_str(), status.exceptionCode());