增加ablityInfo为null的判断

Signed-off-by: zhouxueer <zhouxueer@huawei.com>
Change-Id: I6a8d185075385ac5e795e4f6732546db365b519f
Signed-off-by: zhouxueer <zhouxueer@huawei.com>
This commit is contained in:
zhouxueer 2023-08-12 10:54:42 +08:00
parent 2d2638b6ac
commit 7795164735
3 changed files with 38 additions and 10 deletions

View File

@ -49,6 +49,8 @@
"image_framework",
"preferences",
"hiview",
"ffrt",
"dsoftbus",
"hicollie",
"eventhandler",
"c_utils",

View File

@ -15,10 +15,14 @@
#include "scene_session_converter.h"
#include "ability_info.h"
#include "window_manager_hilog.h"
using namespace std;
namespace OHOS {
namespace Rosen {
namespace {
constexpr HiviewDFX::HiLogLabel LABEL = { LOG_CORE, HILOG_DOMAIN_WINDOW, "SceneSessionConverter" };
}
WSError SceneSessionConverter::ConvertToMissionInfos(std::vector<sptr<SceneSession>>& sceneSessionInfos,
std::vector<AAFwk::MissionInfo>& missionInfos)
@ -31,10 +35,18 @@ WSError SceneSessionConverter::ConvertToMissionInfos(std::vector<sptr<SceneSessi
missionInfo.id = (*iter)->GetPersistentId();
missionInfo.runningState = (*iter)->IsActive();
missionInfo.lockedState = ((*iter)->GetSessionInfo()).lockedState;
if ((*iter)->GetSessionInfo().abilityInfo != nullptr) {
missionInfo.label = ((*iter)->GetSessionInfo().abilityInfo)->label;
missionInfo.iconPath = ((*iter)->GetSessionInfo().abilityInfo)->iconPath;
missionInfo.want = *(((*iter)->GetSessionInfo()).want);
missionInfo.continuable = ((*iter)->GetSessionInfo().abilityInfo)->continuable;
} else {
WLOGFE("abilityInfo in SceneSession is nullptr, id: %{public}d", (*iter)->GetPersistentId());
}
if (((*iter)->GetSessionInfo()).want != nullptr) {
missionInfo.want = *(((*iter)->GetSessionInfo()).want);
} else {
WLOGFE("want in SceneSession is nullptr, id: %{public}d", (*iter)->GetPersistentId());
}
missionInfo.time = ((*iter)->GetSessionInfo()).time;
missionInfo.continueState = (AAFwk::ContinueState)(AAFwk::ContinueState::CONTINUESTATE_UNKNOWN
+ (((*iter)->GetSessionInfo()).continueState - Rosen::ContinueState::CONTINUESTATE_UNKNOWN));
@ -52,10 +64,18 @@ WSError SceneSessionConverter::ConvertToMissionInfo(sptr<SceneSession>& sceneSes
missionInfo.id = sceneSession->GetPersistentId();
missionInfo.runningState = sceneSession->IsActive();
missionInfo.lockedState = (sceneSession->GetSessionInfo()).lockedState;
if (sceneSession->GetSessionInfo().abilityInfo != nullptr) {
missionInfo.label = (sceneSession->GetSessionInfo().abilityInfo)->label;
missionInfo.iconPath = (sceneSession->GetSessionInfo().abilityInfo)->iconPath;
missionInfo.want = *((sceneSession->GetSessionInfo()).want);
missionInfo.continuable = (sceneSession->GetSessionInfo().abilityInfo)->continuable;
} else {
WLOGFE("abilityInfo in SceneSession is nullptr, id: %{public}d", sceneSession->GetPersistentId());
}
if ((sceneSession->GetSessionInfo()).want != nullptr) {
missionInfo.want = *((sceneSession->GetSessionInfo()).want);
} else {
WLOGFE("want in SceneSession is nullptr, id: %{public}d", sceneSession->GetPersistentId());
}
missionInfo.time = (sceneSession->GetSessionInfo()).time;
missionInfo.continueState = (AAFwk::ContinueState) (AAFwk::ContinueState::CONTINUESTATE_UNKNOWN
+ ((sceneSession->GetSessionInfo()).continueState - Rosen::ContinueState::CONTINUESTATE_UNKNOWN));

View File

@ -923,7 +923,9 @@ WSError SceneSessionManager::RequestSceneSessionDestruction(
if (needRemoveSession) {
std::unique_lock<std::shared_mutex> lock(sceneSessionMapMutex_);
sceneSessionMap_.erase(persistentId);
if (listenerController_ != nullptr && !(scnSession->GetSessionInfo().abilityInfo)->excludeFromMissions) {
if (listenerController_ != nullptr &&
(scnSession->GetSessionInfo().abilityInfo) != nullptr &&
!(scnSession->GetSessionInfo().abilityInfo)->excludeFromMissions) {
WLOGFD("NotifySessionDestroyed, id: %{public}d", persistentId);
listenerController_->NotifySessionDestroyed(persistentId);
}
@ -2054,6 +2056,7 @@ void SceneSessionManager::NotifyCompleteFirstFrameDrawing(int32_t persistentId)
WLOGFI("NotifyCompleteFirstFrameDrawing, persistentId: %{public}d", persistentId);
auto scnSession = GetSceneSession(persistentId);
if (!scnSession && listenerController_ != nullptr &&
(scnSession->GetSessionInfo().abilityInfo) != nullptr &&
!(scnSession->GetSessionInfo().abilityInfo)->excludeFromMissions) {
WLOGFD("NotifySessionCreated, id: %{public}d", persistentId);
listenerController_->NotifySessionCreated(persistentId);
@ -2065,6 +2068,7 @@ void SceneSessionManager::NotifySessionMovedToFront(int32_t persistentId)
WLOGFI("NotifySessionMovedToFront, persistentId: %{public}d", persistentId);
auto scnSession = GetSceneSession(persistentId);
if (!scnSession && listenerController_ != nullptr &&
(scnSession->GetSessionInfo().abilityInfo) != nullptr &&
!(scnSession->GetSessionInfo().abilityInfo)->excludeFromMissions) {
listenerController_->NotifySessionMovedToFront(persistentId);
}
@ -2107,7 +2111,9 @@ WSError SceneSessionManager::SetSessionIcon(const sptr<IRemoteObject> &token,
if (sceneSession->GetAbilityToken() == token) {
WLOGFI("try to update session icon.");
sessionListener_->OnSessionIconChange(iter.first, icon);
if (listenerController_ != nullptr && !(sceneSession->GetSessionInfo().abilityInfo)->excludeFromMissions) {
if (listenerController_ != nullptr &&
(sceneSession->GetSessionInfo().abilityInfo) != nullptr &&
!(sceneSession->GetSessionInfo().abilityInfo)->excludeFromMissions) {
WLOGFD("NotifySessionIconChanged, id: %{public}d", iter.first);
listenerController_->NotifySessionIconChanged(iter.first, icon);
}