remount: Replace ServiceManager::getService with checkService

Address this build log message:
```
[ 18% 2/11] //system/core/fs_mgr:remount clang++ fs_mgr_remount.cpp
system/core/fs_mgr/fs_mgr_remount.cpp:133:31: warning: 'getService' is deprecated: this polls for 5s, prefer waitForService or checkService [-Wdeprecated-declarations]
        if (auto binder = sm->getService(android::String16("vold"))) {
                              ^
```

Bug: 293695109
Test: adb-remount-test
Change-Id: I3b5c7d338e9307dee58edeb0f6a00ba9a73d46f6
This commit is contained in:
Yi-Yo Chiang 2023-08-03 01:51:57 +08:00
parent b7cfba1ca2
commit 59442132d1
1 changed files with 4 additions and 5 deletions

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);