1/*
2 * Copyright (C) 2020 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.service;
19
20option java_multiple_files = true;
21option java_outer_classname = "SensorPrivacyServiceProto";
22
23import "frameworks/base/core/proto/android/privacy.proto";
24
25message AllSensorPrivacyServiceDumpProto {
26    option (android.msg_privacy).dest = DEST_AUTOMATIC;
27
28    // Is global sensor privacy enabled
29    optional bool is_enabled = 1;
30}
31
32message SensorPrivacyServiceDumpProto {
33    option (android.msg_privacy).dest = DEST_AUTOMATIC;
34
35    // DEPRECATED
36    // Is global sensor privacy enabled
37    optional bool is_enabled = 1;
38
39    // DEPRECATED
40    // Per sensor privacy enabled
41    repeated SensorPrivacyIndividualEnabledSensorProto individual_enabled_sensor = 2;
42
43    // Per user settings for sensor privacy
44    repeated SensorPrivacyUserProto user = 3;
45
46    // Implementation
47    optional string storage_implementation = 4;
48}
49
50message SensorPrivacyUserProto {
51    option (android.msg_privacy).dest = DEST_AUTOMATIC;
52
53    // User id
54    optional int32 user_id = 1;
55
56    // DEPRECATED
57    // Is global sensor privacy enabled
58    optional bool is_enabled = 2;
59
60    // Per sensor privacy enabled
61    // DEPRECATED
62    repeated SensorPrivacyIndividualEnabledSensorProto individual_enabled_sensor = 3;
63
64    // Per toggle type sensor privacy
65    repeated SensorPrivacySensorProto sensors = 4;
66}
67
68message SensorPrivacySensorProto {
69    option (android.msg_privacy).dest = DEST_AUTOMATIC;
70
71    enum Sensor {
72        UNKNOWN = 0;
73
74        MICROPHONE = 1;
75        CAMERA = 2;
76    }
77
78    optional int32 sensor = 1;
79
80    repeated SensorPrivacyIndividualEnabledSensorProto toggles = 2;
81}
82
83message SensorPrivacyIndividualEnabledSensorProto {
84    option (android.msg_privacy).dest = DEST_AUTOMATIC;
85
86    enum ToggleType {
87        SOFTWARE = 1;
88        HARDWARE = 2;
89    }
90
91    enum StateType {
92        ENABLED = 1;
93        DISABLED = 2;
94        ENABLED_EXCEPT_ALLOWLISTED_APPS = 3;
95    }
96
97    // DEPRECATED
98    enum Sensor {
99        UNKNOWN = 0;
100
101        MICROPHONE = 1;
102        CAMERA = 2;
103    }
104
105    // Sensor for which privacy might be enabled
106    optional Sensor sensor = 1;
107
108    // DEPRECATED
109    optional bool is_enabled = 2;
110
111    // Timestamp of the last time the sensor was changed
112    optional int64 last_change = 3;
113
114    // The toggle type for this state
115    optional ToggleType toggle_type = 4;
116
117    // If sensor privacy state for this sensor
118    optional StateType state_type = 5;
119}
120
121message SensorPrivacyToggleSourceProto {
122    option (android.msg_privacy).dest = DEST_AUTOMATIC;
123
124    enum Source {
125        UNKNOWN = 0;
126
127        QS_TILE = 1;
128        SETTINGS = 2;
129        DIALOG = 3;
130        SHELL = 4;
131        OTHER = 5;
132        SAFETY_CENTER = 6;
133    }
134
135    // Source for which sensor privacy was toggled.
136    optional Source source = 1;
137
138}
139