1 // Copyright 2020 The Android Open Source Project 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 15 #pragma once 16 17 #include <stdint.h> 18 // #include "android/settings-agent.h" 19 // #include "android/skin/rect.h" 20 // #include "android/utils/compiler.h" 21 22 // Window agent's possible message types 23 typedef enum { 24 WINDOW_MESSAGE_GENERIC, 25 WINDOW_MESSAGE_INFO, 26 WINDOW_MESSAGE_WARNING, 27 WINDOW_MESSAGE_ERROR, 28 WINDOW_MESSAGE_OK, 29 } WindowMessageType; 30 31 static const int kWindowMessageTimeoutInfinite = -1; 32 33 typedef struct EmulatorWindow EmulatorWindow; 34 35 typedef void (*UiUpdateFunc)(void* data); 36 37 typedef struct QAndroidEmulatorWindowAgent { 38 // Get a pointer to the emulator window structure. 39 EmulatorWindow* (*getEmulatorWindow)(); 40 41 // Rotate the screen clockwise by 90 degrees. 42 // Returns true on success, false otherwise. 43 bool (*rotate90Clockwise)(void); 44 45 // Rotate to specific |rotation| 46 bool (*rotate)(int skinRotation); 47 48 // Returns the current rotation. 49 int (*getRotation)(void); 50 51 // Shows a message to the user. 52 void (*showMessage)(const char* message, 53 WindowMessageType type, 54 int timeoutMs); 55 56 // Shows a message to the user + custom dismiss op. 57 void (*showMessageWithDismissCallback)(const char* message, 58 WindowMessageType type, 59 const char* dismissText, 60 void* context, 61 void (*func)(void*), 62 int timeoutMs); 63 // Fold/Unfold device 64 bool (*fold)(bool is_fold); 65 // Query folded state 66 bool (*isFolded)(void); 67 bool (*getFoldedArea)(int* x, int* y, int* w, int* h); 68 69 // Update UI indicator which shows which foldable posture device is in 70 void (*updateFoldablePostureIndicator)(bool confirmFoldedArea); 71 72 // Set the UI display region 73 void (*setUIDisplayRegion)(int, int, int, int); 74 bool (*getMultiDisplay)(uint32_t, 75 int32_t*, 76 int32_t*, 77 uint32_t*, 78 uint32_t*, 79 uint32_t*, 80 uint32_t*, 81 bool*); 82 void (*setNoSkin)(void); 83 void (*restoreSkin)(void); 84 void (*updateUIMultiDisplayPage)(uint32_t); 85 bool (*getMonitorRect)(uint32_t*, uint32_t*); 86 // return true if extended controls window's visibility has changed. 87 bool (*startExtendedWindow)(void); 88 bool (*quitExtendedWindow)(void); 89 bool (*setUiTheme)(int settingsTheme); 90 void (*runOnUiThread)(UiUpdateFunc f, void* data, bool wait); 91 bool (*isRunningInUiThread)(void); 92 } QAndroidEmulatorWindowAgent; 93