1/* 2 * Copyright (C) 2017 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17syntax = "proto2"; 18package android.service; 19 20import "frameworks/base/libs/incident/proto/android/privacy.proto"; 21 22option java_multiple_files = true; 23option java_outer_classname = "NetworkStatsServiceProto"; 24 25// Represents dumpsys from NetworkStatsService (netstats). 26message NetworkStatsServiceDumpProto { 27 option (android.msg_privacy).dest = DEST_AUTOMATIC; 28 29 repeated NetworkInterfaceProto active_interfaces = 1; 30 31 repeated NetworkInterfaceProto active_uid_interfaces = 2; 32 33 // Device level network stats, which may include non-IP layer traffic. 34 optional NetworkStatsRecorderProto dev_stats = 3; 35 36 // IP-layer traffic stats. 37 optional NetworkStatsRecorderProto xt_stats = 4; 38 39 // Per-UID network stats. 40 optional NetworkStatsRecorderProto uid_stats = 5; 41 42 // Per-UID, per-tag network stats, excluding the default tag (i.e. tag=0). 43 optional NetworkStatsRecorderProto uid_tag_stats = 6; 44} 45 46// Corresponds to NetworkStatsService.mActiveIfaces/mActiveUidIfaces. 47message NetworkInterfaceProto { 48 option (android.msg_privacy).dest = DEST_AUTOMATIC; 49 50 optional string interface = 1; 51 52 optional NetworkIdentitySetProto identities = 2; 53} 54 55// Corresponds to NetworkIdentitySet. 56message NetworkIdentitySetProto { 57 option (android.msg_privacy).dest = DEST_AUTOMATIC; 58 59 repeated NetworkIdentityProto identities = 1; 60} 61 62// Corresponds to NetworkIdentity. 63message NetworkIdentityProto { 64 option (android.msg_privacy).dest = DEST_AUTOMATIC; 65 66 // Constats from ConnectivityManager.TYPE_*. 67 optional int32 type = 1; 68 69 optional string subscriber_id = 2 [ (android.privacy).dest = DEST_EXPLICIT ]; 70 71 optional string network_id = 3 [ (android.privacy).dest = DEST_EXPLICIT ]; 72 73 optional bool roaming = 4; 74 75 optional bool metered = 5; 76 77 optional bool default_network = 6; 78} 79 80// Corresponds to NetworkStatsRecorder. 81message NetworkStatsRecorderProto { 82 option (android.msg_privacy).dest = DEST_AUTOMATIC; 83 84 optional int64 pending_total_bytes = 1; 85 86 optional NetworkStatsCollectionProto complete_history = 2; 87} 88 89// Corresponds to NetworkStatsCollection. 90message NetworkStatsCollectionProto { 91 option (android.msg_privacy).dest = DEST_AUTOMATIC; 92 93 repeated NetworkStatsCollectionStatsProto stats = 1; 94} 95 96// Corresponds to NetworkStatsCollection.mStats. 97message NetworkStatsCollectionStatsProto { 98 option (android.msg_privacy).dest = DEST_AUTOMATIC; 99 100 optional NetworkStatsCollectionKeyProto key = 1; 101 102 optional NetworkStatsHistoryProto history = 2; 103} 104 105// Corresponds to NetworkStatsCollection.Key. 106message NetworkStatsCollectionKeyProto { 107 option (android.msg_privacy).dest = DEST_AUTOMATIC; 108 109 optional NetworkIdentitySetProto identity = 1; 110 111 optional int32 uid = 2; 112 113 optional int32 set = 3; 114 115 optional int32 tag = 4; 116} 117 118// Corresponds to NetworkStatsHistory. 119message NetworkStatsHistoryProto { 120 option (android.msg_privacy).dest = DEST_AUTOMATIC; 121 122 // Duration for this bucket in milliseconds. 123 optional int64 bucket_duration_ms = 1; 124 125 repeated NetworkStatsHistoryBucketProto buckets = 2; 126} 127 128// Corresponds to each bucket in NetworkStatsHistory. 129message NetworkStatsHistoryBucketProto { 130 option (android.msg_privacy).dest = DEST_AUTOMATIC; 131 132 // Bucket start time in milliseconds since epoch. 133 optional int64 bucket_start_ms = 1; 134 135 optional int64 rx_bytes = 2; 136 137 optional int64 rx_packets = 3; 138 139 optional int64 tx_bytes = 4; 140 141 optional int64 tx_packets = 5; 142 143 optional int64 operations = 6; 144} 145