Skip to content

Commit

Permalink
!9236 增加动效参数,解决rk下的任务列表截图问题
Browse files Browse the repository at this point in the history
Merge pull request !9236 from gongyuechen/wms_param__4.0
  • Loading branch information
openharmony_ci authored and gitee-org committed Jul 2, 2024
2 parents 2f1dcf8 + 8662427 commit 6c7d010
Show file tree
Hide file tree
Showing 24 changed files with 68 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -869,7 +869,8 @@ class AbilityManagerClient {
* @param handler Indidate handler of WindowManagerService.
* @return ErrCode Returns ERR_OK on success, others on failure.
*/
ErrCode RegisterWindowManagerServiceHandler(const sptr<IWindowManagerServiceHandler>& handler);
ErrCode RegisterWindowManagerServiceHandler(const sptr<IWindowManagerServiceHandler> handler,
bool animationEnabled = true);

/**
* WindowManager notification AbilityManager after the first frame is drawn.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -721,7 +721,11 @@ class IAbilityManager : public OHOS::IRemoteBroker {
* @param handler Indidate handler of WindowManagerService.
* @return ErrCode Returns ERR_OK on success, others on failure.
*/
virtual int RegisterWindowManagerServiceHandler(const sptr<IWindowManagerServiceHandler>& handler) = 0;
virtual int RegisterWindowManagerServiceHandler(const sptr<IWindowManagerServiceHandler>& handler,
bool animationEnabled)
{
return 0;
}

/**
* WindowManager notification AbilityManager after the first frame is drawn.
Expand Down
3 changes: 2 additions & 1 deletion services/abilitymgr/include/ability_manager_proxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -595,7 +595,8 @@ class AbilityManagerProxy : public IRemoteProxy<IAbilityManager> {
virtual int SetMissionIcon(const sptr<IRemoteObject> &token,
const std::shared_ptr<OHOS::Media::PixelMap> &icon) override;

virtual int RegisterWindowManagerServiceHandler(const sptr<IWindowManagerServiceHandler>& handler) override;
virtual int RegisterWindowManagerServiceHandler(const sptr<IWindowManagerServiceHandler>& handler,
bool animationEnabled) override;

virtual void CompleteFirstFrameDrawing(const sptr<IRemoteObject> &abilityToken) override;

Expand Down
6 changes: 5 additions & 1 deletion services/abilitymgr/include/ability_manager_service.h
Original file line number Diff line number Diff line change
Expand Up @@ -843,7 +843,8 @@ class AbilityManagerService : public SystemAbility,
virtual int SetMissionIcon(const sptr<IRemoteObject> &token,
const std::shared_ptr<OHOS::Media::PixelMap> &icon) override;

virtual int RegisterWindowManagerServiceHandler(const sptr<IWindowManagerServiceHandler>& handler) override;
virtual int RegisterWindowManagerServiceHandler(const sptr<IWindowManagerServiceHandler>& handler,
bool animationEnabled) override;

virtual void CompleteFirstFrameDrawing(const sptr<IRemoteObject> &abilityToken) override;

Expand All @@ -855,6 +856,8 @@ class AbilityManagerService : public SystemAbility,
void HandleFocused(const sptr<OHOS::Rosen::FocusChangeInfo> &focusChangeInfo);

void HandleUnfocused(const sptr<OHOS::Rosen::FocusChangeInfo> &focusChangeInfo);

bool GetAnimationFlag();
#endif

void ClearUserData(int32_t userId);
Expand Down Expand Up @@ -1649,6 +1652,7 @@ class AbilityManagerService : public SystemAbility,
void InitPrepareTerminateConfig();
std::shared_ptr<ImplicitStartProcessor> implicitStartProcessor_;
sptr<IWindowManagerServiceHandler> wmsHandler_;
bool isAnimationEnabled_ = true; //only use on mission list
#endif
std::shared_ptr<AbilityInterceptorExecuter> interceptorExecuter_;
#ifdef SUPPORT_ERMS
Expand Down
5 changes: 3 additions & 2 deletions services/abilitymgr/src/ability_manager_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1031,11 +1031,12 @@ ErrCode AbilityManagerClient::SetMissionIcon(
return abms->SetMissionIcon(abilityToken, icon);
}

ErrCode AbilityManagerClient::RegisterWindowManagerServiceHandler(const sptr<IWindowManagerServiceHandler>& handler)
ErrCode AbilityManagerClient::RegisterWindowManagerServiceHandler(const sptr<IWindowManagerServiceHandler> handler,
bool animationEnabled)
{
auto abms = GetAbilityManager();
CHECK_POINTER_RETURN_NOT_CONNECTED(abms);
return abms->RegisterWindowManagerServiceHandler(handler);
return abms->RegisterWindowManagerServiceHandler(handler, animationEnabled);
}

void AbilityManagerClient::CompleteFirstFrameDrawing(const sptr<IRemoteObject> &abilityToken)
Expand Down
7 changes: 6 additions & 1 deletion services/abilitymgr/src/ability_manager_proxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2612,7 +2612,8 @@ int AbilityManagerProxy::SetMissionIcon(const sptr<IRemoteObject> &token,
return reply.ReadInt32();
}

int AbilityManagerProxy::RegisterWindowManagerServiceHandler(const sptr<IWindowManagerServiceHandler>& handler)
int AbilityManagerProxy::RegisterWindowManagerServiceHandler(const sptr<IWindowManagerServiceHandler>& handler,
bool animationEnabled)
{
if (!handler) {
HILOG_ERROR("%{public}s: handler is nullptr.", __func__);
Expand All @@ -2627,6 +2628,10 @@ int AbilityManagerProxy::RegisterWindowManagerServiceHandler(const sptr<IWindowM
HILOG_ERROR("%{public}s: handler write failed.", __func__);
return INNER_ERR;
}
if (!data.WriteBool(animationEnabled)) {
HILOG_ERROR("write animationEnabled fail.");
return ERR_INVALID_VALUE;
}
MessageOption option;
MessageParcel reply;
auto error = SendRequest(AbilityManagerInterfaceCode::REGISTER_WMS_HANDLER, data, reply, option);
Expand Down
9 changes: 8 additions & 1 deletion services/abilitymgr/src/ability_manager_service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6952,7 +6952,8 @@ int AbilityManagerService::SetMissionIcon(const sptr<IRemoteObject> &token,
return missionListManager->SetMissionIcon(token, icon);
}

int AbilityManagerService::RegisterWindowManagerServiceHandler(const sptr<IWindowManagerServiceHandler> &handler)
int AbilityManagerService::RegisterWindowManagerServiceHandler(const sptr<IWindowManagerServiceHandler> &handler,
bool animationEnabled)
{
auto isSaCall = AAFwk::PermissionVerification::GetInstance()->IsSACall();
auto isGatewayCall = AAFwk::PermissionVerification::GetInstance()->IsGatewayCall();
Expand All @@ -6961,6 +6962,7 @@ int AbilityManagerService::RegisterWindowManagerServiceHandler(const sptr<IWindo
return CHECK_PERMISSION_FAILED;
}
wmsHandler_ = handler;
isAnimationEnabled_ = animationEnabled;
HILOG_DEBUG("%{public}s: WMS handler registered successfully.", __func__);
return ERR_OK;
}
Expand Down Expand Up @@ -7131,6 +7133,11 @@ void AbilityManagerService::InitPrepareTerminateConfig()
isPrepareTerminateEnable_ = true;
}
}

bool AbilityManagerService::GetAnimationFlag()
{
return isAnimationEnabled_;
}
#endif

int AbilityManagerService::CheckCallServicePermission(const AbilityRequest &abilityRequest)
Expand Down
3 changes: 2 additions & 1 deletion services/abilitymgr/src/ability_manager_stub.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2252,7 +2252,8 @@ int AbilityManagerStub::RegisterWindowManagerServiceHandlerInner(MessageParcel &
HILOG_ERROR("%{public}s read WMS handler failed!", __func__);
return ERR_NULL_OBJECT;
}
return RegisterWindowManagerServiceHandler(handler);
bool animationEnabled = data.ReadBool();
return RegisterWindowManagerServiceHandler(handler, animationEnabled);
}

int AbilityManagerStub::CompleteFirstFrameDrawingInner(MessageParcel &data, MessageParcel &reply)
Expand Down
3 changes: 2 additions & 1 deletion services/abilitymgr/src/mission_list_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2008,7 +2008,8 @@ void MissionListManager::MoveToBackgroundTask(const std::shared_ptr<AbilityRecor
HILOG_INFO("ability:%{public}s.", abilityRecord->GetAbilityInfo().name.c_str());
abilityRecord->SetIsNewWant(false);
if (abilityRecord->lifeCycleStateInfo_.sceneFlag != SCENE_FLAG_KEYGUARD &&
!abilityRecord->IsClearMissionFlag() && !isClose) {
!abilityRecord->IsClearMissionFlag() &&
!(isClose && OHOS::DelayedSingleton<AbilityManagerService>::GetInstance()->GetAnimationFlag())) {
UpdateMissionSnapshot(abilityRecord);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,8 @@ class MockServiceAbilityManagerService : public AbilityManagerStub,
return 0;
}

int RegisterWindowManagerServiceHandler(const sptr<IWindowManagerServiceHandler>& handler) override
int RegisterWindowManagerServiceHandler(const sptr<IWindowManagerServiceHandler>& handler,
bool animationEnabled = true) override
{
return 0;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,8 @@ class MockAbilityManagerService : public AbilityManagerStub {
return 0;
}

int RegisterWindowManagerServiceHandler(const sptr<IWindowManagerServiceHandler>& handler) override
int RegisterWindowManagerServiceHandler(const sptr<IWindowManagerServiceHandler>& handler,
bool animationEnabled = true) override
{
return 0;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,8 @@ int MockAbilityDelegatorStub::SetMissionIcon(
return 0;
}

int MockAbilityDelegatorStub::RegisterWindowManagerServiceHandler(const sptr<IWindowManagerServiceHandler>& handler)
int MockAbilityDelegatorStub::RegisterWindowManagerServiceHandler(const sptr<IWindowManagerServiceHandler>& handler,
bool animationEnabled)
{
return 0;
}
Expand All @@ -470,7 +471,8 @@ int MockAbilityDelegatorStub2::SetMissionIcon(
return 0;
}

int MockAbilityDelegatorStub2::RegisterWindowManagerServiceHandler(const sptr<IWindowManagerServiceHandler>& handler)
int MockAbilityDelegatorStub2::RegisterWindowManagerServiceHandler(const sptr<IWindowManagerServiceHandler>& handler,
bool animationEnabled)
{
return 0;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,8 @@ class MockAbilityDelegatorStub : public AbilityManagerStub {
MOCK_METHOD2(SetMissionLabel, int(const sptr<IRemoteObject>& token, const std::string& label));
int SetMissionIcon(
const sptr<IRemoteObject>& token, const std::shared_ptr<OHOS::Media::PixelMap>& icon) override;
int RegisterWindowManagerServiceHandler(const sptr<IWindowManagerServiceHandler>& handler);
int RegisterWindowManagerServiceHandler(const sptr<IWindowManagerServiceHandler>& handler,
bool animationEnabled = true);
void CompleteFirstFrameDrawing(const sptr<IRemoteObject>& abilityToken) override {}
#endif
MOCK_METHOD2(IsValidMissionIds, int32_t(const std::vector<int32_t>&, std::vector<MissionVaildResult>&));
Expand Down Expand Up @@ -322,7 +323,8 @@ class MockAbilityDelegatorStub2 : public AbilityManagerStub {
MOCK_METHOD2(SetMissionLabel, int(const sptr<IRemoteObject>& token, const std::string& label));
int SetMissionIcon(
const sptr<IRemoteObject>& token, const std::shared_ptr<OHOS::Media::PixelMap>& icon) override;
int RegisterWindowManagerServiceHandler(const sptr<IWindowManagerServiceHandler>& handler);
int RegisterWindowManagerServiceHandler(const sptr<IWindowManagerServiceHandler>& handler,
bool animationEnabled = true);
void CompleteFirstFrameDrawing(const sptr<IRemoteObject>& abilityToken) override {}
#endif
MOCK_METHOD2(IsValidMissionIds, int32_t(const std::vector<int32_t>&, std::vector<MissionVaildResult>&));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,8 @@ class MockAbilityManagerService : public AbilityManagerStub,
return 0;
}

int RegisterWindowManagerServiceHandler(const sptr<IWindowManagerServiceHandler>& handler) override
int RegisterWindowManagerServiceHandler(const sptr<IWindowManagerServiceHandler>& handler,
bool animationEnabled = true) override
{
return 0;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,8 @@ class MockServiceAbilityManagerService : public AbilityManagerStub,
return 0;
}

int RegisterWindowManagerServiceHandler(const sptr<IWindowManagerServiceHandler>& handler) override
int RegisterWindowManagerServiceHandler(const sptr<IWindowManagerServiceHandler>& handler,
bool animationEnabled = true) override
{
return 0;
}
Expand Down
3 changes: 2 additions & 1 deletion test/moduletest/mock/include/mock_ability_mgr_service.h
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,8 @@ class MockAbilityMgrService : public AbilityManagerStub {
return 0;
}

virtual int RegisterWindowManagerServiceHandler(const sptr<IWindowManagerServiceHandler>& handler) override
virtual int RegisterWindowManagerServiceHandler(const sptr<IWindowManagerServiceHandler>& handler,
bool animationEnabled = true) override
{
return 0;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,8 @@ class AbilityManagerStubTestMock : public IRemoteStub<IAbilityManager> {
return 0;
}

int RegisterWindowManagerServiceHandler(const sptr<IWindowManagerServiceHandler>& handler) override
int RegisterWindowManagerServiceHandler(const sptr<IWindowManagerServiceHandler>& handler,
bool animationEnabled = true) override
{
return 0;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1578,7 +1578,7 @@ HWTEST_F(AbilityManagerProxyTest, AbilityManagerProxy_SetMissionLabel_001, TestS
HWTEST_F(AbilityManagerProxyTest, AbilityManagerProxy_RegisterWindowManagerServiceHandler_001, TestSize.Level1)
{
sptr<IWindowManagerServiceHandler> handler = nullptr;
auto res = proxy_->RegisterWindowManagerServiceHandler(handler);
auto res = proxy_->RegisterWindowManagerServiceHandler(handler, true);
EXPECT_EQ(res, INNER_ERR);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,8 @@ class AbilityManagerStubMock : public IRemoteStub<IAbilityManager> {
return 0;
}

int RegisterWindowManagerServiceHandler(const sptr<IWindowManagerServiceHandler>& handler) override
int RegisterWindowManagerServiceHandler(const sptr<IWindowManagerServiceHandler>& handler,
bool animationEnabled = true) override
{
return 0;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,8 @@ class AbilityManagerStubImplMock : public AbilityManagerStub {
return 0;
}

int RegisterWindowManagerServiceHandler(const sptr<IWindowManagerServiceHandler>& handler) override
int RegisterWindowManagerServiceHandler(const sptr<IWindowManagerServiceHandler>& handler,
bool animationEnabled = true) override
{
return 0;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,8 @@ class AbilityManagerStubTestMock : public IRemoteStub<IAbilityManager> {
return 0;
}

int RegisterWindowManagerServiceHandler(const sptr<IWindowManagerServiceHandler>& handler) override
int RegisterWindowManagerServiceHandler(const sptr<IWindowManagerServiceHandler>& handler,
bool animationEnabled = true) override
{
return 0;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,8 @@ class AbilityManagerStubTestMock : public IRemoteStub<IAbilityManager> {
return 0;
}

int RegisterWindowManagerServiceHandler(const sptr<IWindowManagerServiceHandler>& handler) override
int RegisterWindowManagerServiceHandler(const sptr<IWindowManagerServiceHandler>& handler,
bool animationEnabled = true) override
{
return 0;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,8 @@ class MockAbilityManagerService : public AbilityManagerStub,
return 0;
}

int RegisterWindowManagerServiceHandler(const sptr<IWindowManagerServiceHandler>& handler) override
int RegisterWindowManagerServiceHandler(const sptr<IWindowManagerServiceHandler>& handler,
bool animationEnabled = true) override
{
return 0;
}
Expand Down
3 changes: 2 additions & 1 deletion tools/test/mock/mock_ability_manager_stub.h
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,8 @@ class MockAbilityManagerStub : public AbilityManagerStub {
return 0;
}

int RegisterWindowManagerServiceHandler(const sptr<IWindowManagerServiceHandler>& handler) override
int RegisterWindowManagerServiceHandler(const sptr<IWindowManagerServiceHandler>& handler,
bool animationEnabled = true) override
{
return 0;
}
Expand Down

0 comments on commit 6c7d010

Please sign in to comment.