/*
 * Copyright (C) 2022 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 = "proto3";

package com.android.server.wm;

option java_package = "com.android.server.wm";
option java_outer_classname = "WindowManagerProtos";

message TaskSnapshotProto {
  int32 orientation = 1;
  int32 inset_left = 2;
  int32 inset_top = 3;
  int32 inset_right = 4;
  int32 inset_bottom = 5;
  bool is_real_snapshot = 6;
  int32 windowing_mode = 7;
  int32 system_ui_visibility = 8 [deprecated=true];
  bool is_translucent = 9;
  string top_activity_component = 10;
  // deprecated because original width and height are stored now instead of the scale.
  float legacy_scale = 11 [deprecated=true];
  int64 id = 12;
  int32 rotation = 13;
  // The task width when the snapshot was taken
  int32 task_width = 14;
  // The task height when the snapshot was taken
  int32 task_height = 15;
  int32 appearance = 16;
  int32 letterbox_inset_left = 17;
  int32 letterbox_inset_top = 18;
  int32 letterbox_inset_right = 19;
  int32 letterbox_inset_bottom = 20;
  int32 ui_mode = 21;
}

// Persistent letterboxing configurations
message LetterboxProto {

  // Possible values for the letterbox horizontal reachability
  enum LetterboxHorizontalReachability {
    LETTERBOX_HORIZONTAL_REACHABILITY_POSITION_LEFT = 0;
    LETTERBOX_HORIZONTAL_REACHABILITY_POSITION_CENTER = 1;
    LETTERBOX_HORIZONTAL_REACHABILITY_POSITION_RIGHT = 2;
  }

  // Possible values for the letterbox vertical reachability
  enum LetterboxVerticalReachability {
    LETTERBOX_VERTICAL_REACHABILITY_POSITION_TOP = 0;
    LETTERBOX_VERTICAL_REACHABILITY_POSITION_CENTER = 1;
    LETTERBOX_VERTICAL_REACHABILITY_POSITION_BOTTOM = 2;
  }

  // Represents the current horizontal position for the letterboxed activity
  LetterboxHorizontalReachability letterbox_position_for_horizontal_reachability = 1;
  // Represents the current vertical position for the letterboxed activity
  LetterboxVerticalReachability letterbox_position_for_vertical_reachability = 2;
  // Represents the current horizontal position for the letterboxed activity in book mode
  LetterboxHorizontalReachability letterbox_position_for_book_mode_reachability = 3;
  // Represents the current vertical position for the letterboxed activity in tabletop mode
  LetterboxVerticalReachability letterbox_position_for_tabletop_mode_reachability = 4;
}