Merge "Making software km implementation both backup and default" am: 67be8d72bf am: 803b6971a7 am: 81ff06ea77
Change-Id: I702b1742f8a970b8f1a779b87534e150315f3e89
diff --git a/keystore/key_store_service.cpp b/keystore/key_store_service.cpp
index 666b48a..75fcbde 100644
--- a/keystore/key_store_service.cpp
+++ b/keystore/key_store_service.cpp
@@ -1322,11 +1322,22 @@
}
Status KeyStoreService::onKeyguardVisibilityChanged(bool isShowing, int32_t userId,
- int32_t* aidl_return) {
+ int32_t* _aidl_return) {
+ if (isShowing) {
+ if (!checkBinderPermission(P_LOCK, UID_SELF)) {
+ LOG(WARNING) << "onKeyguardVisibilityChanged called with isShowing == true but "
+ "without LOCK permission";
+ return AIDL_RETURN(ResponseCode::PERMISSION_DENIED);
+ }
+ } else {
+ if (!checkBinderPermission(P_UNLOCK, UID_SELF)) {
+ LOG(WARNING) << "onKeyguardVisibilityChanged called with isShowing == false but "
+ "without UNLOCK permission";
+ return AIDL_RETURN(ResponseCode::PERMISSION_DENIED);
+ }
+ }
mKeyStore->getEnforcementPolicy().set_device_locked(isShowing, userId);
- *aidl_return = static_cast<int32_t>(ResponseCode::NO_ERROR);
-
- return Status::ok();
+ return AIDL_RETURN(ResponseCode::NO_ERROR);
}
} // namespace keystore