blob: 992ef8893b6215203055383181afa25dbc21592a [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;
View root = 2;
repeated StringEntry string = 3;
ResourceConfiguration resources = 4;
}
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
repeated View sub_view = 11;
}
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 = 8;
INT32 = 6;
INT64 = 7;
OBJECT = 9;
COLOR = 10;
GRAVITY = 11;
INT_ENUM = 12;
INT_FLAG = 13;
RESOURCE = 14;
DRAWABLE = 15;
ANIM = 16;
ANIMATOR = 17;
INTERPOLATOR = 18;
}
int32 namespace = 1;
int32 name = 2;
Type type = 3;
Resource source = 4;
repeated Resource resolution_stack = 5;
oneof union {
int32 int32_value = 6;
int64 int64_value = 7;
double double_value = 8;
float float_value = 9;
Resource resource_value = 10;
FlagValue flag_value = 11;
}
}
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 LayoutInspectorCommand {
enum Type {
UNKNOWN = 0;
START = 1;
STOP = 2;
GET_PROPERTIES = 3;
}
Type type = 1;
int64 view_id = 2;
}