Merge "remount: Replace ServiceManager::getService with checkService" into main am: 4131a3afd1

Original change: https://android-review.googlesource.com/c/platform/system/core/+/2690886

Change-Id: I0edade2adc78401e6f5291d1a2a579ac102d2087
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Yi-Yo Chiang 2023-08-04 04:22:27 +00:00 committed by Automerger Merge Worker
commit 18cea8df37

View file

@ -128,12 +128,11 @@ class MyLogger {
}
static android::sp<android::os::IVold> GetVold() {
auto sm = android::defaultServiceManager();
while (true) {
if (auto sm = android::defaultServiceManager()) {
if (auto binder = sm->getService(android::String16("vold"))) {
if (auto vold = android::interface_cast<android::os::IVold>(binder)) {
return vold;
}
if (auto binder = sm->checkService(android::String16("vold"))) {
if (auto vold = android::interface_cast<android::os::IVold>(binder)) {
return vold;
}
}
std::this_thread::sleep_for(2s);