Calling NDK version of tagSocket/untagSocket

Calling NDK version of tagSocket/untagSocket from
android_server_NetworkManagementSocketTagger.cpp. This is required since
the file is going to be mainlined. The platform functions it calls must
be stable APIs.

Bug: 29761778
Bug: 202086915
Test: atest TrafficStatsTest NetworkUsageStatsTest

Change-Id: Ic6554d9b98cef9b41b7eae06315d284c574c0a45
This commit is contained in:
Ken Chen
2022-01-07 06:26:11 +08:00
parent a4a35a92ea
commit 846fd78c06
2 changed files with 10 additions and 9 deletions

View File

@@ -242,6 +242,7 @@ cc_library_shared {
"audioflinger-aidl-cpp",
"av-types-aidl-cpp",
"android.hardware.camera.device@3.2",
"libandroid_net",
"libandroidicu",
"libbpf_android",
"libnetdbpf",

View File

@@ -15,18 +15,18 @@
*/
#define LOG_TAG "NMST_QTagUidNative"
#include <utils/Log.h>
#include <nativehelper/JNIPlatformHelp.h>
#include "jni.h"
#include <utils/misc.h>
#include <android/multinetwork.h>
#include <cutils/qtaguid.h>
#include <errno.h>
#include <fcntl.h>
#include <sys/types.h>
#include <nativehelper/JNIPlatformHelp.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <utils/Log.h>
#include <utils/misc.h>
#include "jni.h"
namespace android {
@@ -40,7 +40,7 @@ static jint QTagUid_tagSocketFd(JNIEnv* env, jclass,
return (jint)-1;
}
int res = qtaguid_tagSocket(userFd, tagNum, uid);
int res = android_tag_socket_with_uid(userFd, tagNum, uid);
if (res < 0) {
return (jint)-errno;
}
@@ -56,7 +56,7 @@ static jint QTagUid_untagSocketFd(JNIEnv* env, jclass,
return (jint)-1;
}
int res = qtaguid_untagSocket(userFd);
int res = android_untag_socket(userFd);
if (res < 0) {
return (jint)-errno;
}