Adding Tethering proto

Bug: 153942334
Test: m, flash and boot
Change-Id: I853d3a4dd914dd0c65a6c9e1749d8898da68540e
This commit is contained in:
Wayne Ma 2022-03-03 10:15:09 +08:00
commit 71d66396d2
4 changed files with 52 additions and 0 deletions

View file

@ -47,6 +47,7 @@ java_defaults {
"net-utils-device-common-bpf",
"net-utils-device-common-netlink",
"netd-client",
"tetheringstatsprotos",
],
libs: [
"framework-connectivity",
@ -211,3 +212,14 @@ sdk {
bootclasspath_fragments: ["com.android.tethering-bootclasspath-fragment"],
systemserverclasspath_fragments: ["com.android.tethering-systemserverclasspath-fragment"],
}
java_library_static {
name: "tetheringstatsprotos",
proto: {type: "lite"},
srcs: [
"src/com/android/networkstack/tethering/metrics/stats.proto",
],
static_libs: ["tetheringprotos"],
apex_available: ["com.android.tethering"],
min_sdk_version: "30",
}

View file

@ -12,3 +12,5 @@ rule com.android.net.module.util.** com.android.networkstack.tethering.util.@1
# Classes from net-utils-device-common
rule com.android.net.module.util.Struct* com.android.networkstack.tethering.util.Struct@1
rule com.google.protobuf.** com.android.networkstack.tethering.protobuf@1

View file

@ -19,3 +19,9 @@
-keepclassmembers class android.net.ip.IpServer {
static final int CMD_*;
}
# The lite proto runtime uses reflection to access fields based on the names in
# the schema, keep all the fields.
-keepclassmembers class * extends com.android.networkstack.tethering.protobuf.MessageLite {
<fields>;
}

View file

@ -0,0 +1,32 @@
/*
* Copyright (C) 2022 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 = "proto2";
option java_multiple_files = true;
package com.android.networkstack.tethering.metrics;
import "frameworks/proto_logging/stats/enums/stats/connectivity/tethering.proto";
/**
* Logs Tethering events
*/
message NetworkTetheringReported {
optional .android.stats.connectivity.ErrorCode error_code = 1;
optional .android.stats.connectivity.DownstreamType downstream_type = 2;
optional .android.stats.connectivity.UpstreamType upstream_type = 3;
optional .android.stats.connectivity.UserType user_type = 4;
}