diff options
| author | 2021-11-30 16:45:40 -0800 | |
|---|---|---|
| committer | 2021-12-01 02:27:41 +0000 | |
| commit | 0a9b56e9667ebd28939d96236f08b8d8ae70c308 (patch) | |
| tree | c0ea9906f63a174caf53d6c26849ac7927da8215 /cmds/servicemanager/ServiceManager.cpp | |
| parent | 8347ab590004648816eb1101bf2b02993575319a (diff) | |
servicemanager: use recovery VINTF data.
Call into VintfObjectRecovery::getRecoveryHalManifest in
recovery mode, which only reads from /system/etc/vintf
in the recovery ramdisk.
Test: install cuttlefish health HAL then boot into recovery mode,
hal can start.
Fixes: 170338625
Change-Id: If65e7fed9541239c47b3c1fd1afe644d7b16ee39
Diffstat (limited to 'cmds/servicemanager/ServiceManager.cpp')
| -rw-r--r-- | cmds/servicemanager/ServiceManager.cpp | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/cmds/servicemanager/ServiceManager.cpp b/cmds/servicemanager/ServiceManager.cpp index 4e44ac7323..4374abe2ef 100644 --- a/cmds/servicemanager/ServiceManager.cpp +++ b/cmds/servicemanager/ServiceManager.cpp @@ -28,6 +28,9 @@ #ifndef VENDORSERVICEMANAGER #include <vintf/VintfObject.h> +#ifdef __ANDROID_RECOVERY__ +#include <vintf/VintfObjectRecovery.h> +#endif // __ANDROID_RECOVERY__ #include <vintf/constants.h> #endif // !VENDORSERVICEMANAGER @@ -37,16 +40,33 @@ using ::android::internal::Stability; namespace android { #ifndef VENDORSERVICEMANAGER + struct ManifestWithDescription { std::shared_ptr<const vintf::HalManifest> manifest; const char* description; }; +static std::vector<ManifestWithDescription> GetManifestsWithDescription() { +#ifdef __ANDROID_RECOVERY__ + auto vintfObject = vintf::VintfObjectRecovery::GetInstance(); + if (vintfObject == nullptr) { + LOG(ERROR) << "NULL VintfObjectRecovery!"; + return {}; + } + return {ManifestWithDescription{vintfObject->getRecoveryHalManifest(), "recovery"}}; +#else + auto vintfObject = vintf::VintfObject::GetInstance(); + if (vintfObject == nullptr) { + LOG(ERROR) << "NULL VintfObject!"; + return {}; + } + return {ManifestWithDescription{vintfObject->getDeviceHalManifest(), "device"}, + ManifestWithDescription{vintfObject->getFrameworkHalManifest(), "framework"}}; +#endif +} + // func true -> stop search and forEachManifest will return true static bool forEachManifest(const std::function<bool(const ManifestWithDescription&)>& func) { - for (const ManifestWithDescription& mwd : { - ManifestWithDescription{ vintf::VintfObject::GetDeviceHalManifest(), "device" }, - ManifestWithDescription{ vintf::VintfObject::GetFrameworkHalManifest(), "framework" }, - }) { + for (const ManifestWithDescription& mwd : GetManifestsWithDescription()) { if (mwd.manifest == nullptr) { LOG(ERROR) << "NULL VINTF MANIFEST!: " << mwd.description; // note, we explicitly do not retry here, so that we can detect VINTF |