1/*
2 * Copyright (C) 2023 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.healthfitness.api;
20
21import "frameworks/proto_logging/stats/atoms.proto";
22import "frameworks/proto_logging/stats/atom_field_options.proto";
23import "frameworks/proto_logging/stats/enums/healthfitness/api/enums.proto";
24
25option java_multiple_files = true;
26option java_package = "com.android.os.healthfitness.api";
27
28extend Atom {
29  optional HealthConnectApiCalled health_connect_api_called = 616 [(module) = "healthfitness"];
30
31  optional HealthConnectUsageStats health_connect_usage_stats = 617 [(module) = "healthfitness"];
32
33  optional HealthConnectStorageStats health_connect_storage_stats = 618 [(module) = "healthfitness"];
34
35  optional HealthConnectApiInvoked health_connect_api_invoked = 643 [(module) = "healthfitness", (restriction_category) = RESTRICTION_DIAGNOSTIC];
36
37  optional ExerciseRouteApiCalled exercise_route_api_called = 654 [(module) = "healthfitness", (restriction_category) = RESTRICTION_DIAGNOSTIC];
38}
39
40// Track HealthDataService API operations.
41message HealthConnectApiCalled {
42
43  // API method invoked.
44  optional android.healthfitness.api.ApiMethod api_method = 1;
45
46  // Status whether the API call executed successfully or not.
47  optional android.healthfitness.api.ApiStatus api_status = 2;
48
49  // Only relevant when status == ERROR;
50  optional int32 error_code = 3;
51
52  // Total API call duration in milliseconds.
53  optional int64 duration_millis = 4;
54
55  // Number of records being inserted/updated etc. (If any)
56  optional int32 number_of_records = 5;
57
58  // Type of rate limiting being used (If any)
59  optional android.healthfitness.api.RateLimit rate_limit = 6;
60
61  // The API caller's foreground status
62  optional android.healthfitness.api.ForegroundState caller_foreground_state = 7;
63}
64
65// Track if users are connecting apps with Health Connect
66message HealthConnectUsageStats {
67
68  // Number of connected apps
69  optional int32 connected_apps_count = 1;
70
71  // Number of apps on device that can be connected to Health Connect.
72  optional int32 available_apps_count = 2;
73
74  // Set true is the user has one app reading or writing in past 30 days
75  optional bool is_monthly_active_user = 3;
76}
77
78// Monitor Health Connect database
79message HealthConnectStorageStats {
80
81  // Size of database
82  optional int64 database_size = 1;
83
84  // Total number of instant records in the database.
85  optional int64 instant_data_count = 2;
86
87  // Total number of interval records in the database.
88  optional int64 interval_data_count = 3;
89
90  // Total number of series records in the database.
91  optional int64 series_data_count = 4;
92
93  // Total number of changelog counts.
94  optional int64 changelog_count = 5;
95
96}
97
98// Track when ExerciseRoute is being read/written.
99message ExerciseRouteApiCalled {
100
101  // Read/write.
102  optional android.healthfitness.api.Operation operation = 1;
103
104  // Package name of the client that invoked the API.
105  optional string package_name = 2;
106
107  // Number of records under operation
108  optional int32 number_of_records = 3;
109
110}
111
112// Track Health Connect API operations stats.
113message HealthConnectApiInvoked {
114
115  // API method invoked.
116  optional android.healthfitness.api.ApiMethod api_method = 1;
117
118  // Status whether the API call executed successfully or not.
119  optional android.healthfitness.api.ApiStatus api_status = 2;
120
121  // Only relevant when status == ERROR;
122  optional int32 error_code = 3;
123
124  // Total API call duration in milliseconds.
125  optional int64 duration_millis = 4;
126
127  // Package name of the client that invoked the API.
128  optional string package_name = 5;
129
130  // Data types under consideration in the API call (if any)
131  optional android.healthfitness.api.DataType data_type_one = 6
132  [(field_restriction_option).health_connect = true];
133
134  optional android.healthfitness.api.DataType data_type_two = 7
135  [(field_restriction_option).health_connect = true];
136
137  optional android.healthfitness.api.DataType data_type_three = 8
138  [(field_restriction_option).health_connect = true];
139
140  optional android.healthfitness.api.DataType data_type_four = 9
141  [(field_restriction_option).health_connect = true];
142
143  optional android.healthfitness.api.DataType data_type_five = 10
144  [(field_restriction_option).health_connect = true];
145
146  optional android.healthfitness.api.DataType data_type_six = 11
147  [(field_restriction_option).health_connect = true];
148
149}
150