Merge "keystore2 compat: stop crashing without hwservicemanager" into main am: a764eb9f45 am: d640b4c0ee

Original change: https://android-review.googlesource.com/c/platform/system/security/+/2736025

Change-Id: I855a747c80a7ae18321d6417677deffe2bec918a
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Devin Moore 2023-09-06 19:02:05 +00:00 committed by Automerger Merge Worker
commit 758bec0930

View file

@ -1450,7 +1450,12 @@ KeymasterDevices enumerateKeymasterDevices(IServiceManager* serviceManager) {
KeymasterDevices initializeKeymasters() {
auto serviceManager = IServiceManager::getService();
CHECK(serviceManager.get()) << "Failed to get ServiceManager";
if (!serviceManager.get()) {
// New devices no longer have HIDL support, so failing to get hwservicemanager is
// expected behavior.
LOG(INFO) << "Skipping keymaster compat, this system is AIDL only.";
return KeymasterDevices();
}
auto result = enumerateKeymasterDevices<Keymaster4>(serviceManager.get());
auto softKeymaster = result[SecurityLevel::SOFTWARE];
if ((!result[SecurityLevel::TRUSTED_ENVIRONMENT]) && (!result[SecurityLevel::STRONGBOX])) {