Merge "ServiceManager APIs for Wi-Fi mainline module"

This commit is contained in:
Treehugger Robot
2021-08-23 19:25:20 +00:00
committed by Gerrit Code Review
2 changed files with 21 additions and 2 deletions

View File

@@ -132,6 +132,11 @@ package android.os {
field public static final int VPN_UID = 1016; // 0x3f8 field public static final int VPN_UID = 1016; // 0x3f8
} }
public final class ServiceManager {
method public static boolean isDeclared(@NonNull String);
method @Nullable public static android.os.IBinder waitForDeclaredService(@NonNull String);
}
public class StatsServiceManager { public class StatsServiceManager {
method @NonNull public android.os.StatsServiceManager.ServiceRegisterer getStatsCompanionServiceRegisterer(); method @NonNull public android.os.StatsServiceManager.ServiceRegisterer getStatsCompanionServiceRegisterer();
method @NonNull public android.os.StatsServiceManager.ServiceRegisterer getStatsManagerServiceRegisterer(); method @NonNull public android.os.StatsServiceManager.ServiceRegisterer getStatsManagerServiceRegisterer();

View File

@@ -17,6 +17,8 @@
package android.os; package android.os;
import android.annotation.NonNull; import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.SystemApi;
import android.compat.annotation.UnsupportedAppUsage; import android.compat.annotation.UnsupportedAppUsage;
import android.util.ArrayMap; import android.util.ArrayMap;
import android.util.Log; import android.util.Log;
@@ -28,6 +30,7 @@ import com.android.internal.util.StatLogger;
import java.util.Map; import java.util.Map;
/** @hide */ /** @hide */
@SystemApi(client = SystemApi.Client.MODULE_LIBRARIES)
public final class ServiceManager { public final class ServiceManager {
private static final String TAG = "ServiceManager"; private static final String TAG = "ServiceManager";
private static final Object sLock = new Object(); private static final Object sLock = new Object();
@@ -98,10 +101,12 @@ public final class ServiceManager {
int COUNT = GET_SERVICE + 1; int COUNT = GET_SERVICE + 1;
} }
/** @hide */
public static final StatLogger sStatLogger = new StatLogger(new String[] { public static final StatLogger sStatLogger = new StatLogger(new String[] {
"getService()", "getService()",
}); });
/** @hide */
@UnsupportedAppUsage @UnsupportedAppUsage
public ServiceManager() { public ServiceManager() {
} }
@@ -123,6 +128,7 @@ public final class ServiceManager {
* *
* @param name the name of the service to get * @param name the name of the service to get
* @return a reference to the service, or <code>null</code> if the service doesn't exist * @return a reference to the service, or <code>null</code> if the service doesn't exist
* @hide
*/ */
@UnsupportedAppUsage @UnsupportedAppUsage
public static IBinder getService(String name) { public static IBinder getService(String name) {
@@ -160,6 +166,7 @@ public final class ServiceManager {
* *
* @param name the name of the new service * @param name the name of the new service
* @param service the service object * @param service the service object
* @hide
*/ */
@UnsupportedAppUsage @UnsupportedAppUsage
public static void addService(String name, IBinder service) { public static void addService(String name, IBinder service) {
@@ -174,6 +181,7 @@ public final class ServiceManager {
* @param service the service object * @param service the service object
* @param allowIsolated set to true to allow isolated sandboxed processes * @param allowIsolated set to true to allow isolated sandboxed processes
* to access this service * to access this service
* @hide
*/ */
@UnsupportedAppUsage @UnsupportedAppUsage
public static void addService(String name, IBinder service, boolean allowIsolated) { public static void addService(String name, IBinder service, boolean allowIsolated) {
@@ -189,6 +197,7 @@ public final class ServiceManager {
* @param allowIsolated set to true to allow isolated sandboxed processes * @param allowIsolated set to true to allow isolated sandboxed processes
* @param dumpPriority supported dump priority levels as a bitmask * @param dumpPriority supported dump priority levels as a bitmask
* to access this service * to access this service
* @hide
*/ */
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553) @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
public static void addService(String name, IBinder service, boolean allowIsolated, public static void addService(String name, IBinder service, boolean allowIsolated,
@@ -203,6 +212,7 @@ public final class ServiceManager {
/** /**
* Retrieve an existing service called @a name from the * Retrieve an existing service called @a name from the
* service manager. Non-blocking. * service manager. Non-blocking.
* @hide
*/ */
@UnsupportedAppUsage @UnsupportedAppUsage
public static IBinder checkService(String name) { public static IBinder checkService(String name) {
@@ -239,6 +249,7 @@ public final class ServiceManager {
* *
* @return true if the service is declared somewhere (eg. VINTF manifest) and * @return true if the service is declared somewhere (eg. VINTF manifest) and
* waitForService should always be able to return the service. * waitForService should always be able to return the service.
* @hide
*/ */
public static String[] getDeclaredInstances(@NonNull String iface) { public static String[] getDeclaredInstances(@NonNull String iface) {
try { try {
@@ -256,6 +267,7 @@ public final class ServiceManager {
* will wait for it to be ready. * will wait for it to be ready.
* *
* @return {@code null} only if there are permission problems or fatal errors. * @return {@code null} only if there are permission problems or fatal errors.
* @hide
*/ */
public static IBinder waitForService(@NonNull String name) { public static IBinder waitForService(@NonNull String name) {
return Binder.allowBlocking(waitForServiceNative(name)); return Binder.allowBlocking(waitForServiceNative(name));
@@ -263,7 +275,6 @@ public final class ServiceManager {
private static native IBinder waitForServiceNative(@NonNull String name); private static native IBinder waitForServiceNative(@NonNull String name);
/** /**
* Returns the specified service from the service manager, if declared. * Returns the specified service from the service manager, if declared.
* *
@@ -272,8 +283,10 @@ public final class ServiceManager {
* *
* @return {@code null} if the service is not declared in the manifest, or if there are * @return {@code null} if the service is not declared in the manifest, or if there are
* permission problems, or if there are fatal errors. * permission problems, or if there are fatal errors.
* @hide
*/ */
public static IBinder waitForDeclaredService(@NonNull String name) { @SystemApi(client = SystemApi.Client.MODULE_LIBRARIES)
@Nullable public static IBinder waitForDeclaredService(@NonNull String name) {
return isDeclared(name) ? waitForService(name) : null; return isDeclared(name) ? waitForService(name) : null;
} }
@@ -281,6 +294,7 @@ public final class ServiceManager {
* Return a list of all currently running services. * Return a list of all currently running services.
* @return an array of all currently running services, or <code>null</code> in * @return an array of all currently running services, or <code>null</code> in
* case of an exception * case of an exception
* @hide
*/ */
@UnsupportedAppUsage @UnsupportedAppUsage
public static String[] listServices() { public static String[] listServices() {