Merge "BpfMap.java - add requires S+ annotation" into main

This commit is contained in:
Maciej Żenczykowski 2023-11-16 10:41:49 +00:00 • committed by Gerrit Code Review
commit 50ad91350a
2 changed files with 6 additions and 0 deletions

View file

@ -16,9 +16,11 @@
package com.android.net.module.util;
import android.os.Build;
import android.system.ErrnoException;
import androidx.annotation.NonNull;
import androidx.annotation.RequiresApi;
/**
*
@ -26,6 +28,7 @@ import androidx.annotation.NonNull;
* array type with key->int and value->uint64_t defined in the bpf program.
*
*/
@RequiresApi(Build.VERSION_CODES.S)
public class BpfBitmap {
private BpfMap<Struct.S32, Struct.S64> mBpfMap;

View file

@ -18,12 +18,14 @@ package com.android.net.module.util;
import static android.system.OsConstants.EEXIST;
import static android.system.OsConstants.ENOENT;
import android.os.Build;
import android.os.ParcelFileDescriptor;
import android.system.ErrnoException;
import android.util.Pair;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import java.io.IOException;
import java.nio.ByteBuffer;
@ -40,6 +42,7 @@ import java.util.concurrent.ConcurrentHashMap;
* @param <K> the key of the map.
* @param <V> the value of the map.
*/
@RequiresApi(Build.VERSION_CODES.S)
public class BpfMap<K extends Struct, V extends Struct> implements IBpfMap<K, V> {
static {
System.loadLibrary(JniUtil.getJniLibraryName(BpfMap.class.getPackage()));