Move #nativeWaitForService into CommonConnectivityJni

AServiceManager_waitForService sytem APIs currently only callable
via dlsym(): b/376759605. When built with sdk_version current,
the NDK stubs for "sdk" variants only include NDK APIs,
excluding #systemapi APIs.

Flag: EXEMPT Mechanical refactors
Test: atest ServiceManagerWrapperIntegrationTest
Change-Id: I48f690d771c7905e79e463617ded772f753cc854
This commit is contained in:
Mark Chien 2025-08-04 10:56:38 +00:00 • committed by Patrick Rohr
commit f250ade6fa

View file

@ -16,6 +16,9 @@
package com.android.net.module.util;
import android.annotation.RequiresApi;
import android.os.Build;
import android.os.IBinder;
import android.system.ErrnoException;
/**
@ -48,4 +51,15 @@ public class CommonConnectivityJni {
* @throws ErrnoException if setting expiration time is failed.
*/
public static native void setTimerFdTime(int fd, long timeMs) throws ErrnoException;
/**
* Returns the specified service from the service manager.
*
* If the service is not running, service manager will attempt to start it, and this function
* will wait for it to be ready.
*
* @return {@code null} only if there are permission problems or fatal errors
*/
@RequiresApi(Build.VERSION_CODES.S)
public static native IBinder waitForService(String serviceName);
}