blob: 0cd58f4ea41b62291ad08300f2f52a5c8ac43d57 [file] [log] [blame]
Kangping Dong192e4b02023-10-25 20:34:21 +08001/*
2 * Copyright (C) 2023 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#include <android/binder_ibinder_jni.h>
18#include <android/binder_manager.h>
19#include <jni.h>
20#include "nativehelper/JNIHelp.h"
21#include <nativehelper/ScopedUtfChars.h>
22#include <private/android_filesystem_config.h>
23
24namespace android {
25static jobject com_android_server_ServiceManagerWrapper_waitForService(
26 JNIEnv* env, jobject clazz, jstring serviceName) {
27 ScopedUtfChars name(env, serviceName);
28 return AIBinder_toJavaBinder(env, AServiceManager_waitForService(name.c_str()));
29}
30
31/*
32 * JNI registration.
33 */
34
35static const JNINativeMethod gMethods[] = {
36 /* name, signature, funcPtr */
37 {"nativeWaitForService",
38 "(Ljava/lang/String;)Landroid/os/IBinder;",
39 (void*)com_android_server_ServiceManagerWrapper_waitForService},
40};
41
42int register_com_android_server_ServiceManagerWrapper(JNIEnv* env) {
43 return jniRegisterNativeMethods(env,
44 "android/net/connectivity/com/android/server/ServiceManagerWrapper",
45 gMethods, NELEM(gMethods));
46}
47
48}; // namespace android