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 
17 package android.health.connect.datatypes;
18 
19 import static android.health.connect.datatypes.validation.ValidationUtils.validateIntDefValue;
20 
21 import android.annotation.IntDef;
22 import android.annotation.NonNull;
23 import android.health.connect.HealthConnectManager;
24 
25 import java.lang.annotation.Retention;
26 import java.lang.annotation.RetentionPolicy;
27 import java.util.Collections;
28 import java.util.List;
29 import java.util.Objects;
30 import java.util.Set;
31 
32 /**
33  * Class to represent aggregation types in {@link Record} classes.
34  *
35  * <p>New objects of this class cannot be created.
36  *
37  * <p>Pre-created (defined in health {@link Record} types) objects of this class can be used to
38  * query and fetch aggregate results using aggregate APIs in {@link HealthConnectManager}
39  *
40  * @see HealthConnectManager#aggregate
41  */
42 public final class AggregationType<T> {
43     /** @hide */
44     public static final int MAX = 0;
45 
46     /** @hide */
47     public static final int MIN = 1;
48 
49     /** @hide */
50     public static final int AVG = 2;
51 
52     /** @hide */
53     public static final int SUM = 3;
54 
55     /** @hide */
56     public static final int COUNT = 4;
57 
58     @AggregationTypeIdentifier.Id private final int mId;
59     @AggregateOperationType private final int mType;
60     private final List<Integer> mApplicableRecordTypes;
61     private final Class<T> mClass;
62 
63     /** @hide */
AggregationType( @ggregationTypeIdentifier.Id int id, @AggregateOperationType int type, @NonNull List<Integer> applicableRecordTypes, Class<T> templateClass)64     AggregationType(
65             @AggregationTypeIdentifier.Id int id,
66             @AggregateOperationType int type,
67             @NonNull List<Integer> applicableRecordTypes,
68             Class<T> templateClass) {
69         Objects.requireNonNull(applicableRecordTypes);
70 
71         mId = id;
72         mType = type;
73         mApplicableRecordTypes = applicableRecordTypes;
74         mClass = templateClass;
75     }
76 
77     /** @hide */
AggregationType( @ggregationTypeIdentifier.Id int id, @AggregateOperationType int type, @NonNull @RecordTypeIdentifier.RecordType int applicableRecordType, Class<T> templateClass)78     AggregationType(
79             @AggregationTypeIdentifier.Id int id,
80             @AggregateOperationType int type,
81             @NonNull @RecordTypeIdentifier.RecordType int applicableRecordType,
82             Class<T> templateClass) {
83         validateIntDefValue(
84                 id,
85                 AggregationTypeIdentifier.IDENTIFIER_VALID_TYPES,
86                 AggregationTypeIdentifier.class.getSimpleName());
87         validateIntDefValue(
88                 type, OPERATION_VALID_TYPES, AggregateOperationType.class.getSimpleName());
89 
90         mId = id;
91         mType = type;
92         mApplicableRecordTypes = Collections.singletonList(applicableRecordType);
93         mClass = templateClass;
94     }
95 
96     /** @hide */
97     @AggregationTypeIdentifier.Id
getAggregationTypeIdentifier()98     public int getAggregationTypeIdentifier() {
99         return mId;
100     }
101 
102     /** @hide */
103     @NonNull
getApplicableRecordTypeIds()104     public List<Integer> getApplicableRecordTypeIds() {
105         return mApplicableRecordTypes;
106     }
107 
108     /** @hide */
109     @AggregateOperationType
getAggregateOperationType()110     public int getAggregateOperationType() {
111         return mType;
112     }
113 
114     /** @hide */
getAggregateResultClass()115     public Class<T> getAggregateResultClass() {
116         return mClass;
117     }
118 
119     /**
120      * Identifier for each aggregate type, as returned by {@link
121      * AggregationType#getAggregationTypeIdentifier()}. This is used at various places to determine
122      * operations to perform on aggregate type.
123      *
124      * @hide
125      */
126     public @interface AggregationTypeIdentifier {
127         int HEART_RATE_RECORD_BPM_MAX = 0;
128         int HEART_RATE_RECORD_BPM_MIN = 1;
129         int STEPS_RECORD_COUNT_TOTAL = 2;
130         int ACTIVE_CALORIES_BURNED_RECORD_ACTIVE_CALORIES_TOTAL = 3;
131         int BMR_RECORD_BASAL_CALORIES_TOTAL = 4;
132         int DISTANCE_RECORD_DISTANCE_TOTAL = 5;
133         int ELEVATION_RECORD_ELEVATION_GAINED_TOTAL = 6;
134         int HEART_RATE_RECORD_BPM_AVG = 7;
135         int POWER_RECORD_POWER_MIN = 8;
136         int POWER_RECORD_POWER_MAX = 9;
137         int POWER_RECORD_POWER_AVG = 10;
138         int HYDRATION_RECORD_VOLUME_TOTAL = 11;
139         int FLOORS_CLIMBED_RECORD_FLOORS_CLIMBED_TOTAL = 12;
140         int NUTRITION_RECORD_BIOTIN_TOTAL = 13;
141         int NUTRITION_RECORD_CAFFEINE_TOTAL = 14;
142         int NUTRITION_RECORD_CALCIUM_TOTAL = 15;
143         int NUTRITION_RECORD_CHLORIDE_TOTAL = 16;
144         int NUTRITION_RECORD_CHOLESTEROL_TOTAL = 17;
145         int NUTRITION_RECORD_CHROMIUM_TOTAL = 18;
146         int NUTRITION_RECORD_COPPER_TOTAL = 19;
147         int NUTRITION_RECORD_DIETARY_FIBER_TOTAL = 20;
148         int NUTRITION_RECORD_ENERGY_TOTAL = 21;
149         int NUTRITION_RECORD_ENERGY_FROM_FAT_TOTAL = 22;
150         int NUTRITION_RECORD_FOLATE_TOTAL = 23;
151         int NUTRITION_RECORD_FOLIC_ACID_TOTAL = 24;
152         int NUTRITION_RECORD_IODINE_TOTAL = 25;
153         int NUTRITION_RECORD_IRON_TOTAL = 26;
154         int NUTRITION_RECORD_MAGNESIUM_TOTAL = 27;
155         int NUTRITION_RECORD_MANGANESE_TOTAL = 28;
156         int NUTRITION_RECORD_MOLYBDENUM_TOTAL = 29;
157         int NUTRITION_RECORD_MONOUNSATURATED_FAT_TOTAL = 30;
158         int NUTRITION_RECORD_NIACIN_TOTAL = 31;
159         int NUTRITION_RECORD_PANTOTHENIC_ACID_TOTAL = 32;
160         int NUTRITION_RECORD_PHOSPHORUS_TOTAL = 33;
161         int NUTRITION_RECORD_POLYUNSATURATED_FAT_TOTAL = 34;
162         int NUTRITION_RECORD_POTASSIUM_TOTAL = 35;
163         int NUTRITION_RECORD_PROTEIN_TOTAL = 36;
164         int NUTRITION_RECORD_RIBOFLAVIN_TOTAL = 37;
165         int NUTRITION_RECORD_SATURATED_FAT_TOTAL = 38;
166         int NUTRITION_RECORD_SELENIUM_TOTAL = 39;
167         int NUTRITION_RECORD_SODIUM_TOTAL = 40;
168         int NUTRITION_RECORD_SUGAR_TOTAL = 41;
169         int NUTRITION_RECORD_THIAMIN_TOTAL = 42;
170         int NUTRITION_RECORD_TOTAL_CARBOHYDRATE_TOTAL = 43;
171         int NUTRITION_RECORD_TOTAL_FAT_TOTAL = 44;
172         int NUTRITION_RECORD_UNSATURATED_FAT_TOTAL = 45;
173         int NUTRITION_RECORD_VITAMIN_A_TOTAL = 46;
174         int NUTRITION_RECORD_VITAMIN_B12_TOTAL = 47;
175         int NUTRITION_RECORD_VITAMIN_B6_TOTAL = 48;
176         int NUTRITION_RECORD_VITAMIN_C_TOTAL = 49;
177         int NUTRITION_RECORD_VITAMIN_D_TOTAL = 50;
178         int NUTRITION_RECORD_VITAMIN_E_TOTAL = 51;
179         int NUTRITION_RECORD_VITAMIN_K_TOTAL = 52;
180         int NUTRITION_RECORD_ZINC_TOTAL = 53;
181         int HEIGHT_RECORD_HEIGHT_AVG = 54;
182         int HEIGHT_RECORD_HEIGHT_MAX = 55;
183         int HEIGHT_RECORD_HEIGHT_MIN = 56;
184         int RESTING_HEART_RATE_RECORD_BPM_MAX = 57;
185         int RESTING_HEART_RATE_RECORD_BPM_MIN = 58;
186         int TOTAL_CALORIES_BURNED_RECORD_ENERGY_TOTAL = 59;
187         int WEIGHT_RECORD_WEIGHT_AVG = 60;
188         int WEIGHT_RECORD_WEIGHT_MAX = 61;
189         int WEIGHT_RECORD_WEIGHT_MIN = 62;
190         int WHEEL_CHAIR_PUSHES_RECORD_COUNT_TOTAL = 63;
191         int HEART_RATE_RECORD_MEASUREMENTS_COUNT = 64;
192         int RESTING_HEART_RATE_RECORD_BPM_AVG = 65;
193         int SLEEP_SESSION_DURATION_TOTAL = 66;
194         int EXERCISE_SESSION_DURATION_TOTAL = 67;
195         int BLOOD_PRESSURE_RECORD_DIASTOLIC_AVG = 68;
196         int BLOOD_PRESSURE_RECORD_DIASTOLIC_MAX = 69;
197         int BLOOD_PRESSURE_RECORD_DIASTOLIC_MIN = 70;
198         int BLOOD_PRESSURE_RECORD_SYSTOLIC_AVG = 71;
199         int BLOOD_PRESSURE_RECORD_SYSTOLIC_MAX = 72;
200         int BLOOD_PRESSURE_RECORD_SYSTOLIC_MIN = 73;
201         int NUTRITION_RECORD_TRANS_FAT_TOTAL = 74;
202         int CYCLING_PEDALING_CADENCE_RECORD_RPM_AVG = 75;
203         int CYCLING_PEDALING_CADENCE_RECORD_RPM_MIN = 76;
204         int CYCLING_PEDALING_CADENCE_RECORD_RPM_MAX = 77;
205         int SPEED_RECORD_SPEED_AVG = 78;
206         int SPEED_RECORD_SPEED_MIN = 79;
207         int SPEED_RECORD_SPEED_MAX = 80;
208         int STEPS_CADENCE_RECORD_RATE_AVG = 81;
209         int STEPS_CADENCE_RECORD_RATE_MIN = 82;
210         int STEPS_CADENCE_RECORD_RATE_MAX = 83;
211         int SKIN_TEMPERATURE_RECORD_DELTA_AVG = 84;
212         int SKIN_TEMPERATURE_RECORD_DELTA_MIN = 85;
213         int SKIN_TEMPERATURE_RECORD_DELTA_MAX = 86;
214         int MINDFULNESS_SESSION_DURATION_TOTAL = 87;
215 
216         /**
217          * Valid set of values for this IntDef. Update this set when add new type or deprecate
218          * existing type.
219          *
220          * @hide
221          */
222         Set<Integer> IDENTIFIER_VALID_TYPES =
223                 Set.of(
224                         HEART_RATE_RECORD_BPM_MAX,
225                         HEART_RATE_RECORD_BPM_MIN,
226                         STEPS_RECORD_COUNT_TOTAL,
227                         ACTIVE_CALORIES_BURNED_RECORD_ACTIVE_CALORIES_TOTAL,
228                         BMR_RECORD_BASAL_CALORIES_TOTAL,
229                         DISTANCE_RECORD_DISTANCE_TOTAL,
230                         ELEVATION_RECORD_ELEVATION_GAINED_TOTAL,
231                         HEART_RATE_RECORD_BPM_AVG,
232                         POWER_RECORD_POWER_MIN,
233                         POWER_RECORD_POWER_MAX,
234                         POWER_RECORD_POWER_AVG,
235                         HYDRATION_RECORD_VOLUME_TOTAL,
236                         FLOORS_CLIMBED_RECORD_FLOORS_CLIMBED_TOTAL,
237                         CYCLING_PEDALING_CADENCE_RECORD_RPM_AVG,
238                         CYCLING_PEDALING_CADENCE_RECORD_RPM_MIN,
239                         CYCLING_PEDALING_CADENCE_RECORD_RPM_MAX,
240                         NUTRITION_RECORD_BIOTIN_TOTAL,
241                         NUTRITION_RECORD_CAFFEINE_TOTAL,
242                         NUTRITION_RECORD_CALCIUM_TOTAL,
243                         NUTRITION_RECORD_CHLORIDE_TOTAL,
244                         NUTRITION_RECORD_CHOLESTEROL_TOTAL,
245                         NUTRITION_RECORD_CHROMIUM_TOTAL,
246                         NUTRITION_RECORD_COPPER_TOTAL,
247                         NUTRITION_RECORD_DIETARY_FIBER_TOTAL,
248                         NUTRITION_RECORD_ENERGY_TOTAL,
249                         NUTRITION_RECORD_ENERGY_FROM_FAT_TOTAL,
250                         NUTRITION_RECORD_FOLATE_TOTAL,
251                         NUTRITION_RECORD_FOLIC_ACID_TOTAL,
252                         NUTRITION_RECORD_IODINE_TOTAL,
253                         NUTRITION_RECORD_IRON_TOTAL,
254                         NUTRITION_RECORD_MAGNESIUM_TOTAL,
255                         NUTRITION_RECORD_MANGANESE_TOTAL,
256                         NUTRITION_RECORD_MOLYBDENUM_TOTAL,
257                         NUTRITION_RECORD_MONOUNSATURATED_FAT_TOTAL,
258                         NUTRITION_RECORD_NIACIN_TOTAL,
259                         NUTRITION_RECORD_PANTOTHENIC_ACID_TOTAL,
260                         NUTRITION_RECORD_PHOSPHORUS_TOTAL,
261                         NUTRITION_RECORD_POLYUNSATURATED_FAT_TOTAL,
262                         NUTRITION_RECORD_POTASSIUM_TOTAL,
263                         NUTRITION_RECORD_PROTEIN_TOTAL,
264                         NUTRITION_RECORD_RIBOFLAVIN_TOTAL,
265                         NUTRITION_RECORD_SATURATED_FAT_TOTAL,
266                         NUTRITION_RECORD_SELENIUM_TOTAL,
267                         NUTRITION_RECORD_SODIUM_TOTAL,
268                         NUTRITION_RECORD_SUGAR_TOTAL,
269                         NUTRITION_RECORD_THIAMIN_TOTAL,
270                         NUTRITION_RECORD_TOTAL_CARBOHYDRATE_TOTAL,
271                         NUTRITION_RECORD_TOTAL_FAT_TOTAL,
272                         NUTRITION_RECORD_TRANS_FAT_TOTAL,
273                         NUTRITION_RECORD_UNSATURATED_FAT_TOTAL,
274                         NUTRITION_RECORD_VITAMIN_A_TOTAL,
275                         NUTRITION_RECORD_VITAMIN_B12_TOTAL,
276                         NUTRITION_RECORD_VITAMIN_B6_TOTAL,
277                         NUTRITION_RECORD_VITAMIN_C_TOTAL,
278                         NUTRITION_RECORD_VITAMIN_D_TOTAL,
279                         NUTRITION_RECORD_VITAMIN_E_TOTAL,
280                         NUTRITION_RECORD_VITAMIN_K_TOTAL,
281                         NUTRITION_RECORD_ZINC_TOTAL,
282                         HEIGHT_RECORD_HEIGHT_AVG,
283                         HEIGHT_RECORD_HEIGHT_MAX,
284                         HEIGHT_RECORD_HEIGHT_MIN,
285                         RESTING_HEART_RATE_RECORD_BPM_MAX,
286                         RESTING_HEART_RATE_RECORD_BPM_MIN,
287                         TOTAL_CALORIES_BURNED_RECORD_ENERGY_TOTAL,
288                         WEIGHT_RECORD_WEIGHT_AVG,
289                         WEIGHT_RECORD_WEIGHT_MAX,
290                         WEIGHT_RECORD_WEIGHT_MIN,
291                         WHEEL_CHAIR_PUSHES_RECORD_COUNT_TOTAL,
292                         HEART_RATE_RECORD_MEASUREMENTS_COUNT,
293                         RESTING_HEART_RATE_RECORD_BPM_AVG,
294                         SLEEP_SESSION_DURATION_TOTAL,
295                         EXERCISE_SESSION_DURATION_TOTAL,
296                         BLOOD_PRESSURE_RECORD_DIASTOLIC_AVG,
297                         BLOOD_PRESSURE_RECORD_DIASTOLIC_MAX,
298                         BLOOD_PRESSURE_RECORD_DIASTOLIC_MIN,
299                         BLOOD_PRESSURE_RECORD_SYSTOLIC_AVG,
300                         BLOOD_PRESSURE_RECORD_SYSTOLIC_MAX,
301                         BLOOD_PRESSURE_RECORD_SYSTOLIC_MIN,
302                         SPEED_RECORD_SPEED_AVG,
303                         SPEED_RECORD_SPEED_MIN,
304                         SPEED_RECORD_SPEED_MAX,
305                         STEPS_CADENCE_RECORD_RATE_AVG,
306                         STEPS_CADENCE_RECORD_RATE_MIN,
307                         STEPS_CADENCE_RECORD_RATE_MAX,
308                         SKIN_TEMPERATURE_RECORD_DELTA_AVG,
309                         SKIN_TEMPERATURE_RECORD_DELTA_MIN,
310                         SKIN_TEMPERATURE_RECORD_DELTA_MAX,
311                         MINDFULNESS_SESSION_DURATION_TOTAL);
312 
313         /** @hide */
314         @IntDef({
315             HEART_RATE_RECORD_BPM_MAX,
316             HEART_RATE_RECORD_BPM_MIN,
317             STEPS_RECORD_COUNT_TOTAL,
318             ACTIVE_CALORIES_BURNED_RECORD_ACTIVE_CALORIES_TOTAL,
319             BMR_RECORD_BASAL_CALORIES_TOTAL,
320             DISTANCE_RECORD_DISTANCE_TOTAL,
321             ELEVATION_RECORD_ELEVATION_GAINED_TOTAL,
322             HEART_RATE_RECORD_BPM_AVG,
323             POWER_RECORD_POWER_MIN,
324             POWER_RECORD_POWER_MAX,
325             POWER_RECORD_POWER_AVG,
326             HYDRATION_RECORD_VOLUME_TOTAL,
327             FLOORS_CLIMBED_RECORD_FLOORS_CLIMBED_TOTAL,
328             NUTRITION_RECORD_BIOTIN_TOTAL,
329             NUTRITION_RECORD_CAFFEINE_TOTAL,
330             NUTRITION_RECORD_CALCIUM_TOTAL,
331             NUTRITION_RECORD_CHLORIDE_TOTAL,
332             NUTRITION_RECORD_CHOLESTEROL_TOTAL,
333             NUTRITION_RECORD_CHROMIUM_TOTAL,
334             NUTRITION_RECORD_COPPER_TOTAL,
335             NUTRITION_RECORD_DIETARY_FIBER_TOTAL,
336             NUTRITION_RECORD_ENERGY_TOTAL,
337             NUTRITION_RECORD_ENERGY_FROM_FAT_TOTAL,
338             NUTRITION_RECORD_FOLATE_TOTAL,
339             NUTRITION_RECORD_FOLIC_ACID_TOTAL,
340             NUTRITION_RECORD_IODINE_TOTAL,
341             NUTRITION_RECORD_IRON_TOTAL,
342             NUTRITION_RECORD_MAGNESIUM_TOTAL,
343             NUTRITION_RECORD_MANGANESE_TOTAL,
344             NUTRITION_RECORD_MOLYBDENUM_TOTAL,
345             NUTRITION_RECORD_MONOUNSATURATED_FAT_TOTAL,
346             NUTRITION_RECORD_NIACIN_TOTAL,
347             NUTRITION_RECORD_PANTOTHENIC_ACID_TOTAL,
348             NUTRITION_RECORD_PHOSPHORUS_TOTAL,
349             NUTRITION_RECORD_POLYUNSATURATED_FAT_TOTAL,
350             NUTRITION_RECORD_POTASSIUM_TOTAL,
351             NUTRITION_RECORD_PROTEIN_TOTAL,
352             NUTRITION_RECORD_RIBOFLAVIN_TOTAL,
353             NUTRITION_RECORD_SATURATED_FAT_TOTAL,
354             NUTRITION_RECORD_SELENIUM_TOTAL,
355             NUTRITION_RECORD_SODIUM_TOTAL,
356             NUTRITION_RECORD_SUGAR_TOTAL,
357             NUTRITION_RECORD_THIAMIN_TOTAL,
358             NUTRITION_RECORD_TOTAL_CARBOHYDRATE_TOTAL,
359             NUTRITION_RECORD_TOTAL_FAT_TOTAL,
360             NUTRITION_RECORD_UNSATURATED_FAT_TOTAL,
361             NUTRITION_RECORD_VITAMIN_A_TOTAL,
362             NUTRITION_RECORD_VITAMIN_B12_TOTAL,
363             NUTRITION_RECORD_VITAMIN_B6_TOTAL,
364             NUTRITION_RECORD_VITAMIN_C_TOTAL,
365             NUTRITION_RECORD_VITAMIN_D_TOTAL,
366             NUTRITION_RECORD_VITAMIN_E_TOTAL,
367             NUTRITION_RECORD_VITAMIN_K_TOTAL,
368             NUTRITION_RECORD_ZINC_TOTAL,
369             HEIGHT_RECORD_HEIGHT_AVG,
370             HEIGHT_RECORD_HEIGHT_MAX,
371             HEIGHT_RECORD_HEIGHT_MIN,
372             RESTING_HEART_RATE_RECORD_BPM_MAX,
373             RESTING_HEART_RATE_RECORD_BPM_MIN,
374             TOTAL_CALORIES_BURNED_RECORD_ENERGY_TOTAL,
375             WEIGHT_RECORD_WEIGHT_AVG,
376             WEIGHT_RECORD_WEIGHT_MAX,
377             WEIGHT_RECORD_WEIGHT_MIN,
378             WHEEL_CHAIR_PUSHES_RECORD_COUNT_TOTAL,
379             HEART_RATE_RECORD_MEASUREMENTS_COUNT,
380             RESTING_HEART_RATE_RECORD_BPM_AVG,
381             SLEEP_SESSION_DURATION_TOTAL,
382             EXERCISE_SESSION_DURATION_TOTAL,
383             NUTRITION_RECORD_TRANS_FAT_TOTAL,
384             CYCLING_PEDALING_CADENCE_RECORD_RPM_AVG,
385             CYCLING_PEDALING_CADENCE_RECORD_RPM_MIN,
386             CYCLING_PEDALING_CADENCE_RECORD_RPM_MAX,
387             BLOOD_PRESSURE_RECORD_DIASTOLIC_AVG,
388             BLOOD_PRESSURE_RECORD_DIASTOLIC_MAX,
389             BLOOD_PRESSURE_RECORD_DIASTOLIC_MIN,
390             BLOOD_PRESSURE_RECORD_SYSTOLIC_AVG,
391             BLOOD_PRESSURE_RECORD_SYSTOLIC_MAX,
392             BLOOD_PRESSURE_RECORD_SYSTOLIC_MIN,
393             SPEED_RECORD_SPEED_AVG,
394             SPEED_RECORD_SPEED_MIN,
395             SPEED_RECORD_SPEED_MAX,
396             STEPS_CADENCE_RECORD_RATE_AVG,
397             STEPS_CADENCE_RECORD_RATE_MIN,
398             STEPS_CADENCE_RECORD_RATE_MAX,
399             SKIN_TEMPERATURE_RECORD_DELTA_AVG,
400             SKIN_TEMPERATURE_RECORD_DELTA_MIN,
401             SKIN_TEMPERATURE_RECORD_DELTA_MAX,
402             MINDFULNESS_SESSION_DURATION_TOTAL
403         })
404         @Retention(RetentionPolicy.SOURCE)
405         @interface Id {}
406     }
407 
408     /**
409      * Valid set of values for this IntDef. Update this set when add new type or deprecate existing
410      * type.
411      *
412      * @hide
413      */
414     public static final Set<Integer> OPERATION_VALID_TYPES = Set.of(MAX, MIN, AVG, SUM, COUNT);
415 
416     /** @hide */
417     @IntDef({MAX, MIN, AVG, SUM, COUNT})
418     @Retention(RetentionPolicy.SOURCE)
419     public @interface AggregateOperationType {}
420 }
421