libbpf-rs: add cargo_embargo.json and Android.bp

Add the necessary pieces to build libbpf-rs.

Bug: 359646531
Test: TH/Manual
Change-Id: I7c31f71f206266e7022720b60d7ab3111aa1b198
Signed-off-by: Neill Kapron <[email protected]>
diff --git a/Android.bp b/Android.bp
new file mode 100644
index 0000000..d084001
--- /dev/null
+++ b/Android.bp
@@ -0,0 +1,38 @@
+// This file is generated by cargo_embargo.
+// Do not modify this file because the changes will be overridden on upgrade.
+
+package {
+    default_applicable_licenses: ["external_rust_crates_libbpf-rs_license"],
+    default_team: "trendy_team_android_rust",
+}
+
+license {
+    name: "external_rust_crates_libbpf-rs_license",
+    visibility: [":__subpackages__"],
+    license_kinds: ["SPDX-license-identifier-BSD-2-Clause"],
+    license_text: ["LICENSE"],
+}
+
+rust_library {
+    name: "liblibbpf_rs",
+    crate_name: "libbpf_rs",
+    cargo_env_compat: true,
+    cargo_pkg_version: "0.24.2",
+    crate_root: "src/lib.rs",
+    edition: "2021",
+    features: [
+        "default",
+        "libbpf-sys",
+    ],
+    rustlibs: [
+        "libbitflags",
+        "liblibbpf_sys",
+        "liblibc",
+        "libvsprintf",
+    ],
+    apex_available: [
+        "//apex_available:platform",
+        "//apex_available:anyapex",
+    ],
+    shared_libs: ["libbpf"],
+}
diff --git a/cargo_embargo.json b/cargo_embargo.json
new file mode 100644
index 0000000..fef2958
--- /dev/null
+++ b/cargo_embargo.json
@@ -0,0 +1,11 @@
+{
+  "run_cargo": false,
+  "package": {
+    "libbpf-rs": {
+      "host_supported": false,
+      "patch": "patches/Android.bp.patch"
+    }
+  },
+  "product_available": false,
+  "vendor_available": false
+}
diff --git a/patches/Android.bp.patch b/patches/Android.bp.patch
new file mode 100644
index 0000000..a4cddf2
--- /dev/null
+++ b/patches/Android.bp.patch
@@ -0,0 +1,10 @@
+diff --git a/Android.bp b/Android.bp
+index c9b8b1e..2ce3cf1 100644
+--- a/Android.bp
++++ b/Android.bp
+@@ -34,4 +34,5 @@ rust_library {
+         "//apex_available:platform",
+         "//apex_available:anyapex",
+     ],
++    shared_libs: ["libbpf"],
+ }