blob: 53ca2c146a19560ded4305f6dd76ba6bbdaa4e00 [file] [log] [blame]
/*
* Copyright (C) 2019 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 layoutinspector;
option java_package = "com.android.tools.layoutinspector.proto";
option java_outer_classname = "LayoutInspectorProto";
message LayoutInspectorEvent {
oneof union {
string error_message = 1;
ComponentTreeEvent tree = 2;
PropertyEvent properties = 3;
}
}
message ComponentTreeEvent {
int32 payload_id = 1;
enum PayloadType {
UNKNOWN = 0;
SKP = 1;
PNG_SKP_TOO_LARGE = 2;
PNG_AS_REQUESTED = 3;
}
PayloadType payload_type = 2;
View root = 3;
repeated StringEntry string = 4;
ResourceConfiguration resources = 5;
repeated int64 all_window_ids = 6;
}
message PropertyEvent {
int64 view_id = 1;
Resource layout = 2;
repeated StringEntry string = 3;
repeated Property property = 4;
}
message ResourceConfiguration {
int32 api_level = 1;
int32 api_code_name = 2;
int32 app_package_name = 3;
Resource theme = 4;
Configuration configuration = 5;
}
message Configuration {
float font_scale = 1;
int32 country_code = 2;
int32 network_code = 3;
Locale locale = 4;
int32 screen_layout = 5;
int32 color_mode = 6;
int32 touch_screen = 7;
int32 keyboard = 8;
int32 keyboard_hidden = 9;
int32 hard_keyboard_hidden = 10;
int32 navigation = 11;
int32 navigation_hidden = 12;
int32 ui_mode = 13;
int32 smallest_screen_width = 14;
int32 density = 15;
int32 orientation = 16;
int32 screen_width = 17;
int32 screen_height = 18;
}
message Locale {
int32 language = 1;
int32 country = 2;
int32 variant = 3;
int32 script = 4;
}
message View {
int64 draw_id = 1; // the uniqueDrawingId
Resource view_id = 2; // the id attribute on a View
Resource layout = 3; // the layout where the view was found
int32 x = 4;
int32 y = 5;
int32 width = 6;
int32 height = 7;
int32 class_name = 8; // the simple class name of the view e.g. LinearLayout
int32 package_name = 9; // the package part of the class name e.g. android.view
int32 text_value = 10; // the value of the text property if it exists
int32 layout_flags = 11;
int32 compose_filename = 12; // name of file where invocation is found
int32 compose_invocation = 13; // name of method of lambda invocation
int32 compose_package = 14; // package part of lambda invocation
int32 compose_line_number = 15; // line number of lambda invocation
repeated View sub_view = 16;
}
message Property {
// Note: these constants must be kept in sync with the enum class: ValueType
enum Type {
STRING = 0;
BOOLEAN = 1;
BYTE = 2;
CHAR = 3;
DOUBLE = 4;
FLOAT = 5;
INT16 = 6;
INT32 = 7;
INT64 = 8;
OBJECT = 9;
COLOR = 10;
GRAVITY = 11;
INT_ENUM = 12;
INT_FLAG = 13;
RESOURCE = 14;
DRAWABLE = 15;
ANIM = 16;
ANIMATOR = 17;
INTERPOLATOR = 18;
DIMENSION = 19;
DIMENSION_FLOAT = 20;
}
int32 namespace = 1;
int32 name = 2;
Type type = 3;
Resource source = 4;
repeated Resource resolution_stack = 5;
bool is_layout = 6;
oneof union {
int32 int32_value = 7;
int64 int64_value = 8;
double double_value = 9;
float float_value = 10;
Resource resource_value = 11;
FlagValue flag_value = 12;
}
}
message FlagValue {
repeated int32 flag = 1;
}
message StringEntry {
int32 id = 1;
string str = 2;
}
message Resource {
int32 type = 1;
int32 namespace = 2;
int32 name = 3;
}
message EditProperty {
uint32 attribute_id = 1;
int32 int32_value = 2;
}
message LayoutInspectorCommand {
enum Type {
UNKNOWN = 0;
START = 1;
STOP = 2;
GET_PROPERTIES = 3;
EDIT_PROPERTY = 4;
USE_SCREENSHOT_MODE = 5;
}
Type type = 1;
int64 view_id = 2;
bool screenshot_mode = 3;
bool compose_mode = 4;
EditProperty edit_property = 17;
}