1 // Copyright 2018 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 #include "MockAndroidEmulatorWindowAgent.h" 16 17 #include "host-common/misc.h" 18 19 static bool sIsFolded = false; 20 static const QAndroidEmulatorWindowAgent sQAndroidEmulatorWindowAgent = { 21 .getEmulatorWindow = __anonf103c7710102() 22 [](void) { 23 printf("window-agent-mock-impl: .getEmulatorWindow\n"); 24 return (EmulatorWindow*)nullptr; 25 }, 26 .rotate90Clockwise = __anonf103c7710202() 27 [](void) { 28 printf("window-agent-mock-impl: .rotate90Clockwise\n"); 29 return true; 30 }, 31 .rotate = __anonf103c7710302() 32 [](int rotation) { 33 printf("window-agent-mock-impl: .rotate90Clockwise\n"); 34 return true; 35 }, 36 .getRotation = __anonf103c7710402() 37 [](void) { 38 printf("window-agent-mock-impl: .getRotation\n"); 39 return (int)SKIN_ROTATION_0; 40 }, 41 .showMessage = __anonf103c7710502() 42 [](const char* message, WindowMessageType type, int timeoutMs) { 43 return android::MockAndroidEmulatorWindowAgent::mock 44 ->showMessage(message, type, timeoutMs); 45 }, 46 47 .showMessageWithDismissCallback = 48 [](const char* message, 49 WindowMessageType type, 50 const char* dismissText, 51 void* context, 52 void (*func)(void*), __anonf103c7710602() 53 int timeoutMs) { 54 printf("window-agent-mock-impl: " 55 ".showMessageWithDismissCallback %s\n", 56 message); 57 }, 58 .fold = __anonf103c7710702() 59 [](bool is_fold) { 60 printf("window-agent-mock-impl: .fold %d\n", is_fold); 61 sIsFolded = is_fold; 62 return true; 63 }, __anonf103c7710802() 64 .isFolded = [](void) -> bool { 65 printf("window-agent-mock-impl: .isFolded ? %d\n", sIsFolded); 66 return sIsFolded; 67 }, 68 .getFoldedArea = 0, 69 .updateFoldablePostureIndicator = 0, 70 .setUIDisplayRegion = __anonf103c7710902() 71 [](int x_offset, int y_offset, int w, int h, bool ignoreOrientation) { 72 printf("window-agent-mock-impl: .setUIDisplayRegion %d %d " 73 "%dx%d\n", 74 x_offset, y_offset, w, h); 75 }, 76 .getMultiDisplay = 0, __anonf103c7710a02() 77 .setNoSkin = [](void) {}, __anonf103c7710b02() 78 .restoreSkin = [](void) {}, 79 .updateUIMultiDisplayPage = __anonf103c7710c02() 80 [](uint32_t id) { printf("updateMultiDisplayPage\n"); }, 81 .getMonitorRect = __anonf103c7710d02() 82 [](uint32_t* w, uint32_t* h) { 83 if (w) 84 *w = 2500; 85 if (h) 86 *h = 1600; 87 return true; 88 }, 89 .startExtendedWindow = 0, 90 .quitExtendedWindow = 0, 91 .setUiTheme = 0, 92 .runOnUiThread = 0, 93 .isRunningInUiThread = 0, 94 }; 95 96 extern "C" const QAndroidEmulatorWindowAgent* const 97 gMockQAndroidEmulatorWindowAgent = &sQAndroidEmulatorWindowAgent; 98 99 namespace android { 100 101 MockAndroidEmulatorWindowAgent* MockAndroidEmulatorWindowAgent::mock = nullptr; 102 103 } // namespace android 104