Change getService (deprecated) to waitForService
The `getService` method is now deprecated. This changes the
getService calls to waitForService.
The only potential difference in functionality is that getService
times out after 10 seconds, while waitForService waits indefinitely.
Test: flash to device and reboot,
`adb logcat | egrep -i "twoshay|flinger"`
shows nothing suspiciously different before/after the change.
Bug: 265069414
Change-Id: I84c5f860c869a4e11be6e5490268920dae1e29cc
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index 5746fae..a89b48e 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -687,7 +687,7 @@
// wait patiently for the window manager death
const String16 name("window");
- mWindowManager = defaultServiceManager()->getService(name);
+ mWindowManager = defaultServiceManager()->waitForService(name);
if (mWindowManager != 0) {
mWindowManager->linkToDeath(sp<IBinder::DeathRecipient>::fromExisting(this));
}
@@ -701,7 +701,7 @@
LOG_EVENT_LONG(LOGTAG_SF_STOP_BOOTANIM,
ns2ms(systemTime(SYSTEM_TIME_MONOTONIC)));
- sp<IBinder> input(defaultServiceManager()->getService(String16("inputflinger")));
+ sp<IBinder> input(defaultServiceManager()->waitForService(String16("inputflinger")));
static_cast<void>(mScheduler->schedule([=]() FTL_FAKE_GUARD(kMainThreadContext) {
if (input == nullptr) {
diff --git a/services/surfaceflinger/tests/IPC_test.cpp b/services/surfaceflinger/tests/IPC_test.cpp
index 40a5d57..18bd3b9 100644
--- a/services/surfaceflinger/tests/IPC_test.cpp
+++ b/services/surfaceflinger/tests/IPC_test.cpp
@@ -289,7 +289,7 @@
IPCThreadState::self()->joinThreadPool();
[&]() { exit(0); }();
}
- sp<IBinder> binder = defaultServiceManager()->getService(serviceName);
+ sp<IBinder> binder = defaultServiceManager()->waitForService(serviceName);
remote = interface_cast<IIPCTest>(binder);
remote->setDeathToken(mDeathRecipient);
}