mirror of
https://gitee.com/openharmony/window_window_manager
synced 2024-11-23 23:10:54 +00:00
解决同名问题,AbilityInfo->SceneAbilityInfo
Signed-off-by: xiahaiqin <xiahaiqin1@huawei.com> Change-Id: I3b100537bfdbf7583e7189504e79506ff0f46ab7
This commit is contained in:
parent
dc3934a72f
commit
2e0cf008ec
@ -40,7 +40,7 @@ public:
|
||||
virtual WSError Close() = 0;
|
||||
virtual WSError Recover() = 0;
|
||||
virtual WSError Maximum() = 0;
|
||||
virtual WSError StartScene(const AbilityInfo& info, SessionOption sessionOption) = 0;
|
||||
virtual WSError StartScene(const SceneAbilityInfo& info, SessionOption sessionOption) = 0;
|
||||
};
|
||||
}
|
||||
#endif // OHOS_SCENE_SESSION_INTERFACE_H
|
@ -34,7 +34,7 @@ public:
|
||||
virtual WSError Background() override;
|
||||
virtual WSError Disconnect() override;
|
||||
|
||||
WSError StartScene(const AbilityInfo& info, SessionOption sessionOption);
|
||||
WSError StartScene(const SceneAbilityInfo& info, SessionOption sessionOption);
|
||||
WSError Minimize();
|
||||
WSError Close();
|
||||
WSError Recover();
|
||||
|
@ -61,7 +61,7 @@ enum class SessionState : uint32_t {
|
||||
STATE_BACKGROUND,
|
||||
};
|
||||
|
||||
struct AbilityInfo {
|
||||
struct SceneAbilityInfo {
|
||||
std::string bundleName_ = "";
|
||||
std::string abilityName_ = "";
|
||||
};
|
||||
|
@ -101,13 +101,13 @@ NativeValue* JsSceneSessionManager::OnRequestSceneSession(NativeEngine& engine,
|
||||
WLOGFE("[NAPI]Argc is invalid: %{public}zu", info.argc);
|
||||
errCode = WSErrorCode::WS_ERROR_INVALID_PARAM;
|
||||
}
|
||||
AbilityInfo abilityInfo;
|
||||
SceneAbilityInfo abilityInfo;
|
||||
SessionOption sessionOption = SessionOption::SESSION_MODE_FULLSCREEN;
|
||||
if (errCode == WSErrorCode::WS_OK) {
|
||||
// parse ability info
|
||||
NativeObject* nativeObj = ConvertNativeValueTo<NativeObject>(info.argv[0]);
|
||||
if (nativeObj == nullptr) {
|
||||
WLOGFE("[NAPI]Failed to convert object to AbilityInfo");
|
||||
WLOGFE("[NAPI]Failed to convert object to SceneAbilityInfo");
|
||||
errCode = WSErrorCode::WS_ERROR_INVALID_PARAM;
|
||||
} else {
|
||||
if (!GetAbilityInfoFromJs(engine, nativeObj, abilityInfo)) {
|
||||
|
@ -27,7 +27,7 @@ namespace {
|
||||
}
|
||||
|
||||
bool GetAbilityInfoFromJs(NativeEngine& engine, NativeObject* jsObject,
|
||||
AbilityInfo& abilityInfo)
|
||||
SceneAbilityInfo& abilityInfo)
|
||||
{
|
||||
NativeValue* jsBundleName = jsObject->GetProperty("bundleName");
|
||||
NativeValue* jsAbilityName = jsObject->GetProperty("abilityName");
|
||||
|
@ -24,7 +24,7 @@
|
||||
#include "window_scene_common.h"
|
||||
namespace OHOS::Rosen {
|
||||
bool GetAbilityInfoFromJs(NativeEngine& engine, NativeObject* jsObject,
|
||||
AbilityInfo& abilityInfo);
|
||||
SceneAbilityInfo& abilityInfo);
|
||||
NativeValue* CreateJsAbilityInfo(NativeEngine& engine, const sptr<SceneSession>& session);
|
||||
}
|
||||
|
||||
|
@ -76,7 +76,7 @@ WSError SceneSessionStage::Disconnect()
|
||||
return WSError::WS_OK;
|
||||
}
|
||||
|
||||
WSError SceneSessionStage::StartScene(const AbilityInfo& info, SessionOption sessionOption)
|
||||
WSError SceneSessionStage::StartScene(const SceneAbilityInfo& info, SessionOption sessionOption)
|
||||
{
|
||||
if (sceneSession_ == nullptr) {
|
||||
WLOGFE("sceneSession is invalid");
|
||||
|
@ -26,7 +26,7 @@ class SceneSession;
|
||||
using NotifyStartSceneFunc = std::function<void(const sptr<SceneSession>& session)>;
|
||||
class SceneSession : public SceneSessionStub, public Session {
|
||||
public:
|
||||
explicit SceneSession(const AbilityInfo& info);
|
||||
explicit SceneSession(const SceneAbilityInfo& info);
|
||||
~SceneSession() = default;
|
||||
|
||||
virtual WSError Connect(const sptr<ISceneSessionStage>& sessionStage,
|
||||
@ -38,16 +38,16 @@ public:
|
||||
virtual WSError Close() override;
|
||||
virtual WSError Recover() override;
|
||||
virtual WSError Maximum() override;
|
||||
virtual WSError StartScene(const AbilityInfo& info, SessionOption sessionOption) override;
|
||||
virtual WSError StartScene(const SceneAbilityInfo& info, SessionOption sessionOption) override;
|
||||
|
||||
virtual WSError SetActive(bool active) override;
|
||||
|
||||
const AbilityInfo& GetAbilityInfo() const;
|
||||
const SceneAbilityInfo& GetAbilityInfo() const;
|
||||
void RegisterStartSceneEventListener(const NotifyStartSceneFunc& func);
|
||||
private:
|
||||
sptr<ISceneSessionStage> sceneSessionStage_;
|
||||
sptr<IWindowEventChannel> windowEventChannel_;
|
||||
AbilityInfo abilityInfo_;
|
||||
SceneAbilityInfo abilityInfo_;
|
||||
std::string sessionType_ = "";
|
||||
bool isActive_ = false;
|
||||
NotifyStartSceneFunc startSceneFunc_;
|
||||
|
@ -29,7 +29,7 @@ namespace OHOS::Rosen {
|
||||
class SceneSessionManager {
|
||||
WS_DECLARE_SINGLE_INSTANCE(SceneSessionManager)
|
||||
public:
|
||||
sptr<SceneSession> RequestSceneSession(const AbilityInfo& abilityInfo, SessionOption option);
|
||||
sptr<SceneSession> RequestSceneSession(const SceneAbilityInfo& abilityInfo, SessionOption option);
|
||||
WSError RequestSceneSessionActivation(const sptr<SceneSession>& sceneSession);
|
||||
WSError RequestSceneSessionBackground(const sptr<SceneSession>& sceneSession);
|
||||
WSError RequestSceneSessionDestruction(const sptr<SceneSession>& sceneSession);
|
||||
|
@ -37,7 +37,7 @@ public:
|
||||
virtual WSError Close() override;
|
||||
virtual WSError Recover() override;
|
||||
virtual WSError Maximum() override;
|
||||
virtual WSError StartScene(const AbilityInfo& abilityInfo, SessionOption sessionOption) override;
|
||||
virtual WSError StartScene(const SceneAbilityInfo& abilityInfo, SessionOption sessionOption) override;
|
||||
private:
|
||||
static inline BrokerDelegator<SceneSessionProxy> delegator_;
|
||||
};
|
||||
|
@ -23,7 +23,7 @@ namespace {
|
||||
constexpr HiviewDFX::HiLogLabel LABEL = {LOG_CORE, HILOG_DOMAIN_WINDOW, "SceneSession"};
|
||||
}
|
||||
|
||||
SceneSession::SceneSession(const AbilityInfo& info) : Session(info.bundleName_), abilityInfo_(info)
|
||||
SceneSession::SceneSession(const SceneAbilityInfo& info) : Session(info.bundleName_), abilityInfo_(info)
|
||||
{
|
||||
}
|
||||
|
||||
@ -145,7 +145,7 @@ WSError SceneSession::Maximum()
|
||||
return WSError::WS_OK;
|
||||
}
|
||||
|
||||
WSError SceneSession::StartScene(const AbilityInfo& info, SessionOption sessionOption)
|
||||
WSError SceneSession::StartScene(const SceneAbilityInfo& info, SessionOption sessionOption)
|
||||
{
|
||||
auto sceneSession = SceneSessionManager::GetInstance().RequestSceneSession(info, sessionOption);
|
||||
if (sceneSession == nullptr) {
|
||||
@ -180,7 +180,7 @@ WSError SceneSession::SetActive(bool active)
|
||||
return WSError::WS_OK;
|
||||
}
|
||||
|
||||
const AbilityInfo& SceneSession::GetAbilityInfo() const
|
||||
const SceneAbilityInfo& SceneSession::GetAbilityInfo() const
|
||||
{
|
||||
return abilityInfo_;
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ namespace {
|
||||
|
||||
WS_IMPLEMENT_SINGLE_INSTANCE(SceneSessionManager)
|
||||
|
||||
sptr<SceneSession> SceneSessionManager::RequestSceneSession(const AbilityInfo& abilityInfo, SessionOption option)
|
||||
sptr<SceneSession> SceneSessionManager::RequestSceneSession(const SceneAbilityInfo& abilityInfo, SessionOption option)
|
||||
{
|
||||
WLOGFI("abilityInfo: bundleName: %{public}s, abilityName: %{public}s", abilityInfo.bundleName_.c_str(),
|
||||
abilityInfo.abilityName_.c_str());
|
||||
|
@ -179,7 +179,7 @@ WSError SceneSessionProxy::Maximum()
|
||||
return static_cast<WSError>(ret);
|
||||
}
|
||||
|
||||
WSError SceneSessionProxy::StartScene(const AbilityInfo& info, SessionOption sessionOption)
|
||||
WSError SceneSessionProxy::StartScene(const SceneAbilityInfo& info, SessionOption sessionOption)
|
||||
{
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
|
@ -127,7 +127,7 @@ int SceneSessionStub::HandleMaximum(MessageParcel& data, MessageParcel& reply)
|
||||
int SceneSessionStub::HandleStartScene(MessageParcel& data, MessageParcel& reply)
|
||||
{
|
||||
WLOGFD("RequestActivation!");
|
||||
AbilityInfo info = { data.ReadString(), data.ReadString() };
|
||||
SceneAbilityInfo info = { data.ReadString(), data.ReadString() };
|
||||
SessionOption sessionOption = static_cast<SessionOption>(data.ReadUint32());
|
||||
WSError errCode = StartScene(info, sessionOption);
|
||||
reply.WriteUint32(static_cast<uint32_t>(errCode));
|
||||
|
Loading…
Reference in New Issue
Block a user