1 /*
2 * Copyright (c) 2023 Huawei Device Co., Ltd.
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
16 #include "session/host/include/extension_session.h"
17
18 #include "ipc_skeleton.h"
19
20 #include "window_manager_hilog.h"
21 #include "anr_manager.h"
22
23 namespace OHOS::Rosen {
24 namespace {
25 constexpr HiviewDFX::HiLogLabel LABEL = { LOG_CORE, HILOG_DOMAIN_WINDOW, "ExtensionSession" };
26 } // namespace
27
SetTransferKeyEventForConsumedParams(int32_t keyEventId,bool isPreImeEvent,const std::shared_ptr<std::promise<bool>> & isConsumedPromise,const std::shared_ptr<WSError> & retCode)28 void WindowEventChannelListener::SetTransferKeyEventForConsumedParams(int32_t keyEventId, bool isPreImeEvent,
29 const std::shared_ptr<std::promise<bool>>& isConsumedPromise, const std::shared_ptr<WSError>& retCode)
30 {
31 std::lock_guard<std::mutex> lock(transferKeyEventForConsumedMutex_);
32 keyEventId_ = keyEventId;
33 isPreImeEvent_ = isPreImeEvent;
34 retCode_ = retCode;
35 isConsumedPromise_ = isConsumedPromise;
36 }
37
ResetTransferKeyEventForConsumedParams()38 void WindowEventChannelListener::ResetTransferKeyEventForConsumedParams()
39 {
40 std::lock_guard<std::mutex> lock(transferKeyEventForConsumedMutex_);
41 retCode_ = nullptr;
42 isConsumedPromise_ = nullptr;
43 }
44
ResetTransferKeyEventForConsumedParams(bool isConsumed,WSError retCode)45 void WindowEventChannelListener::ResetTransferKeyEventForConsumedParams(bool isConsumed, WSError retCode)
46 {
47 std::lock_guard<std::mutex> lock(transferKeyEventForConsumedMutex_);
48 if (retCode_ != nullptr) {
49 *retCode_ = retCode;
50 retCode_ = nullptr;
51 }
52 if (isConsumedPromise_ != nullptr) {
53 isConsumedPromise_->set_value(isConsumed);
54 isConsumedPromise_ = nullptr;
55 }
56 }
57
OnTransferKeyEventForConsumed(int32_t keyEventId,bool isPreImeEvent,bool isConsumed,WSError retCode)58 void WindowEventChannelListener::OnTransferKeyEventForConsumed(int32_t keyEventId, bool isPreImeEvent, bool isConsumed,
59 WSError retCode)
60 {
61 std::lock_guard<std::mutex> lock(transferKeyEventForConsumedMutex_);
62 if (keyEventId_ != keyEventId || isPreImeEvent_ != isPreImeEvent) {
63 TLOGW(WmsLogTag::WMS_EVENT, "The event has been processed at PreIme:%{public}d id:%{public}d.",
64 isPreImeEvent, keyEventId);
65 return;
66 }
67 if (isConsumedPromise_ == nullptr || retCode_ == nullptr) {
68 TLOGW(WmsLogTag::WMS_EVENT, "Promise or ret is null at PreIme:%{public}d id:%{public}d.",
69 isPreImeEvent, keyEventId);
70 return;
71 }
72
73 *retCode_ = retCode;
74 retCode_ = nullptr;
75 isConsumedPromise_->set_value(isConsumed);
76 isConsumedPromise_ = nullptr;
77 }
78
OnRemoteRequest(uint32_t code,MessageParcel & data,MessageParcel & reply,MessageOption & option)79 int32_t WindowEventChannelListener::OnRemoteRequest(uint32_t code, MessageParcel& data, MessageParcel& reply,
80 MessageOption& option)
81 {
82 if (data.ReadInterfaceToken() != GetDescriptor()) {
83 TLOGE(WmsLogTag::WMS_EVENT, "InterfaceToken check failed");
84 return ERR_TRANSACTION_FAILED;
85 }
86
87 auto msgId = static_cast<WindowEventChannelListenerMessage>(code);
88 switch (msgId) {
89 case WindowEventChannelListenerMessage::TRANS_ID_ON_TRANSFER_KEY_EVENT_FOR_CONSUMED_ASYNC: {
90 int32_t keyEventId = data.ReadInt32();
91 bool isPreImeEvent = data.ReadBool();
92 bool isConsumed = data.ReadBool();
93 WSError retCode = static_cast<WSError>(data.ReadInt32());
94 OnTransferKeyEventForConsumed(keyEventId, isPreImeEvent, isConsumed, retCode);
95 break;
96 }
97 default:
98 TLOGE(WmsLogTag::WMS_EVENT, "unknown transaction code %{public}d", code);
99 return IPCObjectStub::OnRemoteRequest(code, data, reply, option);
100 }
101 return ERR_NONE;
102 }
103
OnRemoteDied(const wptr<IRemoteObject> & wptrDeath)104 void ChannelDeathRecipient::OnRemoteDied(const wptr<IRemoteObject>& wptrDeath)
105 {
106 if (wptrDeath == nullptr) {
107 TLOGE(WmsLogTag::WMS_UIEXT, "wptrDeath is null");
108 return;
109 }
110
111 sptr<IRemoteObject> object = wptrDeath.promote();
112 if (!object) {
113 TLOGE(WmsLogTag::WMS_UIEXT, "object is null");
114 return;
115 }
116
117 if (listener_ == nullptr) {
118 TLOGE(WmsLogTag::WMS_UIEXT, "listener_ is null");
119 return;
120 }
121 TLOGE(WmsLogTag::WMS_UIEXT, "ChannelDeathRecipient OnRemoteDied");
122 listener_->ResetTransferKeyEventForConsumedParams(false, WSError::WS_ERROR_IPC_FAILED);
123 }
124
ExtensionSession(const SessionInfo & info)125 ExtensionSession::ExtensionSession(const SessionInfo& info) : Session(info)
126 {
127 WLOGFD("Create extension session, bundleName: %{public}s, moduleName: %{public}s, abilityName: %{public}s.",
128 info.bundleName_.c_str(), info.moduleName_.c_str(), info.abilityName_.c_str());
129 GeneratePersistentId(true, info.persistentId_);
130 }
131
~ExtensionSession()132 ExtensionSession::~ExtensionSession()
133 {
134 TLOGI(WmsLogTag::WMS_UIEXT, "realease extension session");
135 if (windowEventChannel_ == nullptr) {
136 TLOGE(WmsLogTag::WMS_UIEXT, "window event channel is null");
137 return;
138 }
139 sptr<IRemoteObject> remoteObject = windowEventChannel_->AsObject();
140 if (remoteObject == nullptr) {
141 TLOGE(WmsLogTag::WMS_UIEXT, "remoteObject is null");
142 return;
143 }
144 remoteObject->RemoveDeathRecipient(channelDeath_);
145 channelListener_ = nullptr;
146 channelDeath_ = nullptr;
147 }
148
ConnectInner(const sptr<ISessionStage> & sessionStage,const sptr<IWindowEventChannel> & eventChannel,const std::shared_ptr<RSSurfaceNode> & surfaceNode,SystemSessionConfig & systemConfig,sptr<WindowSessionProperty> property,sptr<IRemoteObject> token,int32_t pid,int32_t uid,const std::string & identityToken)149 WSError ExtensionSession::ConnectInner(
150 const sptr<ISessionStage>& sessionStage, const sptr<IWindowEventChannel>& eventChannel,
151 const std::shared_ptr<RSSurfaceNode>& surfaceNode, SystemSessionConfig& systemConfig,
152 sptr<WindowSessionProperty> property, sptr<IRemoteObject> token, int32_t pid, int32_t uid,
153 const std::string& identityToken)
154 {
155 if (pid == INVALID_PID || uid == INVALID_UID) {
156 TLOGE(WmsLogTag::WMS_UIEXT, "invalid pid or uid");
157 return WSError::WS_ERROR_INVALID_PARAM;
158 }
159 auto task = [weakThis = wptr(this), sessionStage, eventChannel, surfaceNode,
160 &systemConfig, property, token, pid, uid]() {
161 auto session = weakThis.promote();
162 if (!session) {
163 TLOGE(WmsLogTag::WMS_UIEXT, "session is null");
164 return WSError::WS_ERROR_DESTROYED_OBJECT;
165 }
166
167 if (eventChannel != nullptr) {
168 sptr<IRemoteObject> remoteObject = eventChannel->AsObject();
169 if (remoteObject == nullptr) {
170 TLOGE(WmsLogTag::WMS_UIEXT, "remoteObject is null");
171 return WSError::WS_ERROR_DESTROYED_OBJECT;
172 }
173
174 session->channelListener_ = new WindowEventChannelListener();
175 if (session->channelListener_ == nullptr) {
176 TLOGE(WmsLogTag::WMS_UIEXT, "Failed to create death Recipient ptr.");
177 return WSError::WS_ERROR_NULLPTR;
178 }
179 session->channelDeath_ = new (std::nothrow) ChannelDeathRecipient(session->channelListener_);
180 if (session->channelDeath_ == nullptr) {
181 TLOGE(WmsLogTag::WMS_UIEXT, "Failed to create listener ptr.");
182 return WSError::WS_ERROR_NULLPTR;
183 }
184
185 if (remoteObject->IsProxyObject() && !remoteObject->AddDeathRecipient(session->channelDeath_)) {
186 TLOGE(WmsLogTag::WMS_UIEXT, "Failed to add death recipient");
187 return WSError::WS_ERROR_INTERNAL_ERROR;
188 }
189 }
190
191 return session->Session::ConnectInner(
192 sessionStage, eventChannel, surfaceNode, systemConfig, property, token, pid, uid);
193 };
194 return PostSyncTask(task, "ConnectInner");
195 }
196
Connect(const sptr<ISessionStage> & sessionStage,const sptr<IWindowEventChannel> & eventChannel,const std::shared_ptr<RSSurfaceNode> & surfaceNode,SystemSessionConfig & systemConfig,sptr<WindowSessionProperty> property,sptr<IRemoteObject> token,const std::string & identityToken)197 WSError ExtensionSession::Connect(
198 const sptr<ISessionStage>& sessionStage, const sptr<IWindowEventChannel>& eventChannel,
199 const std::shared_ptr<RSSurfaceNode>& surfaceNode, SystemSessionConfig& systemConfig,
200 sptr<WindowSessionProperty> property, sptr<IRemoteObject> token,
201 const std::string& identityToken)
202 {
203 // Get pid and uid before posting task.
204 int32_t pid = IPCSkeleton::GetCallingRealPid();
205 int32_t uid = IPCSkeleton::GetCallingUid();
206 return ConnectInner(sessionStage, eventChannel, surfaceNode, systemConfig,
207 property, token, pid, uid, identityToken);
208 }
209
TransferAbilityResult(uint32_t resultCode,const AAFwk::Want & want)210 WSError ExtensionSession::TransferAbilityResult(uint32_t resultCode, const AAFwk::Want& want)
211 {
212 if (extSessionEventCallback_ != nullptr &&
213 extSessionEventCallback_->transferAbilityResultFunc_ != nullptr) {
214 extSessionEventCallback_->transferAbilityResultFunc_(resultCode, want);
215 }
216 return WSError::WS_OK;
217 }
218
TransferExtensionData(const AAFwk::WantParams & wantParams)219 WSError ExtensionSession::TransferExtensionData(const AAFwk::WantParams& wantParams)
220 {
221 if (extSessionEventCallback_ != nullptr &&
222 extSessionEventCallback_->transferExtensionDataFunc_ != nullptr) {
223 extSessionEventCallback_->transferExtensionDataFunc_(wantParams);
224 }
225 return WSError::WS_OK;
226 }
227
TransferComponentData(const AAFwk::WantParams & wantParams)228 WSError ExtensionSession::TransferComponentData(const AAFwk::WantParams& wantParams)
229 {
230 if (!IsSessionValid()) {
231 return WSError::WS_ERROR_INVALID_SESSION;
232 }
233 sessionStage_->NotifyTransferComponentData(wantParams);
234 return WSError::WS_OK;
235 }
236
TransferComponentDataSync(const AAFwk::WantParams & wantParams,AAFwk::WantParams & reWantParams)237 WSErrorCode ExtensionSession::TransferComponentDataSync(const AAFwk::WantParams& wantParams,
238 AAFwk::WantParams& reWantParams)
239 {
240 if (!IsSessionValid()) {
241 return WSErrorCode::WS_ERROR_TRANSFER_DATA_FAILED;
242 }
243 return sessionStage_->NotifyTransferComponentDataSync(wantParams, reWantParams);
244 }
245
NotifySyncOn()246 void ExtensionSession::NotifySyncOn()
247 {
248 if (extSessionEventCallback_ != nullptr &&
249 extSessionEventCallback_->notifySyncOnFunc_ != nullptr) {
250 extSessionEventCallback_->notifySyncOnFunc_();
251 }
252 }
253
NotifyAsyncOn()254 void ExtensionSession::NotifyAsyncOn()
255 {
256 if (extSessionEventCallback_ != nullptr &&
257 extSessionEventCallback_->notifyAsyncOnFunc_ != nullptr) {
258 extSessionEventCallback_->notifyAsyncOnFunc_();
259 }
260 }
261
NotifyDensityFollowHost(bool isFollowHost,float densityValue)262 WSError ExtensionSession::NotifyDensityFollowHost(bool isFollowHost, float densityValue)
263 {
264 if (!IsSessionValid()) {
265 return WSError::WS_ERROR_INVALID_SESSION;
266 }
267 if (!sessionStage_) {
268 TLOGE(WmsLogTag::WMS_UIEXT, "session stage is null!");
269 return WSError::WS_ERROR_NULLPTR;
270 }
271
272 return sessionStage_->NotifyDensityFollowHost(isFollowHost, densityValue);
273 }
274
TriggerBindModalUIExtension()275 void ExtensionSession::TriggerBindModalUIExtension()
276 {
277 if (isFirstTriggerBindModal_ && extSessionEventCallback_ != nullptr &&
278 extSessionEventCallback_->notifyBindModalFunc_ != nullptr) {
279 WLOGFD("Start calling bind modal func.");
280 extSessionEventCallback_->notifyBindModalFunc_();
281 isFirstTriggerBindModal_ = false;
282 }
283 }
284
RegisterExtensionSessionEventCallback(const sptr<ExtensionSessionEventCallback> & extSessionEventCallback)285 void ExtensionSession::RegisterExtensionSessionEventCallback(
286 const sptr<ExtensionSessionEventCallback>& extSessionEventCallback)
287 {
288 extSessionEventCallback_ = extSessionEventCallback;
289 }
290
TransferKeyEventForConsumed(const std::shared_ptr<MMI::KeyEvent> & keyEvent,bool & isConsumed,bool & isTimeout,bool isPreImeEvent)291 WSError ExtensionSession::TransferKeyEventForConsumed(const std::shared_ptr<MMI::KeyEvent>& keyEvent, bool& isConsumed,
292 bool& isTimeout, bool isPreImeEvent)
293 {
294 if (windowEventChannel_ == nullptr) {
295 TLOGE(WmsLogTag::WMS_EVENT, "windowEventChannel_ is null");
296 return WSError::WS_ERROR_NULLPTR;
297 }
298 if (keyEvent == nullptr) {
299 TLOGE(WmsLogTag::WMS_EVENT, "KeyEvent is nullptr");
300 return WSError::WS_ERROR_NULLPTR;
301 }
302 if (channelListener_ == nullptr) {
303 TLOGE(WmsLogTag::WMS_EVENT, "Created channelListener_ is nullptr.");
304 return WSError::WS_ERROR_NULLPTR;
305 }
306 int32_t keyEventId = keyEvent->GetId();
307 TLOGI(WmsLogTag::WMS_EVENT, "In with isPreImeEvent:%{public}d, id:%{public}d", isPreImeEvent, keyEventId);
308
309 auto isConsumedPromise = std::make_shared<std::promise<bool>>();
310 std::shared_ptr<WSError> retCode = std::make_shared<WSError>(WSError::WS_OK);
311 channelListener_->SetTransferKeyEventForConsumedParams(keyEventId, isPreImeEvent, isConsumedPromise, retCode);
312 auto ret = windowEventChannel_->TransferKeyEventForConsumedAsync(keyEvent, isPreImeEvent, channelListener_);
313 // if UiExtension was died, return transferKeyEvent before wait for timeout.
314 if (ret != WSError::WS_OK) {
315 TLOGE(WmsLogTag::WMS_EVENT, "transfer keyEvent failed with %{public}d at PreIme:%{public}d id:%{public}d.",
316 ret, isPreImeEvent, keyEventId);
317 return ret;
318 }
319
320 // Timeout cannot exceed APP_INPUT_BLOCK
321 constexpr int64_t TRANSFER_KEY_EVENT_TIMEOUT_TIME_MS = 4000;
322 auto isConsumedFuture = isConsumedPromise->get_future().share();
323 if (isConsumedFuture.wait_for(std::chrono::milliseconds(TRANSFER_KEY_EVENT_TIMEOUT_TIME_MS)) ==
324 std::future_status::timeout) {
325 // Prevents the pointer from being used by a remote ipc after its lifetime has ended.
326 channelListener_->ResetTransferKeyEventForConsumedParams();
327 isTimeout = true;
328 } else {
329 // Prevents the pointer from being used by a death recipient after its lifetime has ended.
330 channelListener_->ResetTransferKeyEventForConsumedParams();
331 isTimeout = false;
332 isConsumed = isConsumedFuture.get();
333 ret = *retCode;
334 }
335 TLOGI(WmsLogTag::WMS_EVENT, "isConsumed:%{public}d Timeout:%{public}d ret:%{public}d at PreIme:%{public}d "
336 "id:%{public}d.", isConsumed, isTimeout, ret, isPreImeEvent, keyEventId);
337 return ret;
338 }
339
TransferKeyEventAsync(const std::shared_ptr<MMI::KeyEvent> & keyEvent,bool isPreImeEvent)340 WSError ExtensionSession::TransferKeyEventAsync(const std::shared_ptr<MMI::KeyEvent>& keyEvent, bool isPreImeEvent)
341 {
342 if (windowEventChannel_ == nullptr) {
343 TLOGE(WmsLogTag::WMS_EVENT, "windowEventChannel_ is null");
344 return WSError::WS_ERROR_NULLPTR;
345 }
346 if (keyEvent == nullptr) {
347 TLOGE(WmsLogTag::WMS_EVENT, "KeyEvent is nullptr");
348 return WSError::WS_ERROR_NULLPTR;
349 }
350
351 TLOGI(WmsLogTag::WMS_EVENT, "In with isPreImeEvent(%{public}d), id:%{public}d", isPreImeEvent, keyEvent->GetId());
352 channelListener_->ResetTransferKeyEventForConsumedParams();
353 auto ret = windowEventChannel_->TransferKeyEventForConsumedAsync(keyEvent, isPreImeEvent, channelListener_);
354 TLOGI(WmsLogTag::WMS_EVENT, "ret is %{public}d in id:%{public}d.", ret, keyEvent->GetId());
355 return ret;
356 }
357
GetExtensionSessionEventCallback()358 sptr<ExtensionSession::ExtensionSessionEventCallback> ExtensionSession::GetExtensionSessionEventCallback()
359 {
360 if (extSessionEventCallback_ == nullptr) {
361 extSessionEventCallback_ = new(std::nothrow) ExtensionSessionEventCallback();
362 }
363
364 return extSessionEventCallback_;
365 }
366
TransferAccessibilityEvent(const Accessibility::AccessibilityEventInfo & info,int64_t uiExtensionIdLevel)367 WSError ExtensionSession::TransferAccessibilityEvent(const Accessibility::AccessibilityEventInfo& info,
368 int64_t uiExtensionIdLevel)
369 {
370 NotifyTransferAccessibilityEvent(info, uiExtensionIdLevel);
371 return WSError::WS_OK;
372 }
373
TransferAccessibilityHoverEvent(float pointX,float pointY,int32_t sourceType,int32_t eventType,int64_t timeMs)374 WSError ExtensionSession::TransferAccessibilityHoverEvent(
375 float pointX, float pointY, int32_t sourceType, int32_t eventType, int64_t timeMs)
376 {
377 if (!windowEventChannel_) {
378 TLOGE(WmsLogTag::WMS_UIEXT, "windowEventChannel_ is null");
379 return WSError::WS_ERROR_NULLPTR;
380 }
381 return windowEventChannel_->TransferAccessibilityHoverEvent(pointX, pointY, sourceType, eventType, timeMs);
382 }
383
TransferAccessibilityChildTreeRegister(uint32_t windowId,int32_t treeId,int64_t accessibilityId)384 WSError ExtensionSession::TransferAccessibilityChildTreeRegister(
385 uint32_t windowId, int32_t treeId, int64_t accessibilityId)
386 {
387 if (!windowEventChannel_) {
388 TLOGE(WmsLogTag::WMS_UIEXT, "windowEventChannel_ is null");
389 return WSError::WS_ERROR_NULLPTR;
390 }
391 return windowEventChannel_->TransferAccessibilityChildTreeRegister(windowId, treeId, accessibilityId);
392 }
393
TransferAccessibilityChildTreeUnregister()394 WSError ExtensionSession::TransferAccessibilityChildTreeUnregister()
395 {
396 if (!windowEventChannel_) {
397 TLOGE(WmsLogTag::WMS_UIEXT, "windowEventChannel_ is null");
398 return WSError::WS_ERROR_NULLPTR;
399 }
400 return windowEventChannel_->TransferAccessibilityChildTreeUnregister();
401 }
402
TransferAccessibilityDumpChildInfo(const std::vector<std::string> & params,std::vector<std::string> & info)403 WSError ExtensionSession::TransferAccessibilityDumpChildInfo(
404 const std::vector<std::string>& params, std::vector<std::string>& info)
405 {
406 if (!windowEventChannel_) {
407 TLOGE(WmsLogTag::WMS_UIEXT, "windowEventChannel_ is null");
408 return WSError::WS_ERROR_NULLPTR;
409 }
410 return windowEventChannel_->TransferAccessibilityDumpChildInfo(params, info);
411 }
412
UpdateAvoidArea(const sptr<AvoidArea> & avoidArea,AvoidAreaType type)413 WSError ExtensionSession::UpdateAvoidArea(const sptr<AvoidArea>& avoidArea, AvoidAreaType type)
414 {
415 if (!IsSessionValid()) {
416 return WSError::WS_ERROR_INVALID_SESSION;
417 }
418 return sessionStage_->UpdateAvoidArea(avoidArea, type);
419 }
420
GetAvoidAreaByType(AvoidAreaType type)421 AvoidArea ExtensionSession::GetAvoidAreaByType(AvoidAreaType type)
422 {
423 Rosen::AvoidArea avoidArea;
424 if (extSessionEventCallback_ != nullptr && extSessionEventCallback_->notifyGetAvoidAreaByTypeFunc_ != nullptr) {
425 avoidArea = extSessionEventCallback_->notifyGetAvoidAreaByTypeFunc_(type);
426 }
427 return avoidArea;
428 }
429
Background(bool isFromClient,const std::string & identityToken)430 WSError ExtensionSession::Background(bool isFromClient, const std::string& identityToken)
431 {
432 SessionState state = GetSessionState();
433 TLOGI(WmsLogTag::WMS_LIFE, "Background ExtensionSession, id: %{public}d, state: %{public}" PRIu32"",
434 GetPersistentId(), static_cast<uint32_t>(state));
435 if (state == SessionState::STATE_ACTIVE && GetWindowType() == WindowType::WINDOW_TYPE_UI_EXTENSION) {
436 UpdateSessionState(SessionState::STATE_INACTIVE);
437 state = SessionState::STATE_INACTIVE;
438 isActive_ = false;
439 }
440 if (state != SessionState::STATE_INACTIVE) {
441 WLOGFW("[WMSLife] Background state invalid! state:%{public}u", state);
442 return WSError::WS_ERROR_INVALID_SESSION;
443 }
444 UpdateSessionState(SessionState::STATE_BACKGROUND);
445 NotifyBackground();
446 DelayedSingleton<ANRManager>::GetInstance()->OnBackground(persistentId_);
447 return WSError::WS_OK;
448 }
449
NotifyExtensionEventAsync(uint32_t notifyEvent)450 void ExtensionSession::NotifyExtensionEventAsync(uint32_t notifyEvent)
451 {
452 TLOGI(WmsLogTag::WMS_UIEXT, "notifyEvent: %{public}d", notifyEvent);
453 if (extSessionEventCallback_ != nullptr && extSessionEventCallback_->notifyExtensionEventFunc_ != nullptr) {
454 extSessionEventCallback_->notifyExtensionEventFunc_(notifyEvent);
455 }
456 }
457
NotifyDumpInfo(const std::vector<std::string> & params,std::vector<std::string> & info)458 WSError ExtensionSession::NotifyDumpInfo(const std::vector<std::string>& params, std::vector<std::string>& info)
459 {
460 TLOGI(WmsLogTag::WMS_UIEXT, "persistenId=%{public}d", GetPersistentId());
461 if (!IsSessionValid()) {
462 return WSError::WS_ERROR_INVALID_SESSION;
463 }
464 if (!sessionStage_) {
465 TLOGE(WmsLogTag::WMS_UIEXT, "session stage is null");
466 return WSError::WS_ERROR_NULLPTR;
467 }
468 return sessionStage_->NotifyDumpInfo(params, info);
469 }
470 } // namespace OHOS::Rosen
471