diff --git a/services/abilitymgr/include/ability_record.h b/services/abilitymgr/include/ability_record.h index e78a52d30b1975fbd52bb21ba719737a7cdba15b..0ead20c455bda58080b48a2afaa1db45db01f2ca 100644 --- a/services/abilitymgr/include/ability_record.h +++ b/services/abilitymgr/include/ability_record.h @@ -833,11 +833,6 @@ public: return recordId_; } - inline int64_t GetForegroundingTime() const - { - return foregroundingTime_; - } - void SetPendingState(AbilityState state); AbilityState GetPendingState() const; @@ -934,7 +929,6 @@ private: std::weak_ptr nextAbilityRecord_ = {}; // ability that started by this ability int64_t startTime_ = 0; // records first time of ability start int64_t restartTime_ = 0; // the time of last trying restart - int64_t foregroundingTime_ = 0; // the time of foregrounding to do bool isReady_ = false; // is ability thread attached? bool isWindowAttached_ = false; // Is window of this ability attached? bool isLauncherAbility_ = false; // is launcher? diff --git a/services/abilitymgr/src/ability_record.cpp b/services/abilitymgr/src/ability_record.cpp index 2fd63a5067d84f1fe9ab1e7edf4326aa5c01aac5..0142f3a220f9091baf89005c059af6486d7a9f35 100644 --- a/services/abilitymgr/src/ability_record.cpp +++ b/services/abilitymgr/src/ability_record.cpp @@ -330,7 +330,6 @@ void AbilityRecord::ForegroundAbility(uint32_t sceneFlag) // schedule active after updating AbilityState and sending timeout message to avoid ability async callback // earlier than above actions. SetAbilityStateInner(AbilityState::FOREGROUNDING); - foregroundingTime_ = AbilityUtil::SystemTimeMillis(); lifeCycleStateInfo_.sceneFlag = sceneFlag; lifecycleDeal_->ForegroundNew(want_, lifeCycleStateInfo_, sessionInfo_); lifeCycleStateInfo_.sceneFlag = 0; diff --git a/services/abilitymgr/src/mission_list_manager.cpp b/services/abilitymgr/src/mission_list_manager.cpp index 792a353154233ca932a749281d0fa21a54df42bb..b64b968d4bfa0df26bd6124d09789ec7fceae15e 100644 --- a/services/abilitymgr/src/mission_list_manager.cpp +++ b/services/abilitymgr/src/mission_list_manager.cpp @@ -40,7 +40,6 @@ constexpr char EVENT_KEY_PROCESS_NAME[] = "PROCESS_NAME"; constexpr int32_t SINGLE_MAX_INSTANCE_COUNT = 128; constexpr int32_t MAX_INSTANCE_COUNT = 512; constexpr uint64_t NANO_SECOND_PER_SEC = 1000000000; // ns -constexpr int64_t MAX_FOREGROUNDING_TIME = 60 * 1000; // 1 minute const std::string DMS_SRC_NETWORK_ID = "dmsSrcNetworkId"; const std::string DMS_MISSION_ID = "dmsMissionId"; const int DEFAULT_DMS_MISSION_ID = -1; @@ -132,16 +131,9 @@ int MissionListManager::StartAbility(AbilityRequest &abilityRequest) HILOG_DEBUG("current top: %{public}s, state: %{public}s", element.c_str(), AbilityRecord::ConvertAbilityState(state).c_str()); if (state == FOREGROUNDING) { - auto foregroundingTime = currentTopAbility->GetForegroundingTime(); - auto currentTime = AbilityUtil::SystemTimeMillis(); - if (currentTime - foregroundingTime > MAX_FOREGROUNDING_TIME) { - HILOG_INFO("Top ability:%{public}s is foregrounding and more than one minute.", element.c_str()); - OnTimeOut(AbilityManagerService::FOREGROUND_TIMEOUT_MSG, currentTopAbility->GetAbilityRecordId()); - } else { - HILOG_INFO("Top ability:%{public}s is foregrounding, so enqueue ability for waiting.", element.c_str()); - EnqueueWaitingAbility(abilityRequest); - return START_ABILITY_WAITING; - } + HILOG_INFO("Top ability:%{public}s is foregrounding, so enqueue ability for waiting.", element.c_str()); + EnqueueWaitingAbility(abilityRequest); + return START_ABILITY_WAITING; } } @@ -1159,6 +1151,7 @@ int MissionListManager::DispatchForeground(const std::shared_ptr if (state == AbilityState::FOREGROUND_WINDOW_FREEZED) { HILOG_INFO("Window was freezed."); if (abilityRecord != nullptr) { + abilityRecord->SetAbilityState(AbilityState::BACKGROUND); DelayedSingleton::GetInstance()->MoveToBackground(abilityRecord->GetToken()); selfObj->TerminatePreviousAbility(abilityRecord); }