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 = __anon09e69fa60102() 22 [](void) { 23 printf("window-agent-mock-impl: .getEmulatorWindow\n"); 24 return (EmulatorWindow*)nullptr; 25 }, 26 .rotate90Clockwise = __anon09e69fa60202() 27 [](void) { 28 printf("window-agent-mock-impl: .rotate90Clockwise\n"); 29 return true; 30 }, 31 .rotate = __anon09e69fa60302() 32 [](int rotation) { 33 printf("window-agent-mock-impl: .rotate90Clockwise\n"); 34 return true; 35 }, 36 .getRotation = __anon09e69fa60402() 37 [](void) { 38 printf("window-agent-mock-impl: .getRotation\n"); 39 return (int)SKIN_ROTATION_0; 40 }, 41 .showMessage = __anon09e69fa60502() 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*), __anon09e69fa60602() 53 int timeoutMs) { 54 printf("window-agent-mock-impl: " 55 ".showMessageWithDismissCallback %s\n", 56 message); 57 }, 58 .fold = __anon09e69fa60702() 59 [](bool is_fold) { 60 printf("window-agent-mock-impl: .fold %d\n", is_fold); 61 sIsFolded = is_fold; 62 return true; 63 }, __anon09e69fa60802() 64 .isFolded = [](void) -> bool { 65 printf("window-agent-mock-impl: .isFolded ? %d\n", sIsFolded); 66 return sIsFolded; 67 }, 68 .setUIDisplayRegion = __anon09e69fa60902() 69 [](int x_offset, int y_offset, int w, int h) { 70 printf("window-agent-mock-impl: .setUIDisplayRegion %d %d " 71 "%dx%d\n", 72 x_offset, y_offset, w, h); 73 }, 74 .getMultiDisplay = 0, __anon09e69fa60a02() 75 .setNoSkin = [](void) {}, __anon09e69fa60b02() 76 .restoreSkin = [](void) {}, 77 .updateUIMultiDisplayPage = __anon09e69fa60c02() 78 [](uint32_t id) { printf("updateMultiDisplayPage\n"); }, 79 .getMonitorRect = __anon09e69fa60d02() 80 [](uint32_t* w, uint32_t* h) { 81 if (w) 82 *w = 2500; 83 if (h) 84 *h = 1600; 85 return true; 86 }, 87 88 }; 89 90 extern "C" const QAndroidEmulatorWindowAgent* const 91 gMockQAndroidEmulatorWindowAgent = &sQAndroidEmulatorWindowAgent; 92 93 namespace android { 94 95 MockAndroidEmulatorWindowAgent* MockAndroidEmulatorWindowAgent::mock = nullptr; 96 97 } // namespace android 98