From ce25003a8e445ef4cc96f6ce8b005c958c3a3cd7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Maciej=20=C5=BBenczykowski?= <maze@google.com>
Date: Thu, 25 Jan 2024 05:42:13 +0000
Subject: [PATCH] BpfInterfaceMapUpdater is only viable on T+
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

(since the maps were only mainlined in T)

Test: TreeHugger
Signed-off-by: Maciej Żenczykowski <maze@google.com>
Change-Id: I8d6af19f9dc339b722c5b2836b6085e0c9dd4705
---
 .../src/com/android/server/net/BpfInterfaceMapUpdater.java    | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/service-t/src/com/android/server/net/BpfInterfaceMapUpdater.java b/service-t/src/com/android/server/net/BpfInterfaceMapUpdater.java
index 4ec1562acb..59de2c41fe 100644
--- a/service-t/src/com/android/server/net/BpfInterfaceMapUpdater.java
+++ b/service-t/src/com/android/server/net/BpfInterfaceMapUpdater.java
@@ -15,6 +15,7 @@
  */
 package com.android.server.net;
 
+import android.os.Build;
 import android.content.Context;
 import android.net.INetd;
 import android.os.Handler;
@@ -25,6 +26,8 @@ import android.system.ErrnoException;
 import android.util.IndentingPrintWriter;
 import android.util.Log;
 
+import androidx.annotation.RequiresApi;
+
 import com.android.internal.annotations.VisibleForTesting;
 import com.android.net.module.util.BaseNetdUnsolicitedEventListener;
 import com.android.net.module.util.BpfDump;
@@ -36,6 +39,7 @@ import com.android.net.module.util.Struct.S32;
 /**
  * Monitor interface added (without removed) and right interface name and its index to bpf map.
  */
+@RequiresApi(Build.VERSION_CODES.TIRAMISU)
 public class BpfInterfaceMapUpdater {
     private static final String TAG = BpfInterfaceMapUpdater.class.getSimpleName();
     // This is current path but may be changed soon.
-- 
GitLab