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