Merge remote-tracking branch 'aosp/upstream-main' into main

Change-Id: Ic9dc3820623ba9b13fe52c6702fa9039026af74b
diff --git a/Android.bp b/Android.bp
new file mode 100644
index 0000000..dd2f953
--- /dev/null
+++ b/Android.bp
@@ -0,0 +1,77 @@
+package {
+    default_applicable_licenses: [
+        "external_pandora_bt-test-interfaces_license",
+    ],
+}
+
+// Added automatically by a large-scale-change
+// See: http://go/android-license-faq
+license {
+    name: "external_pandora_bt-test-interfaces_license",
+    visibility: [":__subpackages__"],
+    license_kinds: [
+        "SPDX-license-identifier-Apache-2.0",
+    ],
+    license_text: [
+        "LICENSE",
+    ],
+}
+
+java_library {
+    name: "pandora-grpc-java",
+    visibility: ["//packages/modules/Bluetooth/android/pandora/server"],
+    srcs: [":pandora-protos"],
+    static_libs: [
+        "grpc-java-lite",
+        "guava",
+        "javax_annotation-api_1.3.2",
+        "libprotobuf-java-lite",
+        "opencensus-java-api",
+        "pandora-proto-java",
+    ],
+    proto: {
+        include_dirs: [
+            "external/protobuf/src",
+            "external/pandora/bt-test-interfaces",
+        ],
+        plugin: "grpc-java-plugin",
+        output_params: [
+           "lite",
+        ],
+    },
+}
+
+java_library {
+    name: "pandora-proto-java",
+    visibility: [
+        "//packages/modules/Bluetooth/android/pandora/server",
+        "//packages/modules/Bluetooth/pandora/interfaces",
+    ],
+    srcs: [
+        "pandora/*.proto",
+        ":libprotobuf-internal-protos",
+    ],
+    static_libs: [
+        "libprotobuf-java-lite",
+    ],
+    proto: {
+        // Disable canonical path as this breaks the identification of
+        // well known protobufs
+        canonical_path_from_root: false,
+        type: "lite",
+        include_dirs: [
+            "external/protobuf/src",
+            "external/pandora/bt-test-interfaces",
+        ],
+    },
+}
+
+filegroup {
+    name: "pandora-protos",
+    srcs: [
+        "pandora/a2dp.proto",
+        "pandora/host.proto",
+        "pandora/l2cap.proto",
+        "pandora/security.proto",
+    ],
+}
diff --git a/METADATA b/METADATA
new file mode 100644
index 0000000..9dfe4d5
--- /dev/null
+++ b/METADATA
@@ -0,0 +1,10 @@
+name: "pandora/bt-test-interfaces"
+description:
+    "The Pandora Bluetooth test interfaces are Remote Procedure Call (RPC) "
+    "interfaces exposed to testing tools to trigger behaviors within a "
+    "Bluetooth stack under test."
+
+third_party: {
+  type: GOOGLE_INTERNAL
+  license_type: NOTICE
+}
diff --git a/MODULE_LICENSE_APACHE2 b/MODULE_LICENSE_APACHE2
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/MODULE_LICENSE_APACHE2
diff --git a/OWNERS b/OWNERS
new file mode 100644
index 0000000..d4db030
--- /dev/null
+++ b/OWNERS
@@ -0,0 +1,3 @@
+girardier@google.com
+licorne@google.com
+charliebout@google.com
diff --git a/pandora/host.proto b/pandora/host.proto
index a8af313..cd776a3 100644
--- a/pandora/host.proto
+++ b/pandora/host.proto
@@ -186,6 +186,7 @@
   bytes le_supported_features = 29; // LE Supported Features
   bytes manufacturer_specific_data = 30; // Manufacturer Specific Data
   DiscoverabilityMode le_discoverability_mode = 31; // Flags LE Discoverability Mode
+  DataTypes encrypted_data = 32;
 }
 
 // Response of the `ReadLocalAddress` method.
diff --git a/python/Android.bp b/python/Android.bp
new file mode 100644
index 0000000..a356076
--- /dev/null
+++ b/python/Android.bp
@@ -0,0 +1,92 @@
+package {
+    default_applicable_licenses: [
+        "external_pandora_bt-test-interfaces_license",
+    ],
+}
+
+genrule {
+    name: "protoc-gen-pandora-python-src",
+    srcs: ["_build/protoc-gen-custom_grpc"],
+    cmd: "cp $(in) $(out)",
+    out: ["protoc-gen-custom_grpc.py"],
+}
+
+python_binary_host {
+    name: "protoc-gen-pandora-python",
+    main: "protoc-gen-custom_grpc.py",
+    srcs: [":protoc-gen-pandora-python-src"],
+    libs: ["libprotobuf-python"],
+}
+
+genrule {
+    name: "pandora-python-gen-src",
+    tools: [
+        "aprotoc",
+        "protoc-gen-pandora-python"
+    ],
+    cmd: "$(location aprotoc)" +
+         "    -Iexternal/pandora/bt-test-interfaces" +
+         "    -Iexternal/protobuf/src" +
+         "    --plugin=protoc-gen-grpc=$(location protoc-gen-pandora-python)" +
+         "    --python_out=$(genDir)" +
+         "    --grpc_out=$(genDir)" +
+         "    $(locations :pandora-protos) &&" +
+         "touch $(genDir)/pandora/py.typed &&" +
+         "touch $(genDir)/pandora/__init__.py",
+    srcs: [
+        ":pandora-protos",
+        ":libprotobuf-internal-protos",
+    ],
+    out: [
+        "pandora/py.typed",
+        "pandora/__init__.py",
+        "pandora/_utils.py",
+        "pandora/a2dp_grpc.py",
+        "pandora/a2dp_grpc_aio.py",
+        "pandora/a2dp_pb2.py",
+        "pandora/a2dp_pb2.pyi",
+        "pandora/host_grpc.py",
+        "pandora/host_grpc_aio.py",
+        "pandora/host_pb2.py",
+        "pandora/host_pb2.pyi",
+        "pandora/l2cap_grpc.py",
+        "pandora/l2cap_grpc_aio.py",
+        "pandora/l2cap_pb2.py",
+        "pandora/l2cap_pb2.pyi",
+        "pandora/security_grpc.py",
+        "pandora/security_grpc_aio.py",
+        "pandora/security_pb2.py",
+        "pandora/security_pb2.pyi",
+    ]
+}
+
+filegroup {
+    name: "pandora-python-src",
+    srcs: [
+        ":pandora-python-gen-src"
+    ],
+    exclude_srcs: [
+        ":pandora-python-stubs",
+    ]
+}
+
+filegroup {
+    name: "pandora-python-stubs",
+    srcs: [
+        ":pandora-python-gen-src{pandora/py.typed}",
+        ":pandora-python-gen-src{pandora/a2dp_pb2.pyi}",
+        ":pandora-python-gen-src{pandora/host_pb2.pyi}",
+        ":pandora-python-gen-src{pandora/l2cap_pb2.pyi}",
+        ":pandora-python-gen-src{pandora/security_pb2.pyi}",
+    ],
+}
+
+python_library_host {
+    name: "pandora-python",
+    srcs: [
+        ":pandora-python-src",
+    ],
+    data: [
+        ":pandora-python-stubs"
+    ]
+}