1/*
2 * Copyright (C) 2022 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.permissioncontroller;
20
21import "frameworks/proto_logging/stats/atoms.proto";
22import "frameworks/proto_logging/stats/atom_field_options.proto";
23
24// This file contains extension atoms for permission controller.
25option java_package = "com.android.os.permissioncontroller";
26option java_multiple_files = true;
27
28extend Atom {
29    optional PermissionRationaleDialogViewed permission_rationale_dialog_viewed =
30        645 [(module) = "permissioncontroller"];
31    optional PermissionRationaleDialogActionReported permission_rationale_dialog_action_reported =
32        646 [(module) = "permissioncontroller"];
33    optional AppDataSharingUpdatesNotificationInteraction app_data_sharing_updates_notification_interaction =
34        647 [(module) = "permissioncontroller"];
35    optional AppDataSharingUpdatesFragmentViewed app_data_sharing_updates_fragment_viewed =
36        648 [(module) = "permissioncontroller"];
37    optional AppDataSharingUpdatesFragmentActionReported app_data_sharing_updates_fragment_action_reported =
38        649 [(module) = "permissioncontroller"];
39    optional EnhancedConfirmationDialogResultReported enhanced_confirmation_dialog_result_reported =
40        827 [(module) = "permissioncontroller"];
41    optional EnhancedConfirmationRestrictionCleared enhanced_confirmation_restriction_cleared =
42        828 [(module) = "permissioncontroller"];
43}
44
45/**
46* Information about a Permission Rationale dialog viewed by user.
47* Logged from ui/model/v34/PermissionRationaleViewModel.java
48*/
49message PermissionRationaleDialogViewed {
50    // id which identifies single session of user interacting with permission controller
51    optional int64 session_id = 1;
52
53    // UID of package for which permissions are viewed
54    optional int32 uid = 2 [(is_uid) = true];
55
56    // Permission group viewed
57    optional string permission_group_name = 3;
58
59    // Data usage purposes shown to user for this permission group in the dialog - bit flags,
60    // bit numbers are in accordance with PURPOSE_ constants in DataPurposeConstants.java
61    optional int32 purposes_presented = 4;
62}
63
64/**
65 * Information about a button clicks made by user inside PermissionRationaleActivity
66 */
67message PermissionRationaleDialogActionReported {
68    // id which identifies single session of user interacting with permission controller
69    optional int64 session_id = 1;
70
71    // UID of package the permission belongs to
72    optional int32 uid = 2 [(is_uid) = true];
73
74    // The permission group currently presented
75    optional string permission_group_name = 3;
76
77    enum Button {
78        UNDEFINED = 0;
79        // Dialog canceled or back clicked
80        CANCEL = 1;
81        // Link to install source (app store)
82        INSTALL_SOURCE = 2;
83        // Link to help center article
84        HELP_CENTER = 3;
85        // Link to permission settings
86        PERMISSION_SETTINGS = 4;
87    }
88
89    // Button pressed in the dialog
90    optional Button button_pressed = 4;
91}
92
93/**
94 * Information about AppDataSharingUpdates notification and interaction
95 */
96message AppDataSharingUpdatesNotificationInteraction {
97    // Session Id to link the notification with the issue card.
98    optional int64 session_id = 1; // to map the notification and issue card interaction
99
100    enum Action {
101        UNKNOWN = 0;
102        NOTIFICATION_SHOWN = 1;
103        NOTIFICATION_CLICKED = 2;
104        DISMISSED = 3;
105    }
106
107    // Action taken on the notification.
108    optional Action action = 2;
109
110    // Number app data sharing updates represented by the notification
111    optional int32 number_of_app_updates = 3;
112}
113
114/**
115* Information about AppDataSharingUpdatesFragment viewed by user.
116* Logged from ui/model/v34/AppDataSharingUpdatesViewModel.java
117*/
118message AppDataSharingUpdatesFragmentViewed {
119    // id which identifies single session of user interacting with permission controller
120    optional int64 session_id = 1;
121
122    // Number of app data sharing updates displayed when viewed
123    optional int32 number_of_app_updates = 2;
124}
125
126/**
127 * Information about a button clicks made by user inside AppDataSharingUpdatesFragment
128 */
129message AppDataSharingUpdatesFragmentActionReported {
130    // id which identifies single session of user interacting with permission controller
131    optional int64 session_id = 1;
132
133    // UID of package the interacted data sharing update belongs to
134    optional int32 uid = 2 [(is_uid) = true];
135
136    enum DataSharingChange {
137        UNKNOWN = 0;
138        ADDS_ADVERTISING_PURPOSE = 1;
139        ADDS_SHARING_WITHOUT_ADVERTISING_PURPOSE = 2;
140        ADDS_SHARING_WITH_ADVERTISING_PURPOSE = 3;
141    }
142
143    // Data sharing change associated with this data sharing update
144    optional DataSharingChange data_sharing_change = 3;
145}
146
147/**
148 * Logged when the ECM (Enhanced Confirmation Mode) dialog is closed.
149 *
150 * Logs from: com.android.permissioncontroller
151 *            .permission.ui.GrantPermissionsActivity
152 *
153 */
154message EnhancedConfirmationDialogResultReported {
155  // UID of the restricted app
156  optional int32 uid = 1;
157
158  // Identifier of the restricted setting
159  optional string setting_identifier = 2;
160
161  // True if this is the first time showing this dialog for this app
162  optional bool first_show_for_app = 3;
163
164  enum SettingType {
165    SETTING_TYPE_UNSPECIFIED = 0;
166    SETTING_TYPE_APPOP = 1;
167    SETTING_TYPE_PERMISSION = 2;
168    SETTING_TYPE_ROLE = 3;
169    SETTING_TYPE_OTHER = 4;
170  }
171
172  // Which type of resource setting_identifier refers to
173  optional SettingType setting_type = 4;
174
175  enum Result {
176    RESULT_UNSPECIFIED = 0;
177    RESULT_CANCELLED = 1;
178    RESULT_LEARN_MORE = 2;
179    RESULT_OK = 3;
180    RESULT_SUPPRESSED = 4;
181  }
182
183  // Which button or action the user invoked to close the dialog
184  optional Result result = 5;
185}
186
187/**
188 * Logged when an app's ECM (Enhanced Confirmation Mode) restriction
189 * status is cleared by the user.
190 *
191 * Logs from: com.android.ecm.EnhancedConfirmationService
192 *
193 */
194message EnhancedConfirmationRestrictionCleared {
195  // UID of the restricted app
196  optional int32 uid = 1;
197}
198