diff options
author | TreeHugger Robot <treehugger-gerrit@google.com> | 2018-02-27 22:26:30 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2018-02-27 22:26:30 +0000 |
commit | eec88d343a1105d4da5c108c49258e2ccc131f4a (patch) | |
tree | a03faf8799c043713d02f13c38aff4c59b5f18bd | |
parent | 64ec1fefbd40956fa8544bf34922cff55e96f997 (diff) | |
parent | 1a49231d4a31d3a8a42ef345f03063852c19de2f (diff) | |
download | security-eec88d343a1105d4da5c108c49258e2ccc131f4a.tar.gz |
Merge "Add isConfirmationPromptSupported() method."
-rw-r--r-- | keystore/binder/android/security/IKeystoreService.aidl | 1 | ||||
-rw-r--r-- | keystore/confirmation_manager.cpp | 13 | ||||
-rw-r--r-- | keystore/confirmation_manager.h | 3 | ||||
-rw-r--r-- | keystore/key_store_service.cpp | 4 | ||||
-rw-r--r-- | keystore/key_store_service.h | 1 |
5 files changed, 22 insertions, 0 deletions
diff --git a/keystore/binder/android/security/IKeystoreService.aidl b/keystore/binder/android/security/IKeystoreService.aidl index a4c631d9..538dd280 100644 --- a/keystore/binder/android/security/IKeystoreService.aidl +++ b/keystore/binder/android/security/IKeystoreService.aidl @@ -84,4 +84,5 @@ interface IKeystoreService { int presentConfirmationPrompt(IBinder listener, String promptText, in byte[] extraData, in String locale, in int uiOptionsAsFlags); int cancelConfirmationPrompt(IBinder listener); + boolean isConfirmationPromptSupported(); } diff --git a/keystore/confirmation_manager.cpp b/keystore/confirmation_manager.cpp index d8c53784..acca3045 100644 --- a/keystore/confirmation_manager.cpp +++ b/keystore/confirmation_manager.cpp @@ -115,6 +115,19 @@ Status ConfirmationManager::cancelConfirmationPrompt(const sp<IBinder>& listener return Status::ok(); } +// Called by keystore main thread. +Status ConfirmationManager::isConfirmationPromptSupported(bool* aidl_return) { + sp<IConfirmationUI> confirmationUI = IConfirmationUI::tryGetService(); + if (confirmationUI == nullptr) { + ALOGW("Error getting confirmationUI service\n"); + *aidl_return = false; + return Status::ok(); + } + + *aidl_return = true; + return Status::ok(); +} + void ConfirmationManager::finalizeTransaction(ConfirmationResponseCode responseCode, hidl_vec<uint8_t> dataThatWasConfirmed, bool callAbortOnHal) { diff --git a/keystore/confirmation_manager.h b/keystore/confirmation_manager.h index 4bf4b8d6..b92dedaf 100644 --- a/keystore/confirmation_manager.h +++ b/keystore/confirmation_manager.h @@ -61,6 +61,9 @@ class ConfirmationManager : public android::hardware::hidl_death_recipient, Status cancelConfirmationPrompt(const android::sp<android::IBinder>& listener, int32_t* aidl_return); + // Checks if the confirmationUI HAL is available. + Status isConfirmationPromptSupported(bool* aidl_return); + // Gets the latest confirmation token received from the ConfirmationUI HAL. hidl_vec<uint8_t> getLatestConfirmationToken(); diff --git a/keystore/key_store_service.cpp b/keystore/key_store_service.cpp index 78906102..aab3db1f 100644 --- a/keystore/key_store_service.cpp +++ b/keystore/key_store_service.cpp @@ -1787,6 +1787,10 @@ Status KeyStoreService::cancelConfirmationPrompt(const sp<IBinder>& listener, return mConfirmationManager->cancelConfirmationPrompt(listener, aidl_return); } +Status KeyStoreService::isConfirmationPromptSupported(bool* aidl_return) { + return mConfirmationManager->isConfirmationPromptSupported(aidl_return); +} + /** * Prune the oldest pruneable operation. */ diff --git a/keystore/key_store_service.h b/keystore/key_store_service.h index ce809f87..70a56ca3 100644 --- a/keystore/key_store_service.h +++ b/keystore/key_store_service.h @@ -175,6 +175,7 @@ class KeyStoreService : public android::security::BnKeystoreService, ::android::binder::Status cancelConfirmationPrompt(const ::android::sp<::android::IBinder>& listener, int32_t* _aidl_return) override; + ::android::binder::Status isConfirmationPromptSupported(bool* _aidl_return) override; private: static const int32_t UID_SELF = -1; |