/*
 * Copyright (C) 2016 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
syntax = "proto2";

import "launcher_log_extension.proto";

option java_package = "com.android.launcher3.userevent";
option java_outer_classname = "LauncherLogProto";

package userevent;

message Target {
  enum Type {
    NONE = 0;
    ITEM = 1;
    CONTROL = 2;
    CONTAINER = 3;
  }

  optional Type type = 1;

  // For container type and item type
  // Used mainly for ContainerType.FOLDER, ItemType.*
  optional int32 page_index = 2;
  optional int32 rank = 3;
  optional int32 grid_x = 4;
  optional int32 grid_y = 5;

  // For container types only
  optional ContainerType container_type = 6;
  optional int32 cardinality = 7;

  // For control types only
  optional ControlType control_type = 8;

  // For item types only
  optional ItemType item_type = 9;
  optional int32 package_name_hash = 10;
  optional int32 component_hash = 11;      // Used for ItemType.WIDGET
  optional int32 intent_hash = 12;         // Used for ItemType.SHORTCUT
  optional int32 span_x = 13 [default = 1];// Used for ItemType.WIDGET
  optional int32 span_y = 14 [default = 1];// Used for ItemType.WIDGET
  optional int32 predictedRank = 15;
  optional TargetExtension extension = 16;
  optional TipType tip_type = 17;
  optional int32 search_query_length = 18;
  optional bool is_work_app = 19;
  optional FromFolderLabelState from_folder_label_state = 20;
  optional ToFolderLabelState to_folder_label_state = 21;

  // Note: proto does not support duplicate enum values, even if they belong to different enum type.
  // Hence "FROM" and "TO" prefix added.
  enum FromFolderLabelState{
    FROM_FOLDER_LABEL_STATE_UNSPECIFIED = 0;
    FROM_EMPTY = 1;
    FROM_CUSTOM = 2;
    FROM_SUGGESTED = 3;
  }

  enum ToFolderLabelState{
    TO_FOLDER_LABEL_STATE_UNSPECIFIED = 0;
    TO_SUGGESTION0_WITH_VALID_PRIMARY = 1;
    TO_SUGGESTION1_WITH_VALID_PRIMARY = 2;
    TO_SUGGESTION1_WITH_EMPTY_PRIMARY = 3;
    TO_SUGGESTION2_WITH_VALID_PRIMARY = 4;
    TO_SUGGESTION2_WITH_EMPTY_PRIMARY = 5;
    TO_SUGGESTION3_WITH_VALID_PRIMARY = 6;
    TO_SUGGESTION3_WITH_EMPTY_PRIMARY = 7;
    TO_EMPTY_WITH_VALID_SUGGESTIONS = 8;
    TO_EMPTY_WITH_EMPTY_SUGGESTIONS = 9;
    TO_EMPTY_WITH_SUGGESTIONS_DISABLED = 10;
    TO_CUSTOM_WITH_VALID_SUGGESTIONS = 11;
    TO_CUSTOM_WITH_EMPTY_SUGGESTIONS = 12;
    TO_CUSTOM_WITH_SUGGESTIONS_DISABLED = 13;
    UNCHANGED = 14;
  }
}

// Used to define what type of item a Target would represent.
enum ItemType {
  DEFAULT_ITEMTYPE = 0;
  APP_ICON = 1;
  SHORTCUT = 2;
  WIDGET = 3;
  FOLDER_ICON = 4;
  DEEPSHORTCUT = 5;
  SEARCHBOX = 6;
  EDITTEXT = 7;
  NOTIFICATION = 8;
  TASK = 9;         // Each page of Recents UI (QuickStep)
  WEB_APP = 10;
  TASK_ICON = 11;
}

// Used to define what type of container a Target would represent.
enum ContainerType {
  DEFAULT_CONTAINERTYPE = 0;
  WORKSPACE = 1;
  HOTSEAT = 2;
  FOLDER = 3;
  ALLAPPS = 4;
  WIDGETS = 5;
  OVERVIEW = 6;   // Zoomed out workspace (without QuickStep)
  PREDICTION = 7;
  SEARCHRESULT = 8;
  DEEPSHORTCUTS = 9;
  PINITEM = 10;    // confirmation screen
  NAVBAR = 11;
  TASKSWITCHER = 12; // Recents UI Container (QuickStep)
  APP = 13; // Foreground activity is another app (QuickStep)
  TIP = 14; // Onboarding texts (QuickStep)
  OTHER_LAUNCHER_APP = 15;
}

// Used to define what type of control a Target would represent.
enum ControlType {
  DEFAULT_CONTROLTYPE = 0;
  ALL_APPS_BUTTON = 1;
  WIDGETS_BUTTON = 2;
  WALLPAPER_BUTTON = 3;
  SETTINGS_BUTTON = 4;
  REMOVE_TARGET = 5;
  UNINSTALL_TARGET = 6;
  APPINFO_TARGET = 7;
  RESIZE_HANDLE = 8;
  VERTICAL_SCROLL = 9;
  HOME_INTENT = 10; // Deprecated, use enum Command instead
  BACK_BUTTON = 11;
  QUICK_SCRUB_BUTTON = 12;
  CLEAR_ALL_BUTTON = 13;
  CANCEL_TARGET = 14;
  TASK_PREVIEW = 15;
  SPLIT_SCREEN_TARGET = 16;
  REMOTE_ACTION_SHORTCUT = 17;
  APP_USAGE_SETTINGS = 18;
  BACK_GESTURE = 19;
  UNDO = 20;
  DISMISS_PREDICTION = 21;
  HYBRID_HOTSEAT_ACCEPTED = 22;
  HYBRID_HOTSEAT_CANCELED = 23;
  OVERVIEW_ACTIONS_SHARE_BUTTON = 24;
  OVERVIEW_ACTIONS_SCREENSHOT_BUTTON = 25;
  OVERVIEW_ACTIONS_SELECT_BUTTON = 26;
  SELECT_MODE_CLOSE_BUTTON = 27;
  SELECT_MODE_ITEM = 28;
}

enum TipType {
  DEFAULT_NONE = 0;
  BOUNCE = 1;
  SWIPE_UP_TEXT = 2;
  QUICK_SCRUB_TEXT = 3;
  PREDICTION_TEXT = 4;
  DWB_TOAST = 5;
  HYBRID_HOTSEAT = 6;
}

// Used to define the action component of the LauncherEvent.
message Action {
  enum Type {
    TOUCH = 0;
    AUTOMATED = 1;
    COMMAND = 2;
    TIP = 3;
    SOFT_KEYBOARD = 4;
    // HARD_KEYBOARD, ASSIST
  }

  enum Touch {
    TAP = 0;
    LONGPRESS = 1;
    DRAGDROP = 2;
    SWIPE = 3;
    FLING = 4;
    PINCH = 5;
    SWIPE_NOOP = 6;
  }

  enum Direction {
    NONE = 0;
    UP = 1;
    DOWN = 2;
    LEFT = 3;
    RIGHT = 4;
    UPRIGHT = 5;
    UPLEFT = 6;
  }
  enum Command {
    HOME_INTENT = 0;
    BACK = 1;
    ENTRY = 2;          // Indicates entry to one of Launcher container type target
                        // not using the HOME_INTENT
    CANCEL = 3;         // Indicates that a confirmation screen was cancelled
    CONFIRM = 4;        // Indicates thata confirmation screen was accepted
    STOP = 5;           // Indicates onStop() was called (screen time out, power off)
    RECENTS_BUTTON = 6; // Indicates that Recents button was pressed
    RESUME = 7;         // Indicates onResume() was called
  }

  optional Type type = 1;
  optional Touch touch = 2;
  optional Direction dir = 3;
  optional Command command = 4;
  // Log if the action was performed on outside of the container
  optional bool is_outside = 5;
  optional bool is_state_change = 6;
}

//
// Context free grammar of typical user interaction:
//         Action (Touch) + Target
//         Action (Touch) + Target + Target
//
message LauncherEvent {
  required Action action = 1;
  // List of targets that touch actions can be operated on.
  repeated Target src_target = 2;
  repeated Target dest_target = 3;

  optional int64 action_duration_millis = 4;
  optional int64 elapsed_container_millis = 5;
  optional int64 elapsed_session_millis = 6;

  optional bool is_in_multi_window_mode = 7 [deprecated = true];
  optional bool is_in_landscape_mode = 8 [deprecated = true];

  optional LauncherEventExtension extension = 9;
}
