1/* 2 * Copyright (C) 2019 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"; 18 19package android.util.quota; 20 21option java_multiple_files = true; 22 23import "frameworks/base/core/proto/android/privacy.proto"; 24 25// A com.android.util.quota.QuotaTracker object. 26message QuotaTrackerProto { 27 option (.android.msg_privacy).dest = DEST_AUTOMATIC; 28 29 optional bool is_enabled = 1; 30 31 // If quota is free for everything in the tracker. 32 optional bool is_global_quota_free = 2; 33 34 // Current elapsed realtime. 35 optional int64 elapsed_realtime = 3; 36 37 message InQuotaAlarmListener { 38 option (.android.msg_privacy).dest = DEST_AUTOMATIC; 39 40 // The time at which the alarm is set to go off, in the elapsed realtime timebase. 41 optional int64 trigger_time_elapsed = 1; 42 43 message Alarm { 44 option (.android.msg_privacy).dest = DEST_AUTOMATIC; 45 46 optional UptcProto uptc = 1; 47 48 // The time at which the UPTC will be in quota, in the elapsed realtime timebase. 49 optional int64 in_quota_time_elapsed = 2; 50 } 51 repeated Alarm alarms = 2; 52 } 53 optional InQuotaAlarmListener in_quota_alarm_listener = 4; 54 55 // Next tag: 5 56} 57 58// A com.android.util.quota.Category object. 59message CategoryProto { 60 option (.android.msg_privacy).dest = DEST_AUTOMATIC; 61 62 // Name of the category set by the system service. 63 optional string name = 1; 64} 65 66// A com.android.util.quota.Uptc object. 67message UptcProto { 68 option (.android.msg_privacy).dest = DEST_AUTOMATIC; 69 70 // UserHandle value. Should be 0, 10, 11, 12, etc. where 0 is the owner. 71 optional int32 user_id = 1; 72 // Package name 73 optional string name = 2; 74 // Tag set by the system service to differentiate calls. 75 optional string tag = 3; 76} 77 78// A com.android.util.quota.CountQuotaTracker object. 79message CountQuotaTrackerProto { 80 option (.android.msg_privacy).dest = DEST_AUTOMATIC; 81 82 optional QuotaTrackerProto base_quota_data = 1; 83 84 message CountLimit { 85 option (.android.msg_privacy).dest = DEST_AUTOMATIC; 86 87 optional CategoryProto category = 1; 88 optional int32 limit = 2; 89 optional int64 window_size_ms = 3; 90 } 91 repeated CountLimit count_limit = 2; 92 93 message Event { 94 option (.android.msg_privacy).dest = DEST_AUTOMATIC; 95 96 // The time the event occurred, in the elapsed realtime timebase. 97 optional int64 timestamp_elapsed = 1; 98 } 99 100 message ExecutionStats { 101 option (.android.msg_privacy).dest = DEST_AUTOMATIC; 102 103 // The time after which this record should be considered invalid (out of date), in the 104 // elapsed realtime timebase. 105 optional int64 expiration_time_elapsed = 1; 106 107 optional int64 window_size_ms = 2; 108 optional int32 count_limit = 3; 109 110 // The total number of events that occurred in the window. 111 optional int32 count_in_window = 4; 112 113 // The time after which the app will be under the bucket quota. This is only valid if 114 // count_in_window >= count_limit. 115 optional int64 in_quota_time_elapsed = 5; 116 } 117 118 message UptcStats { 119 option (.android.msg_privacy).dest = DEST_AUTOMATIC; 120 121 optional UptcProto uptc = 1; 122 123 // True if the UPTC has been given free quota. 124 optional bool is_quota_free = 2; 125 126 repeated Event events = 3; 127 128 repeated ExecutionStats execution_stats = 4; 129 } 130 repeated UptcStats uptc_stats = 3; 131 132 // Next tag: 4 133} 134