Home | History | Annotate | Download | only in protos
      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  */
     16 syntax = "proto2";
     17 
     18 option java_package = "com.android.launcher3.userevent.nano";
     19 option java_outer_classname = "LauncherLogProto";
     20 
     21 package userevent;
     22 
     23 message 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.
     58 enum 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 }
     67 
     68 // Used to define what type of container a Target would represent.
     69 enum ContainerType {
     70   DEFAULT_CONTAINERTYPE = 0;
     71   WORKSPACE = 1;
     72   HOTSEAT = 2;
     73   FOLDER = 3;
     74   ALLAPPS = 4;
     75   WIDGETS = 5;
     76   OVERVIEW = 6;
     77   PREDICTION = 7;
     78   SEARCHRESULT = 8;
     79   DEEPSHORTCUTS = 9;
     80 }
     81 
     82 // Used to define what type of control a Target would represent.
     83 enum ControlType {
     84   DEFAULT_CONTROLTYPE = 0;
     85   ALL_APPS_BUTTON = 1;
     86   WIDGETS_BUTTON = 2;
     87   WALLPAPER_BUTTON = 3;
     88   SETTINGS_BUTTON = 4;
     89   REMOVE_TARGET = 5;
     90   UNINSTALL_TARGET = 6;
     91   APPINFO_TARGET = 7;
     92   RESIZE_HANDLE = 8;
     93   VERTICAL_SCROLL = 9;
     94   // HOME, BACK, GO_TO_PLAYSTORE
     95 }
     96 
     97 // Used to define the action component of the LauncherEvent.
     98 message Action {
     99   enum Type {
    100     TOUCH = 0;
    101     AUTOMATED = 1;
    102     // SOFT_KEYBOARD, HARD_KEYBOARD, ASSIST
    103   }
    104   enum Touch {
    105     TAP = 0;
    106     LONGPRESS = 1;
    107     DRAGDROP = 2;
    108     SWIPE = 3;
    109     FLING = 4;
    110     PINCH = 5;
    111   }
    112  enum Direction {
    113     NONE = 0;
    114     UP = 1;
    115     DOWN = 2;
    116     LEFT = 3;
    117     RIGHT = 4;
    118   }
    119   optional Type type = 1;
    120   optional Touch touch = 2;
    121   optional Direction dir = 3;
    122 }
    123 
    124 //
    125 // Context free grammar of typical user interaction:
    126 //         Action (Touch) + Target
    127 //         Action (Touch) + Target + Target
    128 //
    129 message LauncherEvent {
    130 
    131   required Action action = 1;
    132 
    133   // List of targets that touch actions can be operated on.
    134   repeated Target src_target = 2;
    135   repeated Target dest_target = 3;
    136 
    137   optional int64 action_duration_millis = 4;
    138   optional int64 elapsed_container_millis = 5;
    139   optional int64 elapsed_session_millis = 6;
    140 }
    141