• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (C) 2024 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.os.statsd.uprobestats;
20
21import "frameworks/proto_logging/stats/atoms.proto";
22import "frameworks/proto_logging/stats/atom_field_options.proto";
23
24option java_package = "com.android.os.uprobestats";
25option java_multiple_files = true;
26
27extend Atom {
28  optional TestUprobeStatsAtomReported test_uprobestats_atom_reported = 915;
29  optional SetComponentEnabledSettingReported set_component_enabled_setting_reported = 1018 [(module) = "uprobestats"];
30  optional BalProcessControllerAddBoundClientUidReported bal_process_controller_add_bound_client_uid_reported = 1019 [deprecated = true];
31  optional BindServiceLockedWithBalFlagsReported bind_service_locked_with_bal_flags_reported = 1045;
32}
33
34/* Test atom, specifically for UprobeStats tests, not logged anywhere */
35message TestUprobeStatsAtomReported {
36    optional int64 first_field = 1;
37    optional int64 second_field = 2;
38    optional int64 third_field = 3;
39}
40
41/**
42  * Logged by uprobestats on sampled devices, when
43  * components have been enabled/disabled.
44  *
45  * This event happens quite frequently (multiple times per second) on boot,
46  * and rarely thereafter. Implementation filters out packages in the
47  * android and com.android namespaces, and states lower than
48  * COMPONENT_ENABLED_STATE_DISABLED, which suppresses
49  * nearly all of those early boot events.
50  *
51  * Given the above, expected logging rate is on the order of tens
52  * in a day.
53  */
54message SetComponentEnabledSettingReported {
55    optional string package_name = 1;
56    optional string class_name = 2;
57    optional int32 new_state = 3;
58    optional string calling_package_name = 4;
59}
60
61/**
62  * DEPRECATED - this message was never usesd and is replaced by
63  * BindServiceLockedWithBalFlagsReported.
64  *
65  * Logged by uprobestats on sampled devices, when
66  * unprivileged apps bind to privileged apps that
67  * are allowed to do BAL (e.g. apps managing companion devices).
68  *
69  * Expected logging rate is on the order of tens in a day.
70  */
71message BalProcessControllerAddBoundClientUidReported {
72    optional int32 client_uid = 1 [(is_uid) = true];
73    optional string client_package_name = 2;
74    optional int32 bind_flags = 3;
75}
76
77/**
78  * Flags that can be passed to Context.bindService.
79  *
80  * This should be kept in sync with the `BIND_` flags in
81  * frameworks/base/core/java/android/content/Context.java.
82  */
83enum BindServiceFlags {
84    UNSPECIFIED = 0;
85    BIND_AUTO_CREATE = 0x0001;
86    BIND_DEBUG_UNBIND = 0x0002;
87    BIND_NOT_FOREGROUND = 0x0004;
88    BIND_ABOVE_CLIENT = 0x0008;
89    BIND_ALLOW_OOM_MANAGEMENT = 0x0010;
90    BIND_WAIVE_PRIORITY = 0x0020;
91    BIND_IMPORTANT = 0x0040;
92    BIND_ADJUST_WITH_ACTIVITY = 0x0080;
93    BIND_NOT_PERCEPTIBLE = 0x00000100;
94    BIND_ALLOW_ACTIVITY_STARTS = 0X000000200;
95    BIND_INCLUDE_CAPABILITIES = 0x000001000;
96    BIND_SHARED_ISOLATED_PROCESS = 0x00002000;
97    BIND_PACKAGE_ISOLATED_PROCESS = 0x4000; // 1 << 14
98    BIND_NOT_APP_COMPONENT_USAGE = 0x00008000;
99    BIND_ALMOST_PERCEPTIBLE = 0x000010000;
100    BIND_BYPASS_POWER_NETWORK_RESTRICTIONS = 0x00020000;
101    BIND_ALLOW_FOREGROUND_SERVICE_STARTS_FROM_BACKGROUND = 0x00040000;
102    BIND_SCHEDULE_LIKE_TOP_APP = 0x00080000;
103    BIND_ALLOW_BACKGROUND_ACTIVITY_STARTS = 0x00100000;
104    BIND_RESTRICT_ASSOCIATIONS = 0x00200000;
105    BIND_ALLOW_INSTANT = 0x00400000;
106    BIND_IMPORTANT_BACKGROUND = 0x00800000;
107    BIND_ALLOW_WHITELIST_MANAGEMENT = 0x01000000;
108    BIND_FOREGROUND_SERVICE_WHILE_AWAKE = 0x02000000;
109    BIND_FOREGROUND_SERVICE = 0x04000000;
110    BIND_TREAT_LIKE_ACTIVITY = 0x08000000;
111    // @deprecated Repurposed to {@link #BIND_TREAT_LIKE_VISIBLE_FOREGROUND_SERVICE}.
112    // BIND_VISIBLE = 0x10000000;
113    BIND_TREAT_LIKE_VISIBLE_FOREGROUND_SERVICE = 0x10000000;
114    BIND_SHOWING_UI = 0x20000000;
115    BIND_NOT_VISIBLE = 0x40000000;
116    // java.lang.Long flags that are not supported by proto enum.
117    // BIND_EXTERNAL_SERVICE = 0x80000000;
118    // BIND_EXTERNAL_SERVICE_LONG = 0x4000000000000000; // 1L << 62
119    // BIND_BYPASS_USER_NETWORK_RESTRICTIONS = 0x100000000; // 0x1_0000_0000L
120    // BIND_MATCH_QUARANTINED_COMPONENTS = 0x200000000 // 0x2_0000_0000L
121    // BIND_ALLOW_FREEZE = 0x400000000; // 0x4_0000_0000L
122}
123
124/**
125  * Logged by uprobestats on sampled devices, when
126  * unprivileged apps bind to privileged apps that
127  * are allowed to do BAL (e.g. apps managing companion devices).
128  *
129  * Expected logging rate is on the order of tens in a day.
130  */
131message BindServiceLockedWithBalFlagsReported {
132    optional string intent_package_name = 1;
133    // The flags passed to the bindServiceLocked call.
134    // Must be one or a combination of the types in BindServiceFlags enum above.
135    optional int64 flags = 2;
136    optional string calling_package_name = 3;
137}
138