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/core/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 // Name of the network interface (eg: wlan). 51 optional string interface = 1; 52 53 optional NetworkIdentitySetProto identities = 2; 54} 55 56// Corresponds to NetworkIdentitySet. 57message NetworkIdentitySetProto { 58 option (android.msg_privacy).dest = DEST_AUTOMATIC; 59 60 repeated NetworkIdentityProto identities = 1; 61} 62 63// Corresponds to NetworkIdentity. 64message NetworkIdentityProto { 65 option (android.msg_privacy).dest = DEST_AUTOMATIC; 66 67 // Constants from ConnectivityManager.TYPE_*. 68 optional int32 type = 1; 69 70 // Full subscriber ID on eng builds. The IMSI is scrubbed on user & userdebug 71 // builds to only include the info about the GSM network operator (the info 72 // that uniquely identifies the subscriber is removed). 73 optional string subscriber_id = 2 [ (android.privacy).dest = DEST_EXPLICIT ]; 74 75 // Name of the network (eg: MyWifi). 76 optional string network_id = 3 [ (android.privacy).dest = DEST_EXPLICIT ]; 77 78 optional bool roaming = 4; 79 80 optional bool metered = 5; 81 82 optional bool default_network = 6; 83} 84 85// Corresponds to NetworkStatsRecorder. 86message NetworkStatsRecorderProto { 87 option (android.msg_privacy).dest = DEST_AUTOMATIC; 88 89 optional int64 pending_total_bytes = 1; 90 91 optional NetworkStatsCollectionProto complete_history = 2; 92} 93 94// Corresponds to NetworkStatsCollection. 95message NetworkStatsCollectionProto { 96 option (android.msg_privacy).dest = DEST_AUTOMATIC; 97 98 repeated NetworkStatsCollectionStatsProto stats = 1; 99} 100 101// Corresponds to NetworkStatsCollection.mStats. 102message NetworkStatsCollectionStatsProto { 103 option (android.msg_privacy).dest = DEST_AUTOMATIC; 104 105 optional NetworkStatsCollectionKeyProto key = 1; 106 107 optional NetworkStatsHistoryProto history = 2; 108} 109 110// Corresponds to NetworkStatsCollection.Key. 111message NetworkStatsCollectionKeyProto { 112 option (android.msg_privacy).dest = DEST_AUTOMATIC; 113 114 optional NetworkIdentitySetProto identity = 1; 115 116 optional int32 uid = 2; 117 118 optional int32 set = 3; 119 120 optional int32 tag = 4; 121} 122 123// Corresponds to NetworkStatsHistory. 124message NetworkStatsHistoryProto { 125 option (android.msg_privacy).dest = DEST_AUTOMATIC; 126 127 // Duration for this bucket in milliseconds. 128 optional int64 bucket_duration_ms = 1; 129 130 repeated NetworkStatsHistoryBucketProto buckets = 2; 131} 132 133// Corresponds to each bucket in NetworkStatsHistory. 134message NetworkStatsHistoryBucketProto { 135 option (android.msg_privacy).dest = DEST_AUTOMATIC; 136 137 // Bucket start time in milliseconds since epoch. 138 optional int64 bucket_start_ms = 1; 139 140 optional int64 rx_bytes = 2; 141 142 optional int64 rx_packets = 3; 143 144 optional int64 tx_bytes = 4; 145 146 optional int64 tx_packets = 5; 147 148 optional int64 operations = 6; 149} 150