Snap for 5622519 from c77e4768f57b6b71017399d995dab821405c92c4 to pi-platform-release

Change-Id: Ieaa8427c189fe9429c9f4d5ff71dd1e03215a0eb
diff --git a/keystore/Android.bp b/keystore/Android.bp
index 8d095e1..9ce00c2 100644
--- a/keystore/Android.bp
+++ b/keystore/Android.bp
@@ -76,13 +76,6 @@
         pdk: {
             enabled: false,
         },
-        debuggable: {
-            cflags: [
-                // Allow VTS tests running as root to have
-                // additional permissions.
-                "-DGRANT_ROOT_ALL_PERMISSIONS",
-            ],
-        },
     },
 
     required: ["keystore_cli_v2"],
diff --git a/keystore/keystore_client_impl.cpp b/keystore/keystore_client_impl.cpp
index 994e3f2..6d998ad 100644
--- a/keystore/keystore_client_impl.cpp
+++ b/keystore/keystore_client_impl.cpp
@@ -366,7 +366,7 @@
     int32_t result;
     auto binder_result = keystore_->exist(key_name16, kDefaultUID, &result);
     if (!binder_result.isOk()) return false;  // binder error
-    return result == static_cast<int32_t>(ResponseCode::NO_ERROR);
+    return result;
 }
 
 bool KeystoreClientImpl::listKeys(const std::string& prefix,
diff --git a/keystore/permissions.cpp b/keystore/permissions.cpp
index b297c59..1ba91d9 100644
--- a/keystore/permissions.cpp
+++ b/keystore/permissions.cpp
@@ -68,14 +68,7 @@
     {AID_SYSTEM, static_cast<perm_t>((uint32_t)(~0))},
     {AID_VPN, static_cast<perm_t>(P_GET | P_SIGN | P_VERIFY)},
     {AID_WIFI, static_cast<perm_t>(P_GET | P_SIGN | P_VERIFY)},
-    {AID_BLUETOOTH, static_cast<perm_t>(P_GET | P_INSERT | P_DELETE | P_EXIST | P_SIGN | P_VERIFY)},
-
-#ifdef GRANT_ROOT_ALL_PERMISSIONS
-    // Allow VTS tests running as root to perform all operations
-    {AID_ROOT, static_cast<perm_t>((uint32_t)(~0))},
-#else
     {AID_ROOT, static_cast<perm_t>(P_GET)},
-#endif
 };
 
 static const perm_t DEFAULT_PERMS = static_cast<perm_t>(