Snap for 5339334 from cfe00de661cedfad6295fc8713a5da3b48031cb2 to pi-qpr3-release
Change-Id: I9916a94201eafab7d209fa08c0343b550dff7830
diff --git a/keystore/Android.bp b/keystore/Android.bp
index 9ce00c2..8d095e1 100644
--- a/keystore/Android.bp
+++ b/keystore/Android.bp
@@ -76,6 +76,13 @@
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 6d998ad..994e3f2 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;
+ return result == static_cast<int32_t>(ResponseCode::NO_ERROR);
}
bool KeystoreClientImpl::listKeys(const std::string& prefix,
diff --git a/keystore/permissions.cpp b/keystore/permissions.cpp
index 1ba91d9..b297c59 100644
--- a/keystore/permissions.cpp
+++ b/keystore/permissions.cpp
@@ -68,7 +68,14 @@
{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>(