1// Copyright 2020 Google LLC 2// 3// Licensed under the Apache License, Version 2.0 (the "License"); 4// you may not use this file except in compliance with the License. 5// You may obtain a copy of the License at 6// 7// http://www.apache.org/licenses/LICENSE-2.0 8// 9// Unless required by applicable law or agreed to in writing, software 10// distributed under the License is distributed on an "AS IS" BASIS, 11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12// See the License for the specific language governing permissions and 13// limitations under the License. 14 15syntax = "proto3"; 16 17option java_multiple_files = true; 18option java_package = "com.android.emulator.control"; 19option objc_class_prefix = "AEC"; 20 21package android.emulation.control; 22import "google/protobuf/empty.proto"; 23 24service UiController { 25 // PaneEntry specifies which pane will be selected when 26 // the extended control is shown. If the extended is visible already, 27 // this method will set visibilityChangedto to false. 28 rpc showExtendedControls(PaneEntry) returns (ExtendedControlsStatus) {} 29 // this method has no effect if the extended controls are hidden. 30 // In that case, visibilityChanged will be set to false; 31 rpc closeExtendedControls(google.protobuf.Empty) 32 returns (ExtendedControlsStatus) {} 33 rpc setUiTheme(ThemingStyle) returns (google.protobuf.Empty) {} 34 35 // Returns the user configuration of the running emulator. The user 36 // configuration contains information about the user interface. 37 rpc getUserConfig(google.protobuf.Empty) returns (UserConfig) {} 38} 39 40message UserConfigEntry { 41 string key = 1; 42 string value = 2; 43} 44 45// The user configuration of the running emulator as 46// key value pairs. This contains the data you normally find 47// in emulator-user.ini 48message UserConfig { 49 repeated UserConfigEntry entries = 1; 50} 51 52message ThemingStyle { 53 enum Style { 54 LIGHT = 0; 55 DARK = 1; 56 CONTRAST = 2; 57 } 58 Style style = 1; 59} 60 61message ExtendedControlsStatus { 62 bool visibilityChanged = 1; 63} 64 65// The pixel coordinates are resolution independent, meaning the coordinates 66// are independent from the pixel grid, resulting in a graphical user 67// interface that is displayed at a consistent location, regardless of the 68// resolution of the screen. 69// 70// For technical details: https://doc.qt.io/qt-5/highdpi.html 71// 72// Some things to note: 73// 74// - You cannot move a window offscreen. 75// - There is a padding of around 10px around the frame. 76// 77// This means that moving to (0, 0) or (10, 10) will have the same result. 78// This means that anchoring might not exactly behave as requested. 79message WindowPosition { 80 // Anchor that is used to determine horizontal window placement. 81 enum HorizontalAnchor { 82 LEFT = 0; // The x coordinate will be treated as the left edge of the 83 // window. 84 HCENTER = 1; // The x coordinate will be treated as the middle between 85 // the left and right edges of the window. 86 RIGHT = 2; // The x coordinate will be treated as the right edge of 87 // the window. 88 } 89 90 // Anchor that is used to determine vertical window placement. 91 enum VerticalAnchor { 92 TOP = 0; // The y coordinate will be treated as the top edge of the 93 // window. 94 VCENTER = 1; // The y coordinate will be treated as the middle between 95 // the top and bottom edges of the window. 96 BOTTOM = 3; // The y coordinate will be treated as the bottom edge of 97 // the window. 98 } 99 100 // Corresponds to the x and y coordinate of the window geometry. The window 101 // geometry includes the window frame. 102 // See: https://doc.qt.io/qt-5/application-windows.html#window-geometry for 103 // details and pecularities on linux. 104 uint32 x = 1; 105 uint32 y = 2; 106 107 HorizontalAnchor horizontalAnchor = 3; 108 VerticalAnchor verticalAnchor = 4; 109} 110 111message PaneEntry { 112 enum PaneIndex { 113 // When specified as KEEP_CURRENT, extended controls will display the 114 // current pane. 115 // If it is the first time for extended controls to be shown, LOCATION 116 // will be used. 117 KEEP_CURRENT = 0; 118 // Referenced from 119 // external/qemu/android/android-emu/android/skin/qt/extended-window-styles.h 120 LOCATION = 1; 121 MULTIDISPLAY = 2; 122 CELLULAR = 3; 123 BATTERY = 4; 124 CAMERA = 5; 125 TELEPHONE = 6; 126 DPAD = 7; 127 TV_REMOTE = 8; 128 ROTARY = 9; 129 MICROPHONE = 10; 130 FINGER = 11; 131 VIRT_SENSORS = 12; 132 SNAPSHOT = 13; 133 BUGREPORT = 14; 134 RECORD = 15; 135 GOOGLE_PLAY = 16; 136 SETTINGS = 17; 137 HELP = 18; 138 CAR = 19; 139 CAR_ROTARY = 20; 140 SENSOR_REPLAY = 21; 141 }; 142 PaneIndex index = 1; 143 144 // Set the window position to the specified coordinates if no coordinates are 145 // present in the AVD, otherwise this value will be igonred. 146 WindowPosition position = 2; 147} 148