!3986 支持isTransferringCaller

Merge pull request !3986 from Cooper/test_nolog
This commit is contained in:
openharmony_ci 2023-11-04 09:39:45 +00:00 committed by Gitee
commit 33fcd36a08
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
14 changed files with 21 additions and 12 deletions

View File

@ -1092,7 +1092,8 @@ public:
* @return WMError
*/
virtual WMError NapiSetUIContent(const std::string& contentInfo, napi_env env,
napi_value storage, bool isDistributed = false, AppExecFwk::Ability* ability = nullptr)
napi_value storage, bool isDistributed = false, sptr<IRemoteObject> token = nullptr,
AppExecFwk::Ability* ability = nullptr)
{
return WMError::WM_OK;
}

View File

@ -1520,7 +1520,8 @@ static void LoadContentTask(std::shared_ptr<NativeReference> contentStorage, std
if (isLoadedByName) {
ret = WM_JS_TO_ERROR_CODE_MAP.at(weakWindow->SetUIContentByName(contextUrl, env, nativeStorage, ability));
} else {
ret = WM_JS_TO_ERROR_CODE_MAP.at(weakWindow->NapiSetUIContent(contextUrl, env, nativeStorage, false, ability));
ret = WM_JS_TO_ERROR_CODE_MAP.at(
weakWindow->NapiSetUIContent(contextUrl, env, nativeStorage, false, nullptr, ability));
}
if (ret == WmErrorCode::WM_OK) {
task.Resolve(env, NapiGetUndefined(env));

View File

@ -201,7 +201,8 @@ public:
virtual void NotifyTouchDialogTarget() = 0;
virtual void SetAceAbilityHandler(const sptr<IAceAbilityHandler>& handler) = 0;
virtual WMError NapiSetUIContent(const std::string& contentInfo, napi_env env,
napi_value storage, bool isDistributed = false, AppExecFwk::Ability* ability = nullptr) = 0;
napi_value storage, bool isDistributed = false, sptr<IRemoteObject> token = nullptr,
AppExecFwk::Ability* ability = nullptr) = 0;
virtual WMError SetUIContentByName(const std::string& contentInfo, napi_env env, napi_value storage,
AppExecFwk::Ability* ability = nullptr)
{

View File

@ -168,7 +168,7 @@ public:
void NotifyTouchDialogTarget() override;
virtual WMError NapiSetUIContent(const std::string& contentInfo, napi_env env,
napi_value storage, bool isdistributed, AppExecFwk::Ability* ability) override;
napi_value storage, bool isdistributed, sptr<IRemoteObject> token, AppExecFwk::Ability* ability) override;
virtual std::string GetContentInfo() override;
virtual const std::shared_ptr<AbilityRuntime::Context> GetContext() const override;
virtual Ace::UIContent* GetUIContent() const override;

View File

@ -232,7 +232,7 @@ void WindowImpl::OnNewWant(const AAFwk::Want& want)
}
WMError WindowImpl::NapiSetUIContent(const std::string& contentInfo,
napi_env env, napi_value storage, bool isdistributed, AppExecFwk::Ability* ability)
napi_env env, napi_value storage, bool isdistributed, sptr<IRemoteObject> token, AppExecFwk::Ability* ability)
{
WLOGFD("NapiSetUIContent: %{public}s", contentInfo.c_str());
if (uiContent_) {

View File

@ -69,6 +69,9 @@ public:
MOCK_METHOD3(CreateModalUIExtension, int32_t(const AAFwk::Want& want,
const ModalUIExtensionCallbacks& callbacks, const ModalUIExtensionConfig& config));
MOCK_METHOD1(CloseModalUIExtension, void(int32_t sessionId));
MOCK_METHOD1(SetParentToken, void(sptr<IRemoteObject> token));
MOCK_METHOD0(GetParentToken, sptr<IRemoteObject>());
};
} // namespace Ace
} // namespace OHOS

View File

@ -157,6 +157,7 @@ struct SessionInfo {
bool isSystem_ = false;
uint32_t windowType_ = 1; // WINDOW_TYPE_APP_MAIN_WINDOW
sptr<IRemoteObject> callerToken_ = nullptr;
sptr<IRemoteObject> rootToken_ = nullptr;
mutable std::shared_ptr<AAFwk::Want> want; // want for ability start
std::shared_ptr<AAFwk::Want> closeAbilityWant;

View File

@ -59,6 +59,7 @@ sptr<AAFwk::SessionInfo> ExtensionSessionManager::SetAbilitySessionInfo(const sp
sptr<ISession> iSession(extSession);
abilitySessionInfo->sessionToken = iSession->AsObject();
abilitySessionInfo->callerToken = sessionInfo.callerToken_;
abilitySessionInfo->parentToken = sessionInfo.rootToken_;
abilitySessionInfo->persistentId = extSession->GetPersistentId();
if (sessionInfo.want != nullptr) {
abilitySessionInfo->want = *sessionInfo.want;

View File

@ -35,7 +35,7 @@ public:
void RegisterTransferComponentDataListener(const NotifyTransferComponentDataFunc& func) override;
WMError SetPrivacyMode(bool isPrivacyMode) override;
WMError NapiSetUIContent(const std::string& contentInfo, napi_env env,
napi_value storage, bool isdistributed, AppExecFwk::Ability* ability) override;
napi_value storage, bool isdistributed, sptr<IRemoteObject> token, AppExecFwk::Ability* ability) override;
WSError UpdateRect(const WSRect& rect, SizeChangeReason reason,
const std::shared_ptr<RSTransaction>& rsTransaction = nullptr) override;

View File

@ -264,7 +264,7 @@ public:
void NotifyForegroundInteractiveStatus(bool interactive);
virtual WMError NapiSetUIContent(const std::string& contentInfo, napi_env env,
napi_value storage, bool isdistributed, AppExecFwk::Ability* ability) override;
napi_value storage, bool isdistributed, sptr<IRemoteObject> token, AppExecFwk::Ability* ability) override;
virtual WMError SetUIContentByName(const std::string& contentInfo, napi_env env, napi_value storage,
AppExecFwk::Ability* ability) override;
virtual std::string GetContentInfo() override;

View File

@ -56,7 +56,7 @@ public:
WMError Destroy() override;
virtual WMError Destroy(bool needNotifyServer, bool needClearListener = true);
WMError NapiSetUIContent(const std::string& contentInfo, napi_env env,
napi_value storage, bool isdistributed, AppExecFwk::Ability* ability) override;
napi_value storage, bool isdistributed, sptr<IRemoteObject> token, AppExecFwk::Ability* ability) override;
WMError SetUIContentByName(const std::string& contentInfo, napi_env env, napi_value storage,
AppExecFwk::Ability* ability) override;
std::shared_ptr<RSSurfaceNode> GetSurfaceNode() const override;

View File

@ -163,7 +163,7 @@ void WindowExtensionSessionImpl::NotifyConfigurationUpdated()
}
WMError WindowExtensionSessionImpl::NapiSetUIContent(const std::string& contentInfo,
napi_env env, napi_value storage, bool isdistributed, AppExecFwk::Ability* ability)
napi_env env, napi_value storage, bool isdistributed, sptr<IRemoteObject> token, AppExecFwk::Ability* ability)
{
WLOGFD("WindowExtensionSessionImpl NapiSetUIContent: %{public}s state:%{public}u", contentInfo.c_str(), state_);
if (uiContent_) {
@ -179,6 +179,7 @@ WMError WindowExtensionSessionImpl::NapiSetUIContent(const std::string& contentI
WLOGFE("fail to NapiSetUIContent id: %{public}d", GetPersistentId());
return WMError::WM_ERROR_NULLPTR;
}
uiContent->SetParentToken(token);
uiContent->Initialize(this, contentInfo, storage, property_->GetParentId());
// make uiContent available after Initialize/Restore
uiContent_ = std::move(uiContent);

View File

@ -528,7 +528,7 @@ void WindowImpl::OnNewWant(const AAFwk::Want& want)
}
WMError WindowImpl::NapiSetUIContent(const std::string& contentInfo, napi_env env, napi_value storage,
bool isdistributed, AppExecFwk::Ability* ability)
bool isdistributed, sptr<IRemoteObject> token, AppExecFwk::Ability* ability)
{
return SetUIContentInner(contentInfo, env, storage, isdistributed, false, ability);
}

View File

@ -560,7 +560,7 @@ void WindowSessionImpl::UpdateTitleButtonVisibility()
}
WMError WindowSessionImpl::NapiSetUIContent(const std::string& contentInfo, napi_env env, napi_value storage,
bool isdistributed, AppExecFwk::Ability* ability)
bool isdistributed, sptr<IRemoteObject> token, AppExecFwk::Ability* ability)
{
return SetUIContentInner(contentInfo, env, storage, isdistributed, false, ability);
}