1/*
2 * Copyright (C) 2021 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.app.time;
19
20import "frameworks/base/core/proto/android/privacy.proto";
21
22option java_multiple_files = true;
23option java_outer_classname = "TimeZoneDetectorProto";
24
25// Represents a LocationTimeZoneProviderEvent that can be / has been passed to the time zone
26// detector.
27message LocationTimeZoneProviderEventProto {
28  option (android.msg_privacy).dest = DEST_AUTOMATIC;
29
30  optional GeolocationTimeZoneSuggestionProto suggestion = 1;
31  repeated string debug_info = 2;
32  optional LocationTimeZoneAlgorithmStatusProto algorithm_status = 3;
33}
34
35// Represents a LocationTimeZoneAlgorithmStatus that can be / has been passed to the time zone
36// detector.
37message LocationTimeZoneAlgorithmStatusProto {
38  option (android.msg_privacy).dest = DEST_AUTOMATIC;
39
40  optional DetectionAlgorithmStatusEnum status = 1;
41}
42
43// The state enum for detection algorithms.
44enum DetectionAlgorithmStatusEnum {
45    DETECTION_ALGORITHM_STATUS_UNKNOWN = 0;
46    DETECTION_ALGORITHM_STATUS_NOT_SUPPORTED = 1;
47    DETECTION_ALGORITHM_STATUS_NOT_RUNNING = 2;
48    DETECTION_ALGORITHM_STATUS_RUNNING = 3;
49}
50
51// Represents a GeolocationTimeZoneSuggestion that can be contained in a
52// LocationTimeZoneProviderEvent.
53message GeolocationTimeZoneSuggestionProto {
54  option (android.msg_privacy).dest = DEST_AUTOMATIC;
55
56  repeated string zone_ids = 1;
57}
58
59/*
60 * A generic-form time zone suggestion for metrics use. Required to be a superset of the
61 * MetricsTimeZoneSuggestion proto defined in atoms.proto to ensure binary compatibility.
62 */
63message MetricsTimeZoneSuggestion {
64  option (android.msg_privacy).dest = DEST_AUTOMATIC;
65
66  enum Type {
67    CERTAIN = 1;
68    UNCERTAIN = 2;
69  }
70  optional Type type = 1;
71
72  // The ordinals for time zone(s) in the suggestion. Always empty for
73  // UNCERTAIN, and can be empty for CERTAIN, for example when the device is in
74  // a disputed area / on an ocean.
75  //
76  // The suggestion's time zone IDs (which relate to location) are obfuscated by
77  // mapping them to an ordinal. When the ordinal is assigned consistently across
78  // several objects (i.e. so the same time zone ID is always mapped to the same
79  // ordinal), this allows comparisons between those objects. For example, we can
80  // answer "did these two suggestions agree?", "does the suggestion match the
81  // device's current time zone?", without leaking knowledge of location. Ordinals
82  // are also significantly more compact than full IANA TZDB IDs, albeit unstable
83  // and of limited use.
84  repeated int32 time_zone_ordinals = 2;
85
86  // The actual time zone ID(s) in the suggestion. Similar to time_zone_ordinals
87  // but contains the actual string IDs.
88  //
89  // This information is only captured / reported for some devices based on the
90  // value of a server side flag, i.e. it could be enabled for internal testers.
91  // Therefore the list can be empty even when time_zone_ordinals is populated.
92  //
93  // When enabled, see time_zone_ordinals for the expected number of values.
94  repeated string time_zone_ids = 3;
95}
96