Add net-utils-annotations lib
- Move PolicyDirection into frameworks/libs/net
- Add net-utils-annotations lib for those methods that are using
PolicyDirection annotation.
- Add net-utils-annotations-srcs for including PolicyDirection to
their filegroup.
Bug: 203634639
Test: m
Change-Id: I7b8b3bdcc3be5fca9baa5a9ce656756843e03527
diff --git a/staticlibs/Android.bp b/staticlibs/Android.bp
index a7a027c..4be2fca 100644
--- a/staticlibs/Android.bp
+++ b/staticlibs/Android.bp
@@ -229,3 +229,30 @@
"//packages/modules/Wifi/service",
],
}
+
+// This file group is deprecated; new users should use net-utils-annotations
+filegroup {
+ name: "net-utils-annotations-srcs",
+ srcs: [
+ "annotations/android/net/annotations/PolicyDirection.java",
+ ],
+ visibility: [
+ "//frameworks/base",
+ ],
+}
+
+
+java_library {
+ name: "net-utils-annotations",
+ srcs: [":net-utils-annotations-srcs"],
+ libs: [
+ "framework-annotations-lib",
+ ],
+ sdk_version: "system_current",
+ min_sdk_version: "30",
+ visibility: ["//visibility:public"],
+ apex_available: [
+ "//apex_available:anyapex",
+ "//apex_available:platform",
+ ],
+}
diff --git a/staticlibs/annotations/android/net/annotations/PolicyDirection.java b/staticlibs/annotations/android/net/annotations/PolicyDirection.java
new file mode 100644
index 0000000..febd9b4
--- /dev/null
+++ b/staticlibs/annotations/android/net/annotations/PolicyDirection.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2019 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.
+ */
+
+package android.net.annotations;
+
+import android.annotation.IntDef;
+import android.net.IpSecManager;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+/**
+ * IPsec traffic direction.
+ *
+ * <p>Mainline modules cannot reference hidden @IntDef. Moving this annotation to a separate class
+ * to allow others to statically include it.
+ *
+ * @hide
+ */
+@IntDef(value = {IpSecManager.DIRECTION_IN, IpSecManager.DIRECTION_OUT})
+@Retention(RetentionPolicy.SOURCE)
+public @interface PolicyDirection {}