mirror of
https://github.com/openharmony/ability_ability_runtime.git
synced 2026-08-24 12:43:16 -04:00
东湖_退后台传入isFromScreenOffBackground_
Signed-off-by: lidongrui <lidongrui3@huawei.com> Co-Authored-By: Agent
This commit is contained in:
@@ -99,9 +99,11 @@ public:
|
||||
* @brief Notify when notify app to background.
|
||||
* @param missionId missionId.
|
||||
* @param userId, the user id.
|
||||
* @param isFromScreenOffBackground whether the background is caused by screen off.
|
||||
* @return 0 when notify move mission to background success or else failed.
|
||||
*/
|
||||
virtual int32_t NotifyMoveMissionToBackground(int32_t missionId, int32_t userId = CURRENT_USER_ID) = 0;
|
||||
virtual int32_t NotifyMoveMissionToBackground(int32_t missionId, int32_t userId = CURRENT_USER_ID,
|
||||
bool isFromScreenOffBackground = false) = 0;
|
||||
|
||||
/**
|
||||
* @brief Notify when notify app to foreground.
|
||||
|
||||
@@ -83,9 +83,11 @@ public:
|
||||
* @brief Notify when notify app to background.
|
||||
* @param missionId missionId.
|
||||
* @param userId, the user id.
|
||||
* @param isFromScreenOffBackground whether the background is caused by screen off.
|
||||
* @return 0 when notify move mission to background success or else failed.
|
||||
*/
|
||||
virtual int32_t NotifyMoveMissionToBackground(int32_t missionId, int32_t userId = CURRENT_USER_ID) override;
|
||||
virtual int32_t NotifyMoveMissionToBackground(int32_t missionId, int32_t userId = CURRENT_USER_ID,
|
||||
bool isFromScreenOffBackground = false) override;
|
||||
|
||||
/**
|
||||
* @brief Notify when notify app to foreground.
|
||||
|
||||
@@ -200,7 +200,8 @@ int32_t AbilityManagerCollaboratorProxy::NotifyLoadAbility(
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
int32_t AbilityManagerCollaboratorProxy::NotifyMoveMissionToBackground(int32_t missionId, int32_t userId)
|
||||
int32_t AbilityManagerCollaboratorProxy::NotifyMoveMissionToBackground(int32_t missionId, int32_t userId,
|
||||
bool isFromScreenOffBackground)
|
||||
{
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
@@ -218,6 +219,10 @@ int32_t AbilityManagerCollaboratorProxy::NotifyMoveMissionToBackground(int32_t m
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "userId write fail");
|
||||
return ERR_INVALID_OPERATION;
|
||||
}
|
||||
if (!data.WriteBool(isFromScreenOffBackground)) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "isFromScreenOffBackground write fail");
|
||||
return ERR_INVALID_OPERATION;
|
||||
}
|
||||
int32_t ret = SendTransactCmd(
|
||||
IAbilityManagerCollaborator::NOTIFY_MOVE_MISSION_TO_BACKGROUND, data, reply, option);
|
||||
if (ret != NO_ERROR) {
|
||||
|
||||
@@ -1003,7 +1003,8 @@ void AbilityRecord::SetAbilityStateInner(AbilityState state)
|
||||
int32_t persistentId = sessionInfo->persistentId;
|
||||
switch (state) {
|
||||
case AbilityState::BACKGROUNDING: {
|
||||
ret = collaborator->NotifyMoveMissionToBackground(persistentId, GetOwnerMissionUserId());
|
||||
ret = collaborator->NotifyMoveMissionToBackground(persistentId, GetOwnerMissionUserId(),
|
||||
isFromScreenOffBackground_);
|
||||
break;
|
||||
}
|
||||
case AbilityState::TERMINATING: {
|
||||
@@ -1024,7 +1025,8 @@ void AbilityRecord::SetAbilityStateInner(AbilityState state)
|
||||
break;
|
||||
}
|
||||
case AbilityState::BACKGROUNDING: {
|
||||
ret = collaborator->NotifyMoveMissionToBackground(missionId_, GetOwnerMissionUserId());
|
||||
ret = collaborator->NotifyMoveMissionToBackground(missionId_, GetOwnerMissionUserId(),
|
||||
isFromScreenOffBackground_);
|
||||
break;
|
||||
}
|
||||
case AbilityState::TERMINATING: {
|
||||
|
||||
@@ -32,7 +32,8 @@ public:
|
||||
const Want &want));
|
||||
MOCK_METHOD2(NotifyLoadAbility, int32_t(const AppExecFwk::AbilityInfo &abilityInfo,
|
||||
const sptr<SessionInfo> &sessionInfo));
|
||||
MOCK_METHOD2(NotifyMoveMissionToBackground, int32_t(int32_t missionId, int32_t userId));
|
||||
MOCK_METHOD3(NotifyMoveMissionToBackground, int32_t(int32_t missionId, int32_t userId,
|
||||
bool isFromScreenOffBackground));
|
||||
MOCK_METHOD2(NotifyMoveMissionToForeground, int32_t(int32_t missionId, int32_t userId));
|
||||
MOCK_METHOD2(NotifyTerminateMission, int32_t(int32_t missionId, int32_t userId));
|
||||
MOCK_METHOD2(NotifyClearMission, int32_t(int32_t missionId, int32_t userId));
|
||||
|
||||
+2
-1
@@ -133,7 +133,8 @@ HWTEST_F(AbilityManagerCollaboratorProxyTest, NotifyMoveMissionToBackground_0100
|
||||
.WillOnce(Invoke(mock_.GetRefPtr(), &AbilityManagerCollaboratorStubMock::InvokeSendRequest));
|
||||
int32_t missionId = 0;
|
||||
int32_t userId = 100;
|
||||
int32_t res = proxy_->NotifyMoveMissionToBackground(missionId, userId);
|
||||
bool isFromScreenOffBackground = false;
|
||||
int32_t res = proxy_->NotifyMoveMissionToBackground(missionId, userId, isFromScreenOffBackground);
|
||||
EXPECT_EQ(res, NO_ERROR);
|
||||
EXPECT_EQ(static_cast<uint32_t>(IAbilityManagerCollaborator::NOTIFY_MOVE_MISSION_TO_BACKGROUND), mock_->GetCode());
|
||||
}
|
||||
|
||||
+1
-1
@@ -59,7 +59,7 @@ public:
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t NotifyMoveMissionToBackground(int32_t missionId, int32_t userId)
|
||||
int32_t NotifyMoveMissionToBackground(int32_t missionId, int32_t userId, bool isFromScreenOffBackground)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
+2
-1
@@ -94,7 +94,8 @@ public:
|
||||
const Want &want));
|
||||
MOCK_METHOD2(NotifyLoadAbility, int32_t(const AppExecFwk::AbilityInfo &abilityInfo,
|
||||
const sptr<SessionInfo> &sessionInfo));
|
||||
MOCK_METHOD2(NotifyMoveMissionToBackground, int32_t(int32_t missionId, int32_t userId));
|
||||
MOCK_METHOD3(NotifyMoveMissionToBackground, int32_t(int32_t missionId, int32_t userId,
|
||||
bool isFromScreenOffBackground));
|
||||
MOCK_METHOD2(NotifyMoveMissionToForeground, int32_t(int32_t missionId, int32_t userId));
|
||||
MOCK_METHOD2(NotifyTerminateMission, int32_t(int32_t missionId, int32_t userId));
|
||||
MOCK_METHOD2(NotifyClearMission, int32_t(int32_t missionId, int32_t userId));
|
||||
|
||||
Reference in New Issue
Block a user