diff options
author | Todd Frederick <tfred@google.com> | 2023-12-11 22:46:37 +0000 |
---|---|---|
committer | Todd Frederick <tfred@google.com> | 2024-04-01 17:21:12 +0000 |
commit | 4c35a6c5182d35652ca7389bff26002503c30475 (patch) | |
tree | 7655c0997a52e274ed5e9ff6a7a31bd5a876f449 | |
parent | 81f526944e75d9882cadf5851482a161798f96e8 (diff) | |
download | keymint-main.tar.gz |
Ensure that a wakelock is held whenever a logical channel to the eSE is
open and a CLOCK_BOOTTIME_ALARM timer is not set in order to prevent the
AP from both sleeping when the eSE is active and staying asleep when the
eSE channel should be closed.
Bug: 292153851
Bug: 295559443
Test: Check eSE logs after KeyMint/Weaver operations
Change-Id: I4728ca45b77ebc4b14310f7c886aaebdd094a914
-rw-r--r-- | transport/Android.bp | 1 | ||||
-rw-r--r-- | transport/OmapiTransport.cpp | 9 |
2 files changed, 8 insertions, 2 deletions
diff --git a/transport/Android.bp b/transport/Android.bp index 6e24665..3c779d5 100644 --- a/transport/Android.bp +++ b/transport/Android.bp @@ -65,6 +65,7 @@ cc_library { "libcutils", "libutils", "libhardware", + "libhardware_legacy", "libhidlbase", "libbinder_ndk", ], diff --git a/transport/OmapiTransport.cpp b/transport/OmapiTransport.cpp index 78b5d1f..928c21d 100644 --- a/transport/OmapiTransport.cpp +++ b/transport/OmapiTransport.cpp @@ -47,6 +47,7 @@ #include <android-base/logging.h> #include <android-base/stringprintf.h> +#include <hardware_legacy/power.h> #include <EseTransportUtils.h> #include <IntervalTimer.h> @@ -63,6 +64,7 @@ namespace keymint::javacard { std::string const ESE_READER_PREFIX = "eSE"; constexpr const char omapiServiceName[] = "android.se.omapi.ISecureElementService/default"; +constexpr const char kChannelWakelockName[] = "nxp_keymint_channel"; class SEListener : public ::aidl::android::se::omapi::BnSecureElementListener {}; @@ -258,11 +260,14 @@ bool OmapiTransport::sendData(const vector<uint8_t>& inData, vector<uint8_t>& ou if (eSEReader != nullptr) { LOG(DEBUG) << "Sending apdu data to secure element: " << ESE_READER_PREFIX; + acquire_wake_lock(PARTIAL_WAKE_LOCK, kChannelWakelockName); #ifdef NXP_EXTNS - return internalProtectedTransmitApdu(eSEReader, std::move(apdu), output); + bool status = internalProtectedTransmitApdu(eSEReader, std::move(apdu), output); #else - return internalTransmitApdu(eSEReader, apdu, output); + bool status = internalTransmitApdu(eSEReader, apdu, output); #endif + release_wake_lock(kChannelWakelockName); + return status; } else { LOG(ERROR) << "secure element reader " << ESE_READER_PREFIX << " not found"; return false; |