/*
 * 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;
}

// 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;
}