mirror of
https://gitee.com/openharmony/ability_ability_runtime
synced 2024-12-04 13:37:29 +00:00
commit
374a2a4cba
@ -345,7 +345,7 @@ public:
|
||||
* @param isColdStart the session info of the ability is or not cold start.
|
||||
* @return Returns ERR_OK on success, others on failure.
|
||||
*/
|
||||
ErrCode StartUIAbilityBySCB(sptr<SessionInfo> sessionInfo, bool &isColdStart);
|
||||
ErrCode StartUIAbilityBySCB(sptr<SessionInfo> sessionInfo, bool &isColdStart, uint32_t sceneFlag = 0);
|
||||
|
||||
/**
|
||||
* Stop extension ability with want, send want to ability manager service.
|
||||
@ -465,7 +465,7 @@ public:
|
||||
* @param fromUser, Whether form user.
|
||||
* @return Returns ERR_OK on success, others on failure.
|
||||
*/
|
||||
ErrCode MinimizeUIAbilityBySCB(sptr<SessionInfo> sessionInfo, bool fromUser = false);
|
||||
ErrCode MinimizeUIAbilityBySCB(sptr<SessionInfo> sessionInfo, bool fromUser = false, uint32_t sceneFlag = 0);
|
||||
|
||||
/**
|
||||
* ConnectAbility, connect session with service ability.
|
||||
|
@ -385,7 +385,7 @@ public:
|
||||
* @param isColdStart the session info of the ability is or not cold start.
|
||||
* @return Returns ERR_OK on success, others on failure.
|
||||
*/
|
||||
virtual int StartUIAbilityBySCB(sptr<SessionInfo> sessionInfo, bool &isColdStart)
|
||||
virtual int StartUIAbilityBySCB(sptr<SessionInfo> sessionInfo, bool &isColdStart, uint32_t sceneFlag = 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@ -555,7 +555,8 @@ public:
|
||||
* @param fromUser, Whether form user.
|
||||
* @return Returns ERR_OK on success, others on failure.
|
||||
*/
|
||||
virtual int MinimizeUIAbilityBySCB(const sptr<SessionInfo> &sessionInfo, bool fromUser = false)
|
||||
virtual int MinimizeUIAbilityBySCB(const sptr<SessionInfo> &sessionInfo, bool fromUser = false,
|
||||
uint32_t sceneFlag = 0)
|
||||
{
|
||||
return 0;
|
||||
};
|
||||
|
@ -288,7 +288,7 @@ public:
|
||||
* @param isColdStart the session info of the ability is or not cold start.
|
||||
* @return Returns ERR_OK on success, others on failure.
|
||||
*/
|
||||
virtual int StartUIAbilityBySCB(sptr<SessionInfo> sessionInfo, bool &isColdStart) override;
|
||||
virtual int StartUIAbilityBySCB(sptr<SessionInfo> sessionInfo, bool &isColdStart, uint32_t sceneFlag = 0) override;
|
||||
|
||||
/**
|
||||
* Stop extension ability with want, send want to ability manager service.
|
||||
@ -409,7 +409,8 @@ public:
|
||||
* @param fromUser, Whether form user.
|
||||
* @return Returns ERR_OK on success, others on failure.
|
||||
*/
|
||||
virtual int MinimizeUIAbilityBySCB(const sptr<SessionInfo> &sessionInfo, bool fromUser = false) override;
|
||||
virtual int MinimizeUIAbilityBySCB(const sptr<SessionInfo> &sessionInfo, bool fromUser = false,
|
||||
uint32_t sceneFlag = 0) override;
|
||||
|
||||
/**
|
||||
* ConnectAbility, connect session with service ability.
|
||||
|
@ -428,7 +428,7 @@ public:
|
||||
* @param isColdStart the session info of the ability is or not cold start.
|
||||
* @return Returns ERR_OK on success, others on failure.
|
||||
*/
|
||||
virtual int StartUIAbilityBySCB(sptr<SessionInfo> sessionInfo, bool &isColdStart) override;
|
||||
virtual int StartUIAbilityBySCB(sptr<SessionInfo> sessionInfo, bool &isColdStart, uint32_t sceneFlag = 0) override;
|
||||
|
||||
/**
|
||||
* Stop extension ability with want, send want to ability manager service.
|
||||
@ -550,7 +550,8 @@ public:
|
||||
* @param fromUser, Whether form user.
|
||||
* @return Returns ERR_OK on success, others on failure.
|
||||
*/
|
||||
virtual int MinimizeUIAbilityBySCB(const sptr<SessionInfo> &sessionInfo, bool fromUser = false) override;
|
||||
virtual int MinimizeUIAbilityBySCB(const sptr<SessionInfo> &sessionInfo, bool fromUser = false,
|
||||
uint32_t sceneFlag = 0) override;
|
||||
|
||||
/**
|
||||
* ConnectAbility, connect session with service ability.
|
||||
@ -1865,9 +1866,9 @@ private:
|
||||
|
||||
int StartRemoteAbility(const Want &want, int requestCode, int32_t validUserId,
|
||||
const sptr<IRemoteObject> &callerToken);
|
||||
int StartUIAbilityBySCBDefault(sptr<SessionInfo> sessionInfo, bool &isColdStart);
|
||||
int StartUIAbilityByPreInstallInner(sptr<SessionInfo> sessionInfo,
|
||||
uint32_t specifyTokenId, bool &isColdStart);
|
||||
int StartUIAbilityBySCBDefault(sptr<SessionInfo> sessionInfo, uint32_t sceneFlag, bool &isColdStart);
|
||||
int StartUIAbilityByPreInstallInner(sptr<SessionInfo> sessionInfo, uint32_t specifyTokenId,
|
||||
uint32_t sceneFlag, bool &isColdStart);
|
||||
int32_t PreStartInner(const FreeInstallInfo& taskInfo);
|
||||
void RemovePreStartSession(const std::string& sessionId);
|
||||
|
||||
|
@ -985,6 +985,7 @@ public:
|
||||
void SetSessionInfo(sptr<SessionInfo> sessionInfo);
|
||||
void UpdateSessionInfo(sptr<IRemoteObject> sessionToken);
|
||||
void SetMinimizeReason(bool fromUser);
|
||||
void SetSceneFlag(uint32_t sceneFlag);
|
||||
bool IsMinimizeFromUser() const;
|
||||
void SetClearMissionFlag(bool clearMissionFlag);
|
||||
bool IsClearMissionFlag();
|
||||
|
@ -66,7 +66,8 @@ public:
|
||||
* @param isColdStart the session info of the ability is or not cold start.
|
||||
* @return Returns ERR_OK on success, others on failure.
|
||||
*/
|
||||
int StartUIAbility(AbilityRequest &abilityRequest, sptr<SessionInfo> sessionInfo, bool &isColdStart);
|
||||
int StartUIAbility(AbilityRequest &abilityRequest, sptr<SessionInfo> sessionInfo, uint32_t sceneFlag,
|
||||
bool &isColdStart);
|
||||
|
||||
/**
|
||||
* @brief execute after the ability schedule the lifecycle
|
||||
@ -129,7 +130,7 @@ public:
|
||||
* @param fromUser, Whether form user.
|
||||
* @return Returns ERR_OK on success, others on failure.
|
||||
*/
|
||||
int MinimizeUIAbility(const std::shared_ptr<AbilityRecord> &abilityRecord, bool fromUser = false);
|
||||
int MinimizeUIAbility(const std::shared_ptr<AbilityRecord> &abilityRecord, bool fromUser, uint32_t sceneFlag);
|
||||
|
||||
/**
|
||||
* GetUIAbilityRecordBySessionInfo.
|
||||
|
@ -338,7 +338,7 @@ ErrCode AbilityManagerClient::StartUIExtensionAbility(sptr<SessionInfo> extensio
|
||||
return abms->StartUIExtensionAbility(extensionSessionInfo, userId);
|
||||
}
|
||||
|
||||
ErrCode AbilityManagerClient::StartUIAbilityBySCB(sptr<SessionInfo> sessionInfo, bool &isColdStart)
|
||||
ErrCode AbilityManagerClient::StartUIAbilityBySCB(sptr<SessionInfo> sessionInfo, bool &isColdStart, uint32_t sceneFlag)
|
||||
{
|
||||
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
|
||||
if (sessionInfo == nullptr) {
|
||||
@ -349,7 +349,7 @@ ErrCode AbilityManagerClient::StartUIAbilityBySCB(sptr<SessionInfo> sessionInfo,
|
||||
CHECK_POINTER_RETURN_NOT_CONNECTED(abms);
|
||||
TAG_LOGI(AAFwkTag::ABILITYMGR, "Start UIAbility by SCB: %{public}s.",
|
||||
sessionInfo->want.GetElement().GetURI().c_str());
|
||||
return abms->StartUIAbilityBySCB(sessionInfo, isColdStart);
|
||||
return abms->StartUIAbilityBySCB(sessionInfo, isColdStart, sceneFlag);
|
||||
}
|
||||
|
||||
ErrCode AbilityManagerClient::StopExtensionAbility(const Want &want, sptr<IRemoteObject> callerToken,
|
||||
@ -463,7 +463,7 @@ ErrCode AbilityManagerClient::MinimizeUIExtensionAbility(sptr<SessionInfo> exten
|
||||
return abms->MinimizeUIExtensionAbility(extensionSessionInfo, fromUser);
|
||||
}
|
||||
|
||||
ErrCode AbilityManagerClient::MinimizeUIAbilityBySCB(sptr<SessionInfo> sessionInfo, bool fromUser)
|
||||
ErrCode AbilityManagerClient::MinimizeUIAbilityBySCB(sptr<SessionInfo> sessionInfo, bool fromUser, uint32_t sceneFlag)
|
||||
{
|
||||
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
|
||||
if (sessionInfo == nullptr) {
|
||||
@ -474,7 +474,7 @@ ErrCode AbilityManagerClient::MinimizeUIAbilityBySCB(sptr<SessionInfo> sessionIn
|
||||
CHECK_POINTER_RETURN_NOT_CONNECTED(abms);
|
||||
TAG_LOGI(AAFwkTag::ABILITYMGR, "Minimize UIAbility by SCB: %{public}s",
|
||||
sessionInfo->want.GetElement().GetURI().c_str());
|
||||
return abms->MinimizeUIAbilityBySCB(sessionInfo, fromUser);
|
||||
return abms->MinimizeUIAbilityBySCB(sessionInfo, fromUser, sceneFlag);
|
||||
}
|
||||
|
||||
ErrCode AbilityManagerClient::ConnectAbility(const Want &want, sptr<IAbilityConnection> connect, int32_t userId)
|
||||
|
@ -753,7 +753,7 @@ int AbilityManagerProxy::StartUIExtensionAbility(const sptr<SessionInfo> &extens
|
||||
return reply.ReadInt32();
|
||||
}
|
||||
|
||||
int AbilityManagerProxy::StartUIAbilityBySCB(sptr<SessionInfo> sessionInfo, bool &isColdStart)
|
||||
int AbilityManagerProxy::StartUIAbilityBySCB(sptr<SessionInfo> sessionInfo, bool &isColdStart, uint32_t sceneFlag)
|
||||
{
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
@ -772,6 +772,10 @@ int AbilityManagerProxy::StartUIAbilityBySCB(sptr<SessionInfo> sessionInfo, bool
|
||||
return INNER_ERR;
|
||||
}
|
||||
}
|
||||
if (!data.WriteUint32(sceneFlag)) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "sceneFlag write failed.");
|
||||
return INNER_ERR;
|
||||
}
|
||||
auto error = SendRequest(AbilityManagerInterfaceCode::START_UI_ABILITY_BY_SCB, data, reply, option);
|
||||
if (error != NO_ERROR) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "Send request error: %{public}d", error);
|
||||
@ -1562,7 +1566,7 @@ int AbilityManagerProxy::MinimizeUIExtensionAbility(const sptr<SessionInfo> &ext
|
||||
return reply.ReadInt32();
|
||||
}
|
||||
|
||||
int AbilityManagerProxy::MinimizeUIAbilityBySCB(const sptr<SessionInfo> &sessionInfo, bool fromUser)
|
||||
int AbilityManagerProxy::MinimizeUIAbilityBySCB(const sptr<SessionInfo> &sessionInfo, bool fromUser, uint32_t sceneFlag)
|
||||
{
|
||||
int error;
|
||||
MessageParcel data;
|
||||
@ -1587,6 +1591,10 @@ int AbilityManagerProxy::MinimizeUIAbilityBySCB(const sptr<SessionInfo> &session
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "fromUser write failed.");
|
||||
return INNER_ERR;
|
||||
}
|
||||
if (!data.WriteUint32(sceneFlag)) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "sceneFlag write failed.");
|
||||
return INNER_ERR;
|
||||
}
|
||||
|
||||
error = SendRequest(AbilityManagerInterfaceCode::MINIMIZE_UI_ABILITY_BY_SCB, data, reply, option);
|
||||
if (error != NO_ERROR) {
|
||||
|
@ -1943,10 +1943,10 @@ int32_t AbilityManagerService::OpenAtomicService(AAFwk::Want& want, const StartO
|
||||
return StartUIAbilityForOptionWrap(want, options, callerToken, false, userId, requestCode);
|
||||
}
|
||||
|
||||
int AbilityManagerService::StartUIAbilityBySCB(sptr<SessionInfo> sessionInfo, bool &isColdStart)
|
||||
int AbilityManagerService::StartUIAbilityBySCB(sptr<SessionInfo> sessionInfo, bool &isColdStart, uint32_t sceneFlag)
|
||||
{
|
||||
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
|
||||
TAG_LOGD(AAFwkTag::ABILITYMGR, "Call.");
|
||||
TAG_LOGI(AAFwkTag::ABILITYMGR, "Call, sceneFlag: %{public}u", sceneFlag);
|
||||
if (sessionInfo == nullptr || sessionInfo->sessionToken == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "sessionInfo is nullptr");
|
||||
return ERR_INVALID_VALUE;
|
||||
@ -1958,12 +1958,12 @@ int AbilityManagerService::StartUIAbilityBySCB(sptr<SessionInfo> sessionInfo, bo
|
||||
}
|
||||
|
||||
if (!(sessionInfo->want).HasParameter(KEY_SESSION_ID)) {
|
||||
return StartUIAbilityBySCBDefault(sessionInfo, isColdStart);
|
||||
return StartUIAbilityBySCBDefault(sessionInfo, sceneFlag, isColdStart);
|
||||
}
|
||||
|
||||
std::string sessionId = (sessionInfo->want).GetStringParam(KEY_SESSION_ID);
|
||||
if (sessionId.empty()) {
|
||||
return StartUIAbilityBySCBDefault(sessionInfo, isColdStart);
|
||||
return StartUIAbilityBySCBDefault(sessionInfo, sceneFlag, isColdStart);
|
||||
}
|
||||
|
||||
TAG_LOGI(AAFwkTag::ABILITYMGR, "sessionId=%{public}s", sessionId.c_str());
|
||||
@ -1988,7 +1988,7 @@ int AbilityManagerService::StartUIAbilityBySCB(sptr<SessionInfo> sessionInfo, bo
|
||||
}
|
||||
(sessionInfo->want).SetElement(launchWant.GetElement());
|
||||
}
|
||||
return StartUIAbilityBySCBDefault(sessionInfo, isColdStart);
|
||||
return StartUIAbilityBySCBDefault(sessionInfo, sceneFlag, isColdStart);
|
||||
}
|
||||
|
||||
if (taskInfo.isFreeInstallFinished) {
|
||||
@ -1999,7 +1999,7 @@ int AbilityManagerService::StartUIAbilityBySCB(sptr<SessionInfo> sessionInfo, bo
|
||||
return taskInfo.resultCode;
|
||||
}
|
||||
TAG_LOGI(AAFwkTag::ABILITYMGR, "free install succeeds");
|
||||
auto err = StartUIAbilityByPreInstallInner(sessionInfo, taskInfo.specifyTokenId, isColdStart);
|
||||
auto err = StartUIAbilityByPreInstallInner(sessionInfo, taskInfo.specifyTokenId, sceneFlag, isColdStart);
|
||||
if (err != ERR_OK) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "StartUIAbilityByPreInstallInner failed.");
|
||||
}
|
||||
@ -2018,7 +2018,8 @@ int AbilityManagerService::StartUIAbilityBySCB(sptr<SessionInfo> sessionInfo, bo
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
int AbilityManagerService::StartUIAbilityBySCBDefault(sptr<SessionInfo> sessionInfo, bool &isColdStart)
|
||||
int AbilityManagerService::StartUIAbilityBySCBDefault(sptr<SessionInfo> sessionInfo, uint32_t sceneFlag,
|
||||
bool &isColdStart)
|
||||
{
|
||||
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
|
||||
TAG_LOGD(AAFwkTag::ABILITYMGR, "Call.");
|
||||
@ -2121,7 +2122,7 @@ int AbilityManagerService::StartUIAbilityBySCBDefault(sptr<SessionInfo> sessionI
|
||||
CHECK_POINTER_AND_RETURN(uiAbilityManager, ERR_INVALID_VALUE);
|
||||
// here we don't need want param "IS_CALL_BY_SCB" any more, remove it.
|
||||
(sessionInfo->want).RemoveParam(IS_CALL_BY_SCB);
|
||||
return uiAbilityManager->StartUIAbility(abilityRequest, sessionInfo, isColdStart);
|
||||
return uiAbilityManager->StartUIAbility(abilityRequest, sessionInfo, sceneFlag, isColdStart);
|
||||
}
|
||||
|
||||
bool AbilityManagerService::CheckCallingTokenId(const std::string &bundleName, int32_t userId, int32_t appIndex)
|
||||
@ -3657,10 +3658,11 @@ int AbilityManagerService::MinimizeUIExtensionAbility(const sptr<SessionInfo> &e
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
int AbilityManagerService::MinimizeUIAbilityBySCB(const sptr<SessionInfo> &sessionInfo, bool fromUser)
|
||||
int AbilityManagerService::MinimizeUIAbilityBySCB(const sptr<SessionInfo> &sessionInfo, bool fromUser,
|
||||
uint32_t sceneFlag)
|
||||
{
|
||||
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
|
||||
TAG_LOGD(AAFwkTag::ABILITYMGR, "call");
|
||||
TAG_LOGI(AAFwkTag::ABILITYMGR, "Called, sceneFlag: %{public}u", sceneFlag);
|
||||
if (sessionInfo == nullptr || sessionInfo->sessionToken == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "sessionInfo is nullptr");
|
||||
return ERR_INVALID_VALUE;
|
||||
@ -3678,8 +3680,7 @@ int AbilityManagerService::MinimizeUIAbilityBySCB(const sptr<SessionInfo> &sessi
|
||||
if (!IsAbilityControllerForeground(abilityRecord->GetAbilityInfo().bundleName)) {
|
||||
return ERR_WOULD_BLOCK;
|
||||
}
|
||||
|
||||
return uiAbilityManager->MinimizeUIAbility(abilityRecord, fromUser);
|
||||
return uiAbilityManager->MinimizeUIAbility(abilityRecord, fromUser, sceneFlag);
|
||||
}
|
||||
|
||||
int AbilityManagerService::ConnectAbility(
|
||||
@ -11456,7 +11457,7 @@ int32_t AbilityManagerService::StartUIAbilityByPreInstall(const FreeInstallInfo
|
||||
|
||||
int errCode = ERR_OK;
|
||||
bool isColdStart = true;
|
||||
if ((errCode = StartUIAbilityByPreInstallInner(sessionInfo, taskInfo.specifyTokenId, isColdStart)) != ERR_OK) {
|
||||
if ((errCode = StartUIAbilityByPreInstallInner(sessionInfo, taskInfo.specifyTokenId, 0, isColdStart)) != ERR_OK) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "StartUIAbilityByPreInstallInner failed,errCode=%{public}d.", errCode);
|
||||
}
|
||||
RemovePreStartSession(sessionId);
|
||||
@ -11464,8 +11465,8 @@ int32_t AbilityManagerService::StartUIAbilityByPreInstall(const FreeInstallInfo
|
||||
}
|
||||
|
||||
// StartUIAbilityByPreInstallInner is called when free install task is already finished
|
||||
int AbilityManagerService::StartUIAbilityByPreInstallInner(sptr<SessionInfo> sessionInfo,
|
||||
uint32_t specifyTokenId, bool &isColdStart)
|
||||
int AbilityManagerService::StartUIAbilityByPreInstallInner(sptr<SessionInfo> sessionInfo, uint32_t specifyTokenId,
|
||||
uint32_t sceneFlag, bool &isColdStart)
|
||||
{
|
||||
TAG_LOGI(AAFwkTag::ABILITYMGR, "called");
|
||||
auto callerToken = sessionInfo->callerToken;
|
||||
@ -11589,7 +11590,7 @@ int AbilityManagerService::StartUIAbilityByPreInstallInner(sptr<SessionInfo> ses
|
||||
auto uiAbilityManager = GetCurrentUIAbilityManager();
|
||||
CHECK_POINTER_AND_RETURN(uiAbilityManager, ERR_INVALID_VALUE);
|
||||
|
||||
return uiAbilityManager->StartUIAbility(abilityRequest, sessionInfo, isColdStart);
|
||||
return uiAbilityManager->StartUIAbility(abilityRequest, sessionInfo, sceneFlag, isColdStart);
|
||||
}
|
||||
|
||||
void AbilityManagerService::NotifySCBToHandleAtomicServiceException(const std::string& sessionId, int32_t errCode,
|
||||
|
@ -1033,7 +1033,8 @@ int AbilityManagerStub::MinimizeUIAbilityBySCBInner(MessageParcel &data, Message
|
||||
sessionInfo = data.ReadParcelable<SessionInfo>();
|
||||
}
|
||||
bool fromUser = data.ReadBool();
|
||||
int32_t result = MinimizeUIAbilityBySCB(sessionInfo, fromUser);
|
||||
uint32_t sceneFlag = data.ReadUint32();
|
||||
int32_t result = MinimizeUIAbilityBySCB(sessionInfo, fromUser, sceneFlag);
|
||||
reply.WriteInt32(result);
|
||||
return NO_ERROR;
|
||||
}
|
||||
@ -2260,8 +2261,9 @@ int AbilityManagerStub::StartUIAbilityBySCBInner(MessageParcel &data, MessagePar
|
||||
if (data.ReadBool()) {
|
||||
sessionInfo = data.ReadParcelable<SessionInfo>();
|
||||
}
|
||||
uint32_t sceneFlag = data.ReadUint32();
|
||||
bool isColdStart = false;
|
||||
int32_t result = StartUIAbilityBySCB(sessionInfo, isColdStart);
|
||||
int32_t result = StartUIAbilityBySCB(sessionInfo, isColdStart, sceneFlag);
|
||||
reply.WriteBool(isColdStart);
|
||||
reply.WriteInt32(result);
|
||||
return NO_ERROR;
|
||||
|
@ -2881,6 +2881,11 @@ void AbilityRecord::SetMinimizeReason(bool fromUser)
|
||||
minimizeReason_ = fromUser;
|
||||
}
|
||||
|
||||
void AbilityRecord::SetSceneFlag(uint32_t sceneFlag)
|
||||
{
|
||||
lifeCycleStateInfo_.sceneFlag = sceneFlag;
|
||||
}
|
||||
|
||||
void AbilityRecord::SetAppIndex(const int32_t appIndex)
|
||||
{
|
||||
appIndex_ = appIndex;
|
||||
|
@ -72,7 +72,7 @@ auto g_deleteLifecycleEventTask = [](const sptr<Token> &token, FreezeUtil::Timeo
|
||||
UIAbilityLifecycleManager::UIAbilityLifecycleManager(int32_t userId): userId_(userId) {}
|
||||
|
||||
int UIAbilityLifecycleManager::StartUIAbility(AbilityRequest &abilityRequest, sptr<SessionInfo> sessionInfo,
|
||||
bool &isColdStart)
|
||||
uint32_t sceneFlag, bool &isColdStart)
|
||||
{
|
||||
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
|
||||
std::lock_guard<ffrt::mutex> guard(sessionLock_);
|
||||
@ -125,7 +125,7 @@ int UIAbilityLifecycleManager::StartUIAbility(AbilityRequest &abilityRequest, sp
|
||||
UpdateAbilityRecordLaunchReason(abilityRequest, uiAbilityRecord);
|
||||
NotifyAbilityToken(uiAbilityRecord->GetToken(), abilityRequest);
|
||||
AddCallerRecord(abilityRequest, sessionInfo, uiAbilityRecord);
|
||||
uiAbilityRecord->ProcessForegroundAbility(sessionInfo->callingTokenId);
|
||||
uiAbilityRecord->ProcessForegroundAbility(sessionInfo->callingTokenId, sceneFlag);
|
||||
CheckSpecified(abilityRequest, uiAbilityRecord);
|
||||
SendKeyEvent(abilityRequest);
|
||||
return ERR_OK;
|
||||
@ -276,7 +276,7 @@ void UIAbilityLifecycleManager::OnAbilityRequestDone(const sptr<IRemoteObject> &
|
||||
}
|
||||
std::string element = abilityRecord->GetElementName().GetURI();
|
||||
TAG_LOGD(AAFwkTag::ABILITYMGR, "Ability is %{public}s, start to foreground.", element.c_str());
|
||||
abilityRecord->ForegroundAbility();
|
||||
abilityRecord->ForegroundAbility(abilityRecord->lifeCycleStateInfo_.sceneFlagBak);
|
||||
}
|
||||
}
|
||||
|
||||
@ -744,7 +744,8 @@ int32_t UIAbilityLifecycleManager::NotifySCBToMinimizeUIAbility(const std::share
|
||||
return static_cast<int32_t>(ret);
|
||||
}
|
||||
|
||||
int UIAbilityLifecycleManager::MinimizeUIAbility(const std::shared_ptr<AbilityRecord> &abilityRecord, bool fromUser)
|
||||
int UIAbilityLifecycleManager::MinimizeUIAbility(const std::shared_ptr<AbilityRecord> &abilityRecord, bool fromUser,
|
||||
uint32_t sceneFlag)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::ABILITYMGR, "call");
|
||||
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
|
||||
@ -755,6 +756,7 @@ int UIAbilityLifecycleManager::MinimizeUIAbility(const std::shared_ptr<AbilityRe
|
||||
}
|
||||
TAG_LOGI(AAFwkTag::ABILITYMGR, "abilityInfoName:%{public}s", abilityRecord->GetAbilityInfo().name.c_str());
|
||||
abilityRecord->SetMinimizeReason(fromUser);
|
||||
abilityRecord->SetSceneFlag(sceneFlag);
|
||||
if (abilityRecord->GetPendingState() != AbilityState::INITIAL) {
|
||||
TAG_LOGI(AAFwkTag::ABILITYMGR, "pending state is FOREGROUND or BACKGROUND, dropped.");
|
||||
abilityRecord->SetPendingState(AbilityState::BACKGROUND);
|
||||
@ -767,6 +769,7 @@ int UIAbilityLifecycleManager::MinimizeUIAbility(const std::shared_ptr<AbilityRe
|
||||
}
|
||||
abilityRecord->SetPendingState(AbilityState::BACKGROUND);
|
||||
MoveToBackground(abilityRecord);
|
||||
abilityRecord->SetSceneFlag(0);
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
|
@ -108,8 +108,9 @@ bool DoSomethingInterestingWithMyAPI(const char *data, size_t size)
|
||||
uIAbilityLifecycleManager->SignRestartAppFlag(strParam);
|
||||
AbilityRequest abilityRequest;
|
||||
sptr<SessionInfo> sessionInfo;
|
||||
uint32_t sceneFlag = GetU32Data(data);
|
||||
bool boolParam = *data % ENABLE;
|
||||
uIAbilityLifecycleManager->StartUIAbility(abilityRequest, sessionInfo, boolParam);
|
||||
uIAbilityLifecycleManager->StartUIAbility(abilityRequest, sessionInfo, sceneFlag, boolParam);
|
||||
sptr<IRemoteObject> token = GetFuzzAbilityToken();
|
||||
int intParam = static_cast<int>(GetU32Data(data));
|
||||
AppExecFwk::PacMap saveData;
|
||||
@ -122,7 +123,7 @@ bool DoSomethingInterestingWithMyAPI(const char *data, size_t size)
|
||||
std::shared_ptr<AbilityRecord> abilityRecord;
|
||||
uIAbilityLifecycleManager->NotifySCBToMinimizeUIAbility(abilityRecord, token);
|
||||
std::shared_ptr<AbilityRecord> abilityRecord1;
|
||||
uIAbilityLifecycleManager->MinimizeUIAbility(abilityRecord1, boolParam);
|
||||
uIAbilityLifecycleManager->MinimizeUIAbility(abilityRecord1, boolParam, sceneFlag);
|
||||
sptr<SessionInfo> sessionInfo1;
|
||||
uIAbilityLifecycleManager->GetUIAbilityRecordBySessionInfo(sessionInfo1);
|
||||
Want *want;
|
||||
|
@ -103,7 +103,7 @@ HWTEST_F(UIAbilityLifecycleManagerTest, StartUIAbility_001, TestSize.Level1)
|
||||
auto mgr = std::make_unique<UIAbilityLifecycleManager>();
|
||||
AbilityRequest abilityRequest;
|
||||
bool isColdStart = false;
|
||||
EXPECT_EQ(mgr->StartUIAbility(abilityRequest, nullptr, isColdStart), ERR_INVALID_VALUE);
|
||||
EXPECT_EQ(mgr->StartUIAbility(abilityRequest, nullptr, 0, isColdStart), ERR_INVALID_VALUE);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -119,7 +119,7 @@ HWTEST_F(UIAbilityLifecycleManagerTest, StartUIAbility_002, TestSize.Level1)
|
||||
sptr<SessionInfo> sessionInfo(new SessionInfo());
|
||||
sessionInfo->sessionToken = new Rosen::Session(info);
|
||||
bool isColdStart = false;
|
||||
EXPECT_EQ(mgr->StartUIAbility(abilityRequest, sessionInfo, isColdStart), ERR_OK);
|
||||
EXPECT_EQ(mgr->StartUIAbility(abilityRequest, sessionInfo, 0, isColdStart), ERR_OK);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -139,7 +139,7 @@ HWTEST_F(UIAbilityLifecycleManagerTest, StartUIAbility_003, TestSize.Level1)
|
||||
auto abilityRecord = AbilityRecord::CreateAbilityRecord(abilityRequest);
|
||||
mgr->sessionAbilityMap_.emplace(sessionInfo->persistentId, abilityRecord);
|
||||
bool isColdStart = false;
|
||||
EXPECT_EQ(mgr->StartUIAbility(abilityRequest, sessionInfo, isColdStart), ERR_OK);
|
||||
EXPECT_EQ(mgr->StartUIAbility(abilityRequest, sessionInfo, 0, isColdStart), ERR_OK);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -158,7 +158,7 @@ HWTEST_F(UIAbilityLifecycleManagerTest, StartUIAbility_004, TestSize.Level1)
|
||||
sessionInfo->persistentId = 1;
|
||||
abilityRequest.sessionInfo = sessionInfo;
|
||||
bool isColdStart = false;
|
||||
EXPECT_EQ(mgr->StartUIAbility(abilityRequest, sessionInfo, isColdStart), ERR_OK);
|
||||
EXPECT_EQ(mgr->StartUIAbility(abilityRequest, sessionInfo, 0, isColdStart), ERR_OK);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -179,7 +179,7 @@ HWTEST_F(UIAbilityLifecycleManagerTest, StartUIAbility_005, TestSize.Level1)
|
||||
abilityRecord->SetPendingState(AbilityState::FOREGROUND);
|
||||
mgr->sessionAbilityMap_.emplace(sessionInfo->persistentId, abilityRecord);
|
||||
bool isColdStart = false;
|
||||
EXPECT_EQ(mgr->StartUIAbility(abilityRequest, sessionInfo, isColdStart), ERR_OK);
|
||||
EXPECT_EQ(mgr->StartUIAbility(abilityRequest, sessionInfo, 0, isColdStart), ERR_OK);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -196,7 +196,7 @@ HWTEST_F(UIAbilityLifecycleManagerTest, StartUIAbility_006, TestSize.Level1)
|
||||
sptr<SessionInfo> sessionInfo(new SessionInfo());
|
||||
sessionInfo->sessionToken = new Rosen::Session(info);
|
||||
bool isColdStart = false;
|
||||
EXPECT_EQ(mgr->StartUIAbility(abilityRequest, sessionInfo, isColdStart), ERR_OK);
|
||||
EXPECT_EQ(mgr->StartUIAbility(abilityRequest, sessionInfo, 0, isColdStart), ERR_OK);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -214,7 +214,7 @@ HWTEST_F(UIAbilityLifecycleManagerTest, StartUIAbility_007, TestSize.Level1)
|
||||
sptr<SessionInfo> sessionInfo(new SessionInfo());
|
||||
sessionInfo->sessionToken = new Rosen::Session(info);
|
||||
bool isColdStart = false;
|
||||
EXPECT_EQ(mgr->StartUIAbility(abilityRequest, sessionInfo, isColdStart), ERR_OK);
|
||||
EXPECT_EQ(mgr->StartUIAbility(abilityRequest, sessionInfo, 0, isColdStart), ERR_OK);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -236,7 +236,7 @@ HWTEST_F(UIAbilityLifecycleManagerTest, StartUIAbility_008, TestSize.Level1)
|
||||
std::shared_ptr<AbilityRecord> abilityRecord = AbilityRecord::CreateAbilityRecord(abilityRequest);
|
||||
mgr->sessionAbilityMap_.emplace(2, abilityRecord);
|
||||
bool isColdStart = false;
|
||||
EXPECT_EQ(mgr->StartUIAbility(abilityRequest, sessionInfo, isColdStart), ERR_OK);
|
||||
EXPECT_EQ(mgr->StartUIAbility(abilityRequest, sessionInfo, 0, isColdStart), ERR_OK);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -693,7 +693,7 @@ HWTEST_F(UIAbilityLifecycleManagerTest, HandleForegroundFailed_002, TestSize.Lev
|
||||
HWTEST_F(UIAbilityLifecycleManagerTest, MinimizeUIAbility_001, TestSize.Level1)
|
||||
{
|
||||
auto uiAbilityLifecycleManager = std::make_shared<UIAbilityLifecycleManager>();
|
||||
EXPECT_EQ(uiAbilityLifecycleManager->MinimizeUIAbility(nullptr), ERR_INVALID_VALUE);
|
||||
EXPECT_EQ(uiAbilityLifecycleManager->MinimizeUIAbility(nullptr, false, 0), ERR_INVALID_VALUE);
|
||||
uiAbilityLifecycleManager.reset();
|
||||
}
|
||||
|
||||
@ -707,7 +707,7 @@ HWTEST_F(UIAbilityLifecycleManagerTest, MinimizeUIAbility_002, TestSize.Level1)
|
||||
auto uiAbilityLifecycleManager = std::make_shared<UIAbilityLifecycleManager>();
|
||||
std::shared_ptr<AbilityRecord> abilityRecord = InitAbilityRecord();
|
||||
abilityRecord->currentState_ = AbilityState::BACKGROUND;
|
||||
EXPECT_EQ(uiAbilityLifecycleManager->MinimizeUIAbility(abilityRecord), ERR_OK);
|
||||
EXPECT_EQ(uiAbilityLifecycleManager->MinimizeUIAbility(abilityRecord, false, 0), ERR_OK);
|
||||
uiAbilityLifecycleManager.reset();
|
||||
}
|
||||
|
||||
@ -721,7 +721,7 @@ HWTEST_F(UIAbilityLifecycleManagerTest, MinimizeUIAbility_003, TestSize.Level1)
|
||||
auto uiAbilityLifecycleManager = std::make_shared<UIAbilityLifecycleManager>();
|
||||
std::shared_ptr<AbilityRecord> abilityRecord = InitAbilityRecord();
|
||||
abilityRecord->currentState_ = AbilityState::FOREGROUND;
|
||||
EXPECT_EQ(uiAbilityLifecycleManager->MinimizeUIAbility(abilityRecord), ERR_OK);
|
||||
EXPECT_EQ(uiAbilityLifecycleManager->MinimizeUIAbility(abilityRecord, false, 0), ERR_OK);
|
||||
uiAbilityLifecycleManager.reset();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user