Merge "Only allow libconnectivity_native usage on U+"
This commit is contained in:
commit
f9f9784d4c
2 changed files with 6 additions and 0 deletions
|
|
@ -27,6 +27,7 @@ cc_library_shared {
|
|||
min_sdk_version: "30",
|
||||
static_libs: [
|
||||
"connectivity_native_aidl_interface-V1-ndk",
|
||||
"libmodules-utils-build",
|
||||
],
|
||||
export_include_dirs: ["include"],
|
||||
cflags: [
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@
|
|||
#include "connectivity_native.h"
|
||||
|
||||
#include <android/binder_manager.h>
|
||||
#include <android-modules-utils/sdk_level.h>
|
||||
#include <aidl/android/net/connectivity/aidl/ConnectivityNative.h>
|
||||
|
||||
using aidl::android::net::connectivity::aidl::IConnectivityNative;
|
||||
|
|
@ -44,6 +45,7 @@ static int getErrno(const ::ndk::ScopedAStatus& status) {
|
|||
}
|
||||
|
||||
int AConnectivityNative_blockPortForBind(in_port_t port) {
|
||||
if (!android::modules::sdklevel::IsAtLeastU()) return ENOSYS;
|
||||
std::shared_ptr<IConnectivityNative> c = getBinder();
|
||||
if (!c) {
|
||||
return EAGAIN;
|
||||
|
|
@ -52,6 +54,7 @@ int AConnectivityNative_blockPortForBind(in_port_t port) {
|
|||
}
|
||||
|
||||
int AConnectivityNative_unblockPortForBind(in_port_t port) {
|
||||
if (!android::modules::sdklevel::IsAtLeastU()) return ENOSYS;
|
||||
std::shared_ptr<IConnectivityNative> c = getBinder();
|
||||
if (!c) {
|
||||
return EAGAIN;
|
||||
|
|
@ -60,6 +63,7 @@ int AConnectivityNative_unblockPortForBind(in_port_t port) {
|
|||
}
|
||||
|
||||
int AConnectivityNative_unblockAllPortsForBind() {
|
||||
if (!android::modules::sdklevel::IsAtLeastU()) return ENOSYS;
|
||||
std::shared_ptr<IConnectivityNative> c = getBinder();
|
||||
if (!c) {
|
||||
return EAGAIN;
|
||||
|
|
@ -68,6 +72,7 @@ int AConnectivityNative_unblockAllPortsForBind() {
|
|||
}
|
||||
|
||||
int AConnectivityNative_getPortsBlockedForBind(in_port_t *ports, size_t *count) {
|
||||
if (!android::modules::sdklevel::IsAtLeastU()) return ENOSYS;
|
||||
std::shared_ptr<IConnectivityNative> c = getBinder();
|
||||
if (!c) {
|
||||
return EAGAIN;
|
||||
|
|
|
|||
Loading…
Reference in a new issue