Define DebianService for host-guest communication
1. Use TCP/IP socket for now
2. IP address reporter uses that
3. Refactoring: remove timeout for shell page because systemd unit for
ip addr reporter 'requires' ttyd
4. move source files for guest(debian) to guest dir
Bug: 372666638
Test: check if shell shows
Change-Id: Ida94a05de9998a06b4b5c7efebbae97c78617bf4
diff --git a/libs/debian_service/Android.bp b/libs/debian_service/Android.bp
new file mode 100644
index 0000000..0495825
--- /dev/null
+++ b/libs/debian_service/Android.bp
@@ -0,0 +1,56 @@
+package {
+ default_applicable_licenses: ["Android-Apache-2.0"],
+}
+
+JAVA_LITE_PROTO_CMD = "mkdir -p $(genDir)/gen && " +
+ "$(location aprotoc) --java_opt=annotate_code=false " +
+ "-Iexternal/protobuf/src " +
+ "-Ipackages/modules/Virtualization/libs/debian_service/proto " +
+ "--plugin=protoc-gen-grpc-java=$(location protoc-gen-grpc-java-plugin) " +
+ "--grpc-java_out=lite:$(genDir)/gen $(in) && " +
+ "$(location soong_zip) -o $(out) -C $(genDir)/gen -D $(genDir)/gen"
+
+java_genrule {
+ name: "debian-service-stub-lite",
+ tools: [
+ "aprotoc",
+ "protoc-gen-grpc-java-plugin",
+ "soong_zip",
+ ],
+ cmd: JAVA_LITE_PROTO_CMD,
+ srcs: [
+ "proto/*.proto",
+ ":libprotobuf-internal-protos",
+ ],
+ out: [
+ "protos.srcjar",
+ ],
+}
+
+java_library {
+ name: "debian-service-grpclib-lite",
+ proto: {
+ type: "lite",
+ include_dirs: [
+ "external/protobuf/src",
+ "external/protobuf/java",
+ ],
+ },
+ srcs: [
+ ":debian-service-stub-lite",
+ "proto/*.proto",
+ ":libprotobuf-internal-protos",
+ ],
+ libs: ["javax_annotation-api_1.3.2"],
+ static_libs: [
+ "libprotobuf-java-lite",
+ "grpc-java-core-android",
+ "grpc-java-okhttp-client-lite",
+ "guava",
+ ],
+ sdk_version: "current",
+ apex_available: [
+ "//apex_available:platform",
+ "com.android.virt",
+ ],
+}
diff --git a/libs/debian_service/proto/DebianService.proto b/libs/debian_service/proto/DebianService.proto
new file mode 100644
index 0000000..5adf615
--- /dev/null
+++ b/libs/debian_service/proto/DebianService.proto
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2024 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.
+ */
+
+syntax = "proto3";
+
+package com.android.virtualization.vmlauncher.proto;
+
+option java_package = "com.android.virtualization.vmlauncher.proto";
+option java_multiple_files = true;
+
+service DebianService {
+ rpc ReportVmIpAddr (IpAddr) returns (ReportVmIpAddrResponse) {}
+}
+
+message IpAddr {
+ string addr = 1;
+}
+
+message ReportVmIpAddrResponse {
+ bool success = 1;
+}
\ No newline at end of file