diff options
author | Janis Danisevskis <jdanis@google.com> | 2018-06-29 00:14:36 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2018-06-29 00:14:36 +0000 |
commit | b18f019874be125d22fe12c00c7a19506a6dcf80 (patch) | |
tree | 3e2ebc1f97ad5b97c3c830e04f94391d5cbeb1d8 | |
parent | b655eb785df12fa56c8a896401969131fa33c5d9 (diff) | |
parent | 13f1445c69e2bd1a0ab4fd0f6c7ad4d7488ed93b (diff) | |
download | android-b18f019874be125d22fe12c00c7a19506a6dcf80.tar.gz |
Merge "[keymaster] Fix race condition at bootup"
-rw-r--r-- | hals/keymaster/KeymasterDevice.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/hals/keymaster/KeymasterDevice.cpp b/hals/keymaster/KeymasterDevice.cpp index 635ede4..37da3f0 100644 --- a/hals/keymaster/KeymasterDevice.cpp +++ b/hals/keymaster/KeymasterDevice.cpp @@ -124,6 +124,7 @@ using std::string; // base using ::android::base::GetProperty; +using ::android::base::WaitForPropertyCreation; // libhidl using ::android::hardware::Void; @@ -251,6 +252,11 @@ static ErrorCode status_to_error_code(uint32_t status) KeymasterDevice::KeymasterDevice(KeymasterClient& keymaster) : _keymaster{keymaster} { + // Block until all of the properties have been created + while (!(WaitForPropertyCreation(PROPERTY_OS_VERSION) && + WaitForPropertyCreation(PROPERTY_OS_PATCHLEVEL) && + WaitForPropertyCreation(PROPERTY_VENDOR_PATCHLEVEL))) {} + _os_version = VersionToUint32(GetProperty(PROPERTY_OS_VERSION, "")); _os_patchlevel = DateCodeToUint32(GetProperty(PROPERTY_OS_PATCHLEVEL, ""), false /* include_day */); |