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 */
16syntax = "proto2";
17
18option java_package = "com.android.launcher3.logger";
19option java_outer_classname = "LauncherAtom";
20
21//
22// ItemInfos
23message ItemInfo {
24  oneof Item {
25    Application application = 1;
26    Task task = 2;
27    Shortcut shortcut = 3;
28    Widget widget = 4;
29    FolderIcon folder_icon = 9;
30  }
31  // When used for launch event, stores the global predictive rank
32  optional int32 rank = 5;
33
34  // Stores whether the Item belows to non primary user
35  optional bool is_work = 6;
36
37  // Item can be child node to parent container or parent containers (nested)
38  optional ContainerInfo container_info = 7;
39
40  // Stores the origin of the Item
41  optional Attribute attribute = 8;
42}
43
44// Represents various launcher surface where items are placed.
45message ContainerInfo {
46  oneof Container {
47    WorkspaceContainer workspace = 1;
48    HotseatContainer hotseat = 2;
49    FolderContainer folder = 3;
50    AllAppsContainer all_apps_container = 4;
51    WidgetsContainer widgets_container = 5;
52    PredictionContainer prediction_container = 6;
53    SearchResultContainer search_result_container = 7;
54    ShortcutsContainer shortcuts_container = 8;
55    SettingsContainer settings_container = 9;
56    PredictedHotseatContainer predicted_hotseat_container = 10;
57    TaskSwitcherContainer task_switcher_container = 11;
58  }
59}
60
61// Represents the apps list sorted alphabetically inside the all-apps view.
62message AllAppsContainer {
63}
64
65message WidgetsContainer {
66}
67
68// Represents the predicted apps row(top row) in the all-apps view.
69message PredictionContainer {
70}
71
72// Represents the apps container within search results.
73message SearchResultContainer {
74
75  // Length of search term.
76  optional int32 query_length = 1;
77
78  // Container from where search was invoked.
79  oneof ParentContainer {
80    WorkspaceContainer workspace = 2;
81    AllAppsContainer all_apps_container = 3;
82  }
83}
84
85// Container for package specific shortcuts to deep links and notifications.
86// Typically shown as popup window by longpressing on an icon.
87message ShortcutsContainer {
88}
89
90// Container for generic system shortcuts for launcher specific settings.
91// Typically shown up as popup window by longpressing on empty space on workspace.
92message SettingsContainer {
93}
94
95message TaskSwitcherContainer {
96}
97
98enum Attribute {
99  UNKNOWN = 0;
100  DEFAULT_LAYOUT = 1;       // icon automatically placed in workspace, folder, hotseat
101  BACKUP_RESTORE = 2;       // icon layout restored from backup
102  PINITEM = 3;              // from another app (e.g., Chrome's "Add to Home screen")
103  ALLAPPS_ATOZ = 4;         // within launcher surface, all aps a-z
104  WIDGETS = 5;              // within launcher, widgets tray
105  ADD_TO_HOMESCREEN = 6;    // play install + launcher home setting
106  ALLAPPS_PREDICTION = 7;   // from prediction bar in all apps container
107  HOTSEAT_PREDICTION = 8;   // from prediction bar in hotseat container
108
109  // Folder's label is one of the non-empty suggested values.
110  SUGGESTED_LABEL = 9;
111
112  // Folder's label is non-empty, manually entered by the user
113  // and different from any of suggested values.
114  MANUAL_LABEL = 10;
115
116  // Folder's label is not yet assigned( i.e., title == null).
117  // Eligible for auto-labeling.
118  UNLABELED = 11;
119
120  // Folder's label is empty(i.e., title == "").
121  // Not eligible for auto-labeling.
122  EMPTY_LABEL = 12;
123}
124
125// Main app icons
126message Application {
127  optional string package_name = 1;
128  optional string component_name = 2;
129}
130
131// Legacy shortcuts and shortcuts handled by ShortcutManager
132message Shortcut {
133  optional string shortcut_name = 1;
134}
135
136// AppWidgets handled by AppWidgetManager
137message Widget {
138  optional int32 span_x = 1 [default = 1];
139  optional int32 span_y = 2 [default = 1];
140  optional int32 app_widget_id = 3;
141  optional string package_name = 4; // only populated during snapshot if from workspace
142  optional string component_name = 5; // only populated during snapshot if from workspace
143}
144
145// Tasks handled by PackageManager
146message Task {
147  optional string package_name = 1;
148  optional string component_name = 2;
149  optional int32 index = 3;
150}
151
152// Represents folder in a closed state.
153message FolderIcon {
154  // Number of items inside folder.
155  optional int32 cardinality = 1;
156
157  // State of the folder label before the event.
158  optional FromState from_label_state = 2;
159
160  // State of the folder label after the event.
161  optional ToState to_label_state = 3;
162
163  // Details about actual folder label.
164  // Populated when folder label is not a PII.
165  optional string label_info = 4;
166}
167
168//////////////////////////////////////////////
169// Containers
170
171message WorkspaceContainer {
172  optional int32 page_index = 1 [default = -2]; // range [-1, l], 0 is the index of the main homescreen
173  optional int32 grid_x = 2 [default = -1]; // [0, m], m varies based on the display density and resolution
174  optional int32 grid_y = 3 [default = -1]; // [0, n], n varies based on the display density and resolution
175}
176
177message HotseatContainer {
178  optional int32 index = 1;
179}
180
181// Represents hotseat container with prediction feature enabled.
182message PredictedHotseatContainer {
183  optional int32 index = 1;
184
185  // No of hotseat positions filled with predicted items.
186  optional int32 cardinality = 2;
187}
188
189message FolderContainer {
190  optional int32 page_index = 1 [default = -1];
191  optional int32 grid_x = 2 [default = -1];
192  optional int32 grid_y = 3 [default = -1];
193  oneof ParentContainer {
194    WorkspaceContainer workspace = 4;
195    HotseatContainer hotseat = 5;
196  }
197}
198
199// Represents state of EditText field before update.
200enum FromState {
201  // Default value.
202  // Used when a FromState is not applicable, for example, during folder creation.
203  FROM_STATE_UNSPECIFIED = 0;
204
205  // EditText was empty.
206  // Eg: When a folder label is updated from empty string.
207  FROM_EMPTY = 1;
208
209  // EditText was non-empty and manually entered by the user.
210  // Eg: When a folder label is updated from a user-entered value.
211  FROM_CUSTOM = 2;
212
213  // EditText was non-empty and one of the suggestions.
214  // Eg: When a folder label is updated from a suggested value.
215  FROM_SUGGESTED = 3;
216}
217
218// Represents state of EditText field after update.
219enum ToState {
220  // Default value.
221  // Used when ToState is not applicable, for example, when folder label is updated to a different
222  // value when folder label suggestion feature is disabled.
223  TO_STATE_UNSPECIFIED = 0;
224
225  // User attempted to change the EditText, but was not changed.
226  UNCHANGED = 1;
227
228  // New label matches with primary(aka top) suggestion.
229  TO_SUGGESTION0 = 2;
230
231  // New value matches with second top suggestion even though the top suggestion was non-empty.
232  TO_SUGGESTION1_WITH_VALID_PRIMARY = 3;
233
234  // New value matches with second top suggestion given that top suggestion was empty.
235  TO_SUGGESTION1_WITH_EMPTY_PRIMARY = 4;
236
237  // New value matches with third top suggestion even though the top suggestion was non-empty.
238  TO_SUGGESTION2_WITH_VALID_PRIMARY = 5;
239
240  // New value matches with third top suggestion given that top suggestion was empty.
241  TO_SUGGESTION2_WITH_EMPTY_PRIMARY = 6;
242
243  // New value matches with 4th top suggestion even though the top suggestion was non-empty.
244  TO_SUGGESTION3_WITH_VALID_PRIMARY = 7;
245
246  // New value matches with 4th top suggestion given that top suggestion was empty.
247  TO_SUGGESTION3_WITH_EMPTY_PRIMARY = 8;
248
249  // New value is empty even though the top suggestion was non-empty.
250  TO_EMPTY_WITH_VALID_PRIMARY = 9;
251
252  // New value is empty given that top suggestion was empty.
253  TO_EMPTY_WITH_VALID_SUGGESTIONS_AND_EMPTY_PRIMARY = 10;
254
255  // New value is empty given that no suggestions were provided.
256  TO_EMPTY_WITH_EMPTY_SUGGESTIONS = 11;
257
258  // New value is empty given that suggestions feature was disabled.
259  TO_EMPTY_WITH_SUGGESTIONS_DISABLED = 12;
260
261  // New value is non-empty and does not match with any of the suggestions even though the top suggestion was non-empty.
262  TO_CUSTOM_WITH_VALID_PRIMARY = 13;
263
264  // New value is non-empty and not match with any suggestions given that top suggestion was empty.
265  TO_CUSTOM_WITH_VALID_SUGGESTIONS_AND_EMPTY_PRIMARY = 14;
266
267  // New value is non-empty and also no suggestions were provided.
268  TO_CUSTOM_WITH_EMPTY_SUGGESTIONS = 15;
269
270  // New value is non-empty and also suggestions feature was disable.
271  TO_CUSTOM_WITH_SUGGESTIONS_DISABLED = 16;
272}
273