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

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

Change-Id: I48f75aa0ab4150cfeb65703bd1ef96df0a42a21d
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:47:01 +00:00 committed by Automerger Merge Worker
commit d7c817b718

View file

@ -1450,7 +1450,12 @@ KeymasterDevices enumerateKeymasterDevices(IServiceManager* serviceManager) {
KeymasterDevices initializeKeymasters() { KeymasterDevices initializeKeymasters() {
auto serviceManager = IServiceManager::getService(); 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 result = enumerateKeymasterDevices<Keymaster4>(serviceManager.get());
auto softKeymaster = result[SecurityLevel::SOFTWARE]; auto softKeymaster = result[SecurityLevel::SOFTWARE];
if ((!result[SecurityLevel::TRUSTED_ENVIRONMENT]) && (!result[SecurityLevel::STRONGBOX])) { if ((!result[SecurityLevel::TRUSTED_ENVIRONMENT]) && (!result[SecurityLevel::STRONGBOX])) {