1/*
2 * Copyright (C) 2016 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
18import "launcher_log_extension.proto";
19
20option java_package = "com.android.launcher3.userevent";
21option java_outer_classname = "LauncherLogProto";
22
23package userevent;
24
25message Target {
26  enum Type {
27    NONE = 0;
28    ITEM = 1;
29    CONTROL = 2;
30    CONTAINER = 3;
31  }
32
33  optional Type type = 1;
34
35  // For container type and item type
36  // Used mainly for ContainerType.FOLDER, ItemType.*
37  optional int32 page_index = 2;
38  optional int32 rank = 3;
39  optional int32 grid_x = 4;
40  optional int32 grid_y = 5;
41
42  // For container types only
43  optional ContainerType container_type = 6;
44  optional int32 cardinality = 7;
45
46  // For control types only
47  optional ControlType control_type = 8;
48
49  // For item types only
50  optional ItemType item_type = 9;
51  optional int32 package_name_hash = 10;
52  optional int32 component_hash = 11;      // Used for ItemType.WIDGET
53  optional int32 intent_hash = 12;         // Used for ItemType.SHORTCUT
54  optional int32 span_x = 13 [default = 1];// Used for ItemType.WIDGET
55  optional int32 span_y = 14 [default = 1];// Used for ItemType.WIDGET
56  optional int32 predictedRank = 15;
57  optional TargetExtension extension = 16;
58}
59
60// Used to define what type of item a Target would represent.
61enum ItemType {
62  DEFAULT_ITEMTYPE = 0;
63  APP_ICON = 1;
64  SHORTCUT = 2;
65  WIDGET = 3;
66  FOLDER_ICON = 4;
67  DEEPSHORTCUT = 5;
68  SEARCHBOX = 6;
69  EDITTEXT = 7;
70  NOTIFICATION = 8;
71}
72
73// Used to define what type of container a Target would represent.
74enum ContainerType {
75  DEFAULT_CONTAINERTYPE = 0;
76  WORKSPACE = 1;
77  HOTSEAT = 2;
78  FOLDER = 3;
79  ALLAPPS = 4;
80  WIDGETS = 5;
81  OVERVIEW = 6;
82  PREDICTION = 7;
83  SEARCHRESULT = 8;
84  DEEPSHORTCUTS = 9;
85  PINITEM = 10;    // confirmation screen
86}
87
88// Used to define what type of control a Target would represent.
89enum ControlType {
90  DEFAULT_CONTROLTYPE = 0;
91  ALL_APPS_BUTTON = 1;
92  WIDGETS_BUTTON = 2;
93  WALLPAPER_BUTTON = 3;
94  SETTINGS_BUTTON = 4;
95  REMOVE_TARGET = 5;
96  UNINSTALL_TARGET = 6;
97  APPINFO_TARGET = 7;
98  RESIZE_HANDLE = 8;
99  VERTICAL_SCROLL = 9;
100  HOME_INTENT = 10; // Deprecated, use enum Command instead
101  BACK_BUTTON = 11; // Deprecated, use enum Command instead
102  // GO_TO_PLAYSTORE
103}
104
105// Used to define the action component of the LauncherEvent.
106message Action {
107  enum Type {
108    TOUCH = 0;
109    AUTOMATED = 1;
110    COMMAND = 2;
111    // SOFT_KEYBOARD, HARD_KEYBOARD, ASSIST
112  }
113  enum Touch {
114    TAP = 0;
115    LONGPRESS = 1;
116    DRAGDROP = 2;
117    SWIPE = 3;
118    FLING = 4;
119    PINCH = 5;
120  }
121 enum Direction {
122    NONE = 0;
123    UP = 1;
124    DOWN = 2;
125    LEFT = 3;
126    RIGHT = 4;
127  }
128  enum Command {
129    HOME_INTENT = 0;
130    BACK = 1;
131    ENTRY = 2;    // Indicates entry to one of Launcher container type target
132                  // not using the HOME_INTENT
133    CANCEL = 3;   // Indicates that a confirmation screen was cancelled
134    CONFIRM = 4;  // Indicates thata confirmation screen was accepted
135  }
136  optional Type type = 1;
137  optional Touch touch = 2;
138  optional Direction dir = 3;
139  optional Command command = 4;
140  // Log if the action was performed on outside of the container
141  optional bool is_outside = 5;
142}
143
144//
145// Context free grammar of typical user interaction:
146//         Action (Touch) + Target
147//         Action (Touch) + Target + Target
148//
149message LauncherEvent {
150  required Action action = 1;
151
152  // List of targets that touch actions can be operated on.
153  repeated Target src_target = 2;
154  repeated Target dest_target = 3;
155
156  optional int64 action_duration_millis = 4;
157  optional int64 elapsed_container_millis = 5;
158  optional int64 elapsed_session_millis = 6;
159
160  optional bool is_in_multi_window_mode = 7;
161  optional bool is_in_landscape_mode = 8;
162
163  optional LauncherEventExtension extension = 9;
164}
165