Merge "Create CommonConnectivityJni to share between modules" into main
This commit is contained in:
commit
0e5defc1e9
3 changed files with 338 additions and 37 deletions
|
|
@ -167,6 +167,30 @@ cc_library {
|
|||
ldflags: ["-Wl,--exclude-libs=ALL,--error-limit=0"],
|
||||
}
|
||||
|
||||
cc_library_shared {
|
||||
name: "libcom_android_networkstack_tethering_util_jni_CommonConnectivityJni",
|
||||
srcs: [
|
||||
"jni/commonconnectivity/onload.cpp",
|
||||
],
|
||||
min_sdk_version: "30",
|
||||
shared_libs: [
|
||||
"liblog",
|
||||
"libnativehelper",
|
||||
],
|
||||
static_libs: [
|
||||
"libcommonconnectivityjni",
|
||||
],
|
||||
cflags: [
|
||||
"-Wall",
|
||||
"-Werror",
|
||||
"-Wno-unused-parameter",
|
||||
"-Wthread-safety",
|
||||
],
|
||||
apex_available: [
|
||||
"com.android.tethering",
|
||||
],
|
||||
}
|
||||
|
||||
// Common defaults for compiling the actual APK.
|
||||
java_defaults {
|
||||
name: "TetheringAppDefaults",
|
||||
|
|
|
|||
|
|
@ -67,6 +67,7 @@ apex {
|
|||
"libservice-connectivity",
|
||||
"libservice-thread-jni",
|
||||
"libandroid_net_connectivity_com_android_net_module_util_jni",
|
||||
"libandroid_net_connectivity_com_android_net_module_util_jni_CommonConnectivityJni",
|
||||
],
|
||||
native_shared_libs: [
|
||||
"libcom.android.tethering.dns_helper",
|
||||
|
|
|
|||
37
Tethering/jni/commonconnectivity/onload.cpp
Normal file
37
Tethering/jni/commonconnectivity/onload.cpp
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
/*
|
||||
* Copyright (C) 2025 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#define LOG_TAG "com_android_networkstack_tethering_util_CommonConnectivityJni"
|
||||
|
||||
#include <android/log.h>
|
||||
#include <nativehelper/JNIHelp.h>
|
||||
|
||||
namespace android {
|
||||
int register_CommonConnectivityJni(JNIEnv *env, char const *class_name);
|
||||
|
||||
extern "C" jint JNI_OnLoad(JavaVM *vm, void *) {
|
||||
JNIEnv *env;
|
||||
if (vm->GetEnv(reinterpret_cast<void **>(&env), JNI_VERSION_1_6) !=
|
||||
JNI_OK) {
|
||||
__android_log_print(ANDROID_LOG_ERROR, LOG_TAG, "ERROR: GetEnv failed");
|
||||
return JNI_ERR;
|
||||
}
|
||||
|
||||
if (register_CommonConnectivityJni(env,
|
||||
"com/android/networkstack/tethering/util/CommonConnectivityJni") < 0) return JNI_ERR;
|
||||
|
||||
return JNI_VERSION_1_6;
|
||||
}
|
||||
}; // namespace android
|
||||
Loading…
Reference in a new issue