Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qohoswindowproxydatafactory.cpp
Go to the documentation of this file.
1// Copyright (C) 2025 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#include <render/qohoswindowproxydatafactory.h>
5
6#include <QtCore/qscopeguard.h>
7#include <cstdint>
8#include <qarkui/qxcomponentregistry.h>
9#include <qohosqabilityinstancesmanager.h>
10#include <qohosutils.h>
11#include <render/qohoswindowproxy.h>
12#include <render/qxcomponent.h>
13
14QT_BEGIN_NAMESPACE
15
16namespace {
17
19{
20 static std::uint64_t uniqueIdSuffixCounter = 0;
21 auto result = QStringLiteral("QtWindow_%1_%2")
22 .arg(internalWindowId.toString())
23 .arg(QString::number(uniqueIdSuffixCounter));
24 ++uniqueIdSuffixCounter;
25 return result.toStdString();
26}
27
34
43
55
66
68 QtOhos::JsState &jsState, const std::string &qAbilityInstanceId)
69{
70 auto qAbilityPeer = QtOhos::QAbilityInstancesManager::instance(jsState).tryGetQAbilityPeerByInstanceId(qAbilityInstanceId);
71 if (!qAbilityPeer) {
72 qOhosReportFatalErrorAndAbort(
73 "Failed to find QAbilityPeer for qAbilityInstanceId: %s", qAbilityInstanceId.c_str());
74 }
75 return qAbilityPeer;
76}
77
79{
81 auto nativeNodeXComponentOpt = registry.tryTakeNodeByXComponentId(xComponentId);
82 if (!nativeNodeXComponentOpt.has_value()) {
83 qOhosReportFatalErrorAndAbort(
84 "Failed to fetch native node xcomponent with id: %s",
85 xComponentId.stringId().c_str());
86 }
87 return nativeNodeXComponentOpt.value();
88}
89
91{
92 return jsState.eval<QNapi::Object>("LocalStorage.makeNewLocalStorage()");
93}
94
95QNapi::Object makeRectObject(Napi::Env env, const QRect &rect)
96{
97 return QNapi::makeObject(
98 env,
99 {
100 {"left", rect.x()},
101 {"top", rect.top()},
102 {"width", rect.width()},
103 {"height", rect.height()},
104 });
105}
106
108 QNapi::Object windowStageOrWindowObject,
109 const std::string &windowName, const SubWindowOptions &subWindowOptions)
110{
111 auto subWindowOptionsObject =
112 QNapi::makeObject(
113 windowStageOrWindowObject.Env(),
114 {
115 {"title", subWindowOptions.windowTitle},
116 {"decorEnabled", subWindowOptions.decorEnabled},
117 {"isModal", subWindowOptions.isModal},
118 {
119 "windowRect", makeRectObject(windowStageOrWindowObject.Env(), subWindowOptions.windowRect)
120 }
121 });
122 if (subWindowOptions.maximizeSupported)
123 subWindowOptionsObject.set("maximizeSupported", true);
124
125 return windowStageOrWindowObject.evalToPromiseOrRejectOnThrow(
126 "createSubWindowWithOptions(*)",
127 {windowName, subWindowOptionsObject});
128}
129
130// Optionless sub window creation, used on phones where the SessionManager-only
131// createSubWindowWithOptions() is unavailable. WindowStage.createSubWindow() is @crossplatform.
133 QNapi::Object windowStageOrWindowObject, const std::string &windowName)
134{
135 return windowStageOrWindowObject.evalToPromiseOrRejectOnThrow(
136 "createSubWindow(*)", {windowName});
137}
138
139// createSubWindow() exists only on the WindowStage, not on a Window.
141 const std::shared_ptr<QtOhos::QAbilityPeer> &qAbilityPeer, const std::string &windowName)
142{
143 auto optQUiAbilityPeer = QtOhos::QUiAbilityPeer::tryCastFromQAbilityPeerOrNull(qAbilityPeer);
144 if (!optQUiAbilityPeer) {
145 qOhosReportFatalErrorAndAbort(
146 "%s sub window creation requires an ability with a windowStage. Aborting...",
147 Q_FUNC_INFO);
148 }
149 return createSubWindow(optQUiAbilityPeer->windowStage(), windowName);
150}
151
152// Query SystemCapability.Window.SessionManager (needed by createSubWindowWithOptions())
153// directly rather than inferring it from the device type.
155{
156 try {
157 return jsState.eval<QNapi::Boolean>(
158 "Global.canIUse(*)",
159 {std::string("SystemCapability.Window.SessionManager")}).Value();
160 } catch (const Napi::Error &error) {
161 qOhosPrintfWarning(
162 "canIUse('SystemCapability.Window.SessionManager') query failed (%s); assuming the "
163 "capability is unavailable and using createSubWindow()",
164 error.what());
165 return false;
166 }
167}
168
169std::function<void(const QtOhos::CallbackInfo &)>
171{
172 auto sharedContext = QtOhos::moveToSharedPtr(std::move(subWindowOnAppearCbCtx));
173 return [sharedContext](const QtOhos::CallbackInfo &cbInfo) mutable {
174 if (!sharedContext)
175 return;
176
177 auto xComponent = takeNodeXComponentFromRegistryOrFail(sharedContext->xComponentId);
178
179 sharedContext->resultConsumer(
180 cbInfo.jsState(),
181 QOhosWindowProxyData {
182 .qAbilityPeer = sharedContext->qAbilityPeer,
183 .jsWindow = std::move(sharedContext->windowObject),
184 .windowProxyType = sharedContext->windowProxyType,
185 .subWindowMaximizeSupported = sharedContext->subWindowMaximizeSupported,
186 .nodeXComponent = std::make_shared<QXComponentNode>(xComponent),
187 .jsKeepAliveData = QtOhos::moveToSharedPtr(std::move(sharedContext->localStorageObj)),
188 .owningQWindowRef = sharedContext->owningQWindowRef,
189 });
190
191 sharedContext.reset();
192 };
193}
194
195QNapi::Promise loadWindowContents(QNapi::Object window, QNapi::Object localStorage, const std::string &contentPagePath)
196{
197 return window.evalToPromiseOrRejectOnThrow("loadContent(*)", {contentPagePath, localStorage});
198}
199
201 QtOhos::JsState &jsState, LocalStorageForWindowCreateInfo &&createInfo)
202{
203 auto *env = jsState.env();
204
205 auto localStorage = makeLocalStorage(jsState);
206 auto subWindowNativeNodeCreateInfo = QNapi::makeObject(
207 env,
208 {
209 {"xComponentId", createInfo.xComponentId.toNapiValue(env)},
210 {
211 "onDisAppear",
212 [xComponentId = createInfo.xComponentId.stringId()]() {
213 qOhosPrintfDebug(
214 "WindowNativeNodeCreateInfo.onDisAppear() called from JS for xComponentId='%s'",
215 xComponentId.c_str());
216 }
217 },
218 {
219 "onAppear",
220 makeSubWindowOnAppearCallbackHandler(SubWindowOnAppearContext {
221 .xComponentId = createInfo.xComponentId,
222 .localStorageObj = Napi::Persistent(localStorage),
223 .windowObject = Napi::Persistent(createInfo.windowObject),
224 .resultConsumer = std::move(createInfo.resultConsumer),
225 .qAbilityPeer = std::move(createInfo.qAbilityPeer),
226 .windowProxyType = createInfo.windowProxyType,
227 .subWindowMaximizeSupported = createInfo.subWindowMaximizeSupported,
228 .owningQWindowRef = createInfo.owningQWindowRef,
229 }),
230 }
231 });
232
233 localStorage.eval("setOrCreate(*)", {"createInfo", subWindowNativeNodeCreateInfo});
234 return localStorage;
235}
236
238 QtOhos::JsState &, const QNapi::Object &windowObject,
240{
241 struct LoadWindowContentsArgs
242 {
243 QNapi::Reference<QNapi::Object> window;
244 QNapi::Reference<QNapi::Object> localStorage;
245 std::string contentPagePath;
246 };
247
248 if (!context.disableWindowFocusableBeforeLoadContentHack)
249 return loadWindowContents(windowObject, context.localStorage, context.contentPagePath);
250
251 auto loadWindowContentsArgs = LoadWindowContentsArgs {
252 .window = Napi::Persistent(windowObject),
253 .localStorage = Napi::Persistent(context.localStorage),
254 .contentPagePath = context.contentPagePath,
255 };
256
257 return windowObject.evalToPromiseOrRejectOnThrow("setWindowFocusable(*)", {false})
258 .onThen([loadWindowContentsArgs = std::move(loadWindowContentsArgs)]() {
259 return loadWindowContents(
260 loadWindowContentsArgs.window.Value(),
261 loadWindowContentsArgs.localStorage.Value(),
262 loadWindowContentsArgs.contentPagePath);
263 });
264}
265
266}
267
269 QtOhos::JsState &jsState,
270 const QOhosWindowProxyMainWindowCreateInfo &createInfo,
271 QOhosConsumer<QtOhos::JsState &, QOhosWindowProxyData> resultConsumer)
272{
273 auto &qAbilityInstancesManager = QtOhos::QAbilityInstancesManager::instance(jsState);
274 auto optDefaultQAbility = jsState.defaultQAbility();
275 auto optForegroundQAbility = qAbilityInstancesManager.tryGetForegroundQAbility();
276 auto optBaseQAbility =
277 ((optDefaultQAbility && qAbilityInstancesManager.isQAbilityInForeground(*optDefaultQAbility)) || !optForegroundQAbility)
278 ? optDefaultQAbility
279 : optForegroundQAbility;
280 if (!optBaseQAbility)
281 qOhosReportFatalErrorAndAbort("%s: can't create window without an Ability instance to start it from", Q_FUNC_INFO);
282
283 auto abilityStartupOptions =
284 QNapi::makeObject(
285 jsState.env(),
286 {
287 {"windowLeft", createInfo.frameGeometry.x()},
288 {"windowTop", createInfo.frameGeometry.y()},
289 {"windowWidth", createInfo.frameGeometry.width()},
290 {"windowHeight", createInfo.frameGeometry.height()},
291 });
292
293 if (createInfo.fullscreen) {
294 auto fullscreenWindowMode = jsState.eval<QNapi::Number>(
295 "@ohos.app.ability.AbilityConstant.WindowMode.WINDOW_MODE_FULLSCREEN");
296 abilityStartupOptions.set("windowMode", fullscreenWindowMode);
297 }
298
299 qAbilityInstancesManager.startNewInstance(
300 optBaseQAbility.value(), createInfo.qWindowRef,
301 abilityStartupOptions,
302 [qWindowRef = createInfo.qWindowRef,
303 windowId = createInfo.windowId,
304 resultConsumer = std::move(resultConsumer)](QtOhos::JsState &jsState, std::shared_ptr<QtOhos::QAbilityPeer> qAbilityPeer) {
305 auto createInfo = QOhosWindowProxyExistingMainWindowCreateInfo {
306 .qWindowRef = qWindowRef,
307 .qAbilityInstanceId = qAbilityPeer->instanceId(),
308 .windowId = windowId,
309 };
310
311 makeWindowProxyDataForExistingMainWindowInJsThread(
312 jsState, createInfo, std::move(resultConsumer));
313 });
314}
315
317 QtOhos::JsState &jsState,
319 QOhosConsumer<QtOhos::JsState &, QOhosWindowProxyData> resultConsumer)
320{
322 getQAbilityPeerByInstanceIdOrFail(jsState, createInfo.qAbilityInstanceId));
323 if (!optQUiAbilityPeer) {
324 qOhosReportFatalErrorAndAbort(
325 "%s Attempting to make window proxy for main window for ability without windowStage. This is most likely a programming error. Aborting...",
326 Q_FUNC_INFO);
327 }
328 optQUiAbilityPeer->setQWindow(jsState.env(), createInfo.qWindowRef);
329
330 auto window = optQUiAbilityPeer->window();
331 auto nativeNodeXComponentId = QXComponentId::createForNativeNodeMainWindow(createInfo.qAbilityInstanceId);
332 auto nodeXComponent = takeNodeXComponentFromRegistryOrFail(nativeNodeXComponentId);
333
334 resultConsumer(
335 jsState,
336 QOhosWindowProxyData {
337 .qAbilityPeer = optQUiAbilityPeer,
338 .jsWindow = Napi::Persistent(window),
339 .windowProxyType = WindowProxyType::MainWindow,
340 .nodeXComponent = std::make_shared<QXComponentNode>(nodeXComponent),
341 .jsKeepAliveData = nullptr,
342 .owningQWindowRef = createInfo.qWindowRef,
343 });
344}
345
347 QtOhos::JsState &jsState,
348 const QOhosWindowProxySubWindowCreateInfo &createInfo,
349 QOhosConsumer<QtOhos::JsState &, QOhosWindowProxyData> resultConsumer)
350{
351 auto qAbilityPeer = getQAbilityPeerByInstanceIdOrFail(jsState, createInfo.qAbilityInstanceId);
352 auto optQUiAbilityPeer = QtOhos::QUiAbilityPeer::tryCastFromQAbilityPeerOrNull(qAbilityPeer);
353 if (!optQUiAbilityPeer) {
354 qOhosReportFatalErrorAndAbort(
355 "%s Attempting to make window proxy for sub window for ability without windowStage. This is most likely a programming error. Aborting...",
356 Q_FUNC_INFO);
357 }
358 makeWindowProxyDataForSubWindowInJsThread(
359 jsState, optQUiAbilityPeer->windowStage(), createInfo, std::move(resultConsumer));
360}
361
363 QtOhos::JsState &jsState,
364 QNapi::Object windowStageOrWindowObject,
365 const QOhosWindowProxySubWindowCreateInfo &createInfo,
366 QOhosConsumer<QtOhos::JsState &, QOhosWindowProxyData> resultConsumer)
367{
368 auto xComponentId = QXComponentId::createForNativeNodeSubWindow(createInfo.windowId);
369 struct Context
370 {
371 bool disableWindowFocusableBeforeLoadContentHack;
372 QXComponentId xComponentId;
373 std::shared_ptr<QtOhos::QAbilityPeer> qAbilityPeer;
374 QtOhos::QObjectThreadSafeRef owningQWindowRef;
375 bool createdWithMaximizeSupport;
376 };
377
378 auto qAbilityPeer = getQAbilityPeerByInstanceIdOrFail(jsState, createInfo.qAbilityInstanceId);
379
380 const auto windowName = makeOhosUniqueSystemWindowName(createInfo.windowId);
381
382 auto context = QtOhos::moveToSharedPtr(Context {
383 .disableWindowFocusableBeforeLoadContentHack = createInfo.disableWindowFocusableBeforeLoadContentHack,
384 .xComponentId = xComponentId,
385 .qAbilityPeer = qAbilityPeer,
386 .owningQWindowRef = createInfo.window,
387 .createdWithMaximizeSupport = createInfo.maximizeSupported,
388 });
389
390 // Prefer createSubWindowWithOptions() when the capability is present, but fall back to the
391 // @crossplatform createSubWindow() when it is absent or fails (its dropped options are
392 // applied separately after creation anyway, except maximizeSupported) rather than aborting
393 // the application.
394 auto subWindowCreationPromise = [&]() -> QNapi::Promise {
395 if (!isWindowSessionManagerAvailable(jsState)) {
396 context->createdWithMaximizeSupport = false;
397 return createSubWindowViaWindowStage(qAbilityPeer, windowName);
398 }
399
400 return createSubWindowWithOptions(
401 windowStageOrWindowObject,
402 windowName,
403 SubWindowOptions {
404 .windowTitle = createInfo.windowTitle,
405 .decorEnabled = createInfo.decorEnabled,
406 .isModal = createInfo.modal,
407 .maximizeSupported = createInfo.maximizeSupported,
408 .windowRect = createInfo.windowRect,
409 })
410 .onCatch([context, qAbilityPeer, windowName](const QtOhos::CallbackInfo &) -> QNapi::Promise {
411 // Unsupported in some window contexts even when the capability is advertised.
412 qOhosPrintfWarning(
413 "createSubWindowWithOptions() is unavailable in this context; "
414 "falling back to createSubWindow()");
415 context->createdWithMaximizeSupport = false;
416 return createSubWindowViaWindowStage(qAbilityPeer, windowName);
417 });
418 }();
419
420 subWindowCreationPromise
421 .onThen([resultConsumer = std::move(resultConsumer), context](const QtOhos::CallbackInfo &cbInfo) mutable {
422 auto windowObject = cbInfo.getFirstArg<QNapi::Object>(Q_FUNC_INFO);
423
424 auto localStorage = makeLocalStorageForWindow(
425 cbInfo.jsState(),
426 LocalStorageForWindowCreateInfo {
427 .xComponentId = context->xComponentId,
428 .windowObject = windowObject,
429 .resultConsumer = std::move(resultConsumer),
430 .qAbilityPeer = context->qAbilityPeer,
431 .windowProxyType = WindowProxyType::SubWindow,
432 .subWindowMaximizeSupported = context->createdWithMaximizeSupport,
433 .owningQWindowRef = context->owningQWindowRef,
434 });
435
436 return onWindowCreatedLoadWindowContents(
437 cbInfo.jsState(), windowObject,
438 OnWindowCreatedLoadWindowContentsContext {
439 .disableWindowFocusableBeforeLoadContentHack = context->disableWindowFocusableBeforeLoadContentHack,
440 .contentPagePath = "pages/SubWindowNativeNode",
441 .localStorage = localStorage,
442 });
443 })
444 .onCatch([windowId = createInfo.windowId](const QtOhos::CallbackInfo &cbInfo) {
445 QtOhos::logJsCallbackError(cbInfo, "sub window creation failed");
446 qOhosReportFatalErrorAndAbort(
447 "Failed to create subwindow for windowId='%s'",
448 windowId.toStdString().c_str());
449 });
450}
451
453 QtOhos::JsState &jsState, const QOhosWindowProxyFloatWindowCreateInfo &createInfo,
454 QOhosConsumer<QtOhos::JsState &, QOhosWindowProxyData> resultConsumer)
455{
456 auto xComponentId = QXComponentId::createForNativeNodeFloatWindow(createInfo.internalWindowId);
457 auto qAbilityPeer = QtOhos::QAbilityInstancesManager::instance(jsState).defaultQAbilityPeer();
458
459 if (qAbilityPeer->qAbility().IsEmpty())
460 qOhosReportFatalErrorAndAbort("%s: can't create window without the default Ability instance", Q_FUNC_INFO);
461
462 auto configurationObject = QNapi::makeObject(
463 jsState.env(),
464 {
465 // NOTE - The parameter name is misleading, what it refers to actually is (system) window id
466 {"name", makeOhosUniqueSystemWindowName(createInfo.internalWindowId)},
467 {"windowType", jsState.eval<QNapi::Number>("@ohos.window.WindowType.TYPE_FLOAT")},
468 {"ctx", qAbilityPeer->qAbility().get<QNapi::Object>("context")},
469 });
470
471 struct Context
472 {
473 QXComponentId xComponentId;
474 std::shared_ptr<QtOhos::QAbilityPeer> qAbilityPeer;
475 QtOhos::QObjectThreadSafeRef owningQWindowRef;
476 };
477
478 auto context = Context {
479 .xComponentId = xComponentId,
480 .qAbilityPeer = qAbilityPeer,
481 .owningQWindowRef = createInfo.qWindowRef,
482 };
483
484 jsState
485 .evalToPromiseOrRejectOnThrow("@ohos.window.createWindow(*)", {configurationObject})
486 .onThen([resultConsumer = std::move(resultConsumer), context = std::move(context)](const QtOhos::CallbackInfo &cbInfo) mutable {
487 auto windowObject = cbInfo.getFirstArg<QNapi::Object>(Q_FUNC_INFO);
488
489 auto localStorage = makeLocalStorageForWindow(
490 cbInfo.jsState(),
491 LocalStorageForWindowCreateInfo {
492 .xComponentId = context.xComponentId,
493 .windowObject = windowObject,
494 .resultConsumer = std::move(resultConsumer),
495 .qAbilityPeer = context.qAbilityPeer,
496 .windowProxyType = WindowProxyType::FloatWindow,
497 .owningQWindowRef = context.owningQWindowRef,
498 });
499
500 return onWindowCreatedLoadWindowContents(
501 cbInfo.jsState(), windowObject,
502 OnWindowCreatedLoadWindowContentsContext {
503 .disableWindowFocusableBeforeLoadContentHack = false,
504 .contentPagePath = "pages/FloatWindowNativeNode",
505 .localStorage = localStorage,
506 });
507 })
508 .onCatch([internalWindowId = createInfo.internalWindowId](const QtOhos::CallbackInfo &cbInfo) {
509 QtOhos::logJsCallbackError(cbInfo, "Failed to create TYPE_FLOAT window");
510 qOhosReportFatalErrorAndAbort(
511 "Failed to create TYPE_FLOAT window for windowId='%s'",
512 internalWindowId.toStdString().c_str());
513 });
514}
515
516
517QT_END_NAMESPACE
std::optional< QXComponentNode > tryTakeNodeByXComponentId(const QXComponentId &id)
static QXComponentRegistry & instance()
static QXComponentId createForNativeNodeMainWindow(const std::string &qAbilityInstanceId)
std::string stringId() const
JsState & jsState() const
static std::shared_ptr< QUiAbilityPeer > tryCastFromQAbilityPeerOrNull(std::shared_ptr< QAbilityPeer > qAbilityPeer)
std::shared_ptr< QtOhos::QAbilityPeer > getQAbilityPeerByInstanceIdOrFail(QtOhos::JsState &jsState, const std::string &qAbilityInstanceId)
QNapi::Object makeRectObject(Napi::Env env, const QRect &rect)
bool isWindowSessionManagerAvailable(QtOhos::JsState &jsState)
QNapi::Promise createSubWindowWithOptions(QNapi::Object windowStageOrWindowObject, const std::string &windowName, const SubWindowOptions &subWindowOptions)
QXComponentNode takeNodeXComponentFromRegistryOrFail(const QXComponentId &xComponentId)
std::function< void(const QtOhos::CallbackInfo &)> makeSubWindowOnAppearCallbackHandler(SubWindowOnAppearContext subWindowOnAppearCbCtx)
QNapi::Object makeLocalStorage(QtOhos::JsState &jsState)
QNapi::Promise createSubWindowViaWindowStage(const std::shared_ptr< QtOhos::QAbilityPeer > &qAbilityPeer, const std::string &windowName)
QNapi::Promise onWindowCreatedLoadWindowContents(QtOhos::JsState &, const QNapi::Object &windowObject, OnWindowCreatedLoadWindowContentsContext context)
QNapi::Promise loadWindowContents(QNapi::Object window, QNapi::Object localStorage, const std::string &contentPagePath)
std::string makeOhosUniqueSystemWindowName(QtOhos::InternalWindowId internalWindowId)
QNapi::Promise createSubWindow(QNapi::Object windowStageOrWindowObject, const std::string &windowName)
QNapi::Object makeLocalStorageForWindow(QtOhos::JsState &jsState, LocalStorageForWindowCreateInfo &&createInfo)
void makeWindowProxyDataForFloatWindowInJsThread(QtOhos::JsState &jsState, const QOhosWindowProxyFloatWindowCreateInfo &createInfo, QOhosConsumer< QtOhos::JsState &, QOhosWindowProxyData > resultConsumer)
void makeWindowProxyDataForSubWindowInJsThread(QtOhos::JsState &jsState, QNapi::Object windowStageOrWindowObject, const QOhosWindowProxySubWindowCreateInfo &createInfo, QOhosConsumer< QtOhos::JsState &, QOhosWindowProxyData > resultConsumer)
void makeWindowProxyDataForSubWindowInJsThread(QtOhos::JsState &jsState, const QOhosWindowProxySubWindowCreateInfo &createInfo, QOhosConsumer< QtOhos::JsState &, QOhosWindowProxyData > resultConsumer)
void makeWindowProxyDataForExistingMainWindowInJsThread(QtOhos::JsState &jsState, const QOhosWindowProxyExistingMainWindowCreateInfo &createInfo, QOhosConsumer< QtOhos::JsState &, QOhosWindowProxyData > resultConsumer)
void makeWindowProxyDataForMainWindowInJsThread(QtOhos::JsState &jsState, const QOhosWindowProxyMainWindowCreateInfo &createInfo, QOhosConsumer< QtOhos::JsState &, QOhosWindowProxyData > resultConsumer)
QXComponent< QXComponentType::Node > QXComponentNode
Definition qxcomponent.h:44
QOhosConsumer< QtOhos::JsState &, QOhosWindowProxyData > resultConsumer
QOhosConsumer< QtOhos::JsState &, QOhosWindowProxyData > resultConsumer
std::shared_ptr< QtOhos::QAbilityPeer > qAbilityPeer