Allow the keystore grant mechanism to work without a screenlock
Test: atest CtsKeystoreTestCases
Bug: 74345822
Change-Id: I88c5ce50725423721d6e3f3364d00bec8472b903
diff --git a/keystore/key_store_service.cpp b/keystore/key_store_service.cpp
index aab3db1..986d466 100644
--- a/keystore/key_store_service.cpp
+++ b/keystore/key_store_service.cpp
@@ -593,7 +593,8 @@
Status KeyStoreService::grant(const String16& name, int32_t granteeUid,
::android::String16* aidl_return) {
uid_t callingUid = IPCThreadState::self()->getCallingUid();
- auto result = checkBinderPermissionAndKeystoreState(P_GRANT);
+ auto result =
+ checkBinderPermissionAndKeystoreState(P_GRANT, /*targetUid=*/-1, /*checkUnlocked=*/false);
if (!result.isOk()) {
*aidl_return = String16();
return Status::ok();
@@ -614,7 +615,8 @@
Status KeyStoreService::ungrant(const String16& name, int32_t granteeUid, int32_t* aidl_return) {
uid_t callingUid = IPCThreadState::self()->getCallingUid();
- KeyStoreServiceReturnCode result = checkBinderPermissionAndKeystoreState(P_GRANT);
+ KeyStoreServiceReturnCode result =
+ checkBinderPermissionAndKeystoreState(P_GRANT, /*targetUid=*/-1, /*checkUnlocked=*/false);
if (!result.isOk()) {
*aidl_return = static_cast<int32_t>(result);
return Status::ok();