mirror of
https://github.com/openharmony/ability_ability_runtime.git
synced 2026-08-24 22:21:36 -04:00
Decrease memory usage
Signed-off-by: wangzhen <wangzhen346@huawei.com> Change-Id: I321ed10f295f9ae99a411924c2fabced7b77b121
This commit is contained in:
@@ -67,13 +67,16 @@
|
||||
#include "dialog_session_record.h"
|
||||
#include "implicit_start_processor.h"
|
||||
#include "system_dialog_scheduler.h"
|
||||
#include "window_focus_changed_listener.h"
|
||||
#endif
|
||||
|
||||
namespace OHOS {
|
||||
namespace AbilityRuntime {
|
||||
class IStatusBarDelegate;
|
||||
}
|
||||
namespace Rosen {
|
||||
class FocusChangeInfo;
|
||||
}
|
||||
|
||||
namespace AAFwk {
|
||||
using AutoStartupInfo = AbilityRuntime::AutoStartupInfo;
|
||||
enum class ServiceRunningState { STATE_NOT_START, STATE_RUNNING };
|
||||
@@ -83,6 +86,8 @@ constexpr int32_t INVALID_USER_ID = -1;
|
||||
using OHOS::AppExecFwk::IAbilityController;
|
||||
class PendingWantManager;
|
||||
struct StartAbilityInfo;
|
||||
class WindowFocusChangedListener;
|
||||
|
||||
/**
|
||||
* @class AbilityManagerService
|
||||
* AbilityManagerService provides a facility for managing ability life cycle.
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
#include "cpp/mutex.h"
|
||||
|
||||
#include "ability_running_info.h"
|
||||
#include "foundation/distributedhardware/device_manager/interfaces/inner_kits/native_cpp/include/device_manager.h"
|
||||
#include "mission_list.h"
|
||||
#include "mission_listener_controller.h"
|
||||
#include "mission_info.h"
|
||||
@@ -344,7 +343,7 @@ public:
|
||||
int32_t pid = NO_PID);
|
||||
|
||||
void CallRequestDone(const std::shared_ptr<AbilityRecord> &abilityRecord, const sptr<IRemoteObject> &callStub);
|
||||
|
||||
|
||||
int SetMissionContinueState(const sptr<IRemoteObject> &token, const int32_t missionId,
|
||||
const AAFwk::ContinueState &state);
|
||||
|
||||
@@ -543,13 +542,6 @@ private:
|
||||
std::queue<AbilityRequest> waitingAbilityQueue_;
|
||||
std::shared_ptr<MissionListenerController> listenerController_;
|
||||
bool isPrepareTerminateEnable_ = false;
|
||||
|
||||
class MissionDmInitCallback : public DistributedHardware::DmInitCallback {
|
||||
public:
|
||||
void OnRemoteDied() override;
|
||||
|
||||
static bool isInit_;
|
||||
};
|
||||
};
|
||||
} // namespace AAFwk
|
||||
} // namespace OHOS
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
#include "ability_manager_constants.h"
|
||||
#include "ability_record.h"
|
||||
#include "isession_handler_interface.h"
|
||||
#include "session/host/include/zidl/session_interface.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace AAFwk {
|
||||
@@ -407,7 +406,7 @@ private:
|
||||
std::unordered_map<int32_t, std::shared_ptr<AbilityRecord>> sessionAbilityMap_;
|
||||
std::unordered_map<int64_t, std::shared_ptr<AbilityRecord>> tmpAbilityMap_;
|
||||
std::list<std::shared_ptr<AbilityRecord>> terminateAbilityList_;
|
||||
sptr<Rosen::ISession> rootSceneSession_;
|
||||
sptr<IRemoteObject> rootSceneSession_;
|
||||
std::map<SpecifiedInfo, std::shared_ptr<AbilityRecord>, key_compare> specifiedAbilityMap_;
|
||||
int32_t specifiedRequestId_ = 0;
|
||||
std::map<int32_t, AbilityRequest> specifiedRequestMap_;
|
||||
|
||||
@@ -111,6 +111,7 @@
|
||||
#include "application_anr_listener.h"
|
||||
#include "input_manager.h"
|
||||
#include "ability_first_frame_state_observer_manager.h"
|
||||
#include "window_focus_changed_listener.h"
|
||||
#endif
|
||||
|
||||
#ifdef EFFICIENCY_MANAGER_ENABLE
|
||||
|
||||
@@ -47,28 +47,28 @@ namespace {
|
||||
constexpr uint32_t DELAY_NOTIFY_LABEL_TIME = 30; // 30ms
|
||||
constexpr uint32_t SCENE_FLAG_KEYGUARD = 1;
|
||||
constexpr uint32_t ONLY_ONE_ABILITY = 1;
|
||||
constexpr char EVENT_KEY_UID[] = "UID";
|
||||
constexpr char EVENT_KEY_PID[] = "PID";
|
||||
constexpr char EVENT_KEY_MESSAGE[] = "MSG";
|
||||
constexpr char EVENT_KEY_PACKAGE_NAME[] = "PACKAGE_NAME";
|
||||
constexpr char EVENT_KEY_PROCESS_NAME[] = "PROCESS_NAME";
|
||||
constexpr const char* EVENT_KEY_UID = "UID";
|
||||
constexpr const char* EVENT_KEY_PID = "PID";
|
||||
constexpr const char* EVENT_KEY_MESSAGE = "MSG";
|
||||
constexpr const char* EVENT_KEY_PACKAGE_NAME = "PACKAGE_NAME";
|
||||
constexpr const 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
|
||||
const std::string DMS_SRC_NETWORK_ID = "dmsSrcNetworkId";
|
||||
const std::string DMS_MISSION_ID = "dmsMissionId";
|
||||
const int DEFAULT_DMS_MISSION_ID = -1;
|
||||
constexpr int DEFAULT_DMS_MISSION_ID = -1;
|
||||
#ifdef SUPPORT_ASAN
|
||||
const int KILL_TIMEOUT_MULTIPLE = 45;
|
||||
constexpr int KILL_TIMEOUT_MULTIPLE = 45;
|
||||
#else
|
||||
const int KILL_TIMEOUT_MULTIPLE = 3;
|
||||
constexpr int KILL_TIMEOUT_MULTIPLE = 3;
|
||||
#endif
|
||||
constexpr int32_t PREPARE_TERMINATE_ENABLE_SIZE = 6;
|
||||
const char* PREPARE_TERMINATE_ENABLE_PARAMETER = "persist.sys.prepare_terminate";
|
||||
const int32_t PREPARE_TERMINATE_TIMEOUT_MULTIPLE = 10;
|
||||
constexpr const char* PREPARE_TERMINATE_ENABLE_PARAMETER = "persist.sys.prepare_terminate";
|
||||
constexpr int32_t PREPARE_TERMINATE_TIMEOUT_MULTIPLE = 10;
|
||||
constexpr int32_t TRACE_ATOMIC_SERVICE_ID = 201;
|
||||
const std::string TRACE_ATOMIC_SERVICE = "StartAtomicService";
|
||||
const int GET_TARGET_MISSION_OVER = 200;
|
||||
constexpr int GET_TARGET_MISSION_OVER = 200;
|
||||
std::string GetCurrentTime()
|
||||
{
|
||||
struct timespec tn;
|
||||
@@ -77,11 +77,18 @@ std::string GetCurrentTime()
|
||||
static_cast<uint64_t>(tn.tv_nsec);
|
||||
return std::to_string(uTime);
|
||||
}
|
||||
const std::unordered_map<uint32_t, FreezeUtil::TimeoutState> stateMap = {
|
||||
{ AbilityManagerService::LOAD_TIMEOUT_MSG, FreezeUtil::TimeoutState::LOAD },
|
||||
{ AbilityManagerService::FOREGROUND_TIMEOUT_MSG, FreezeUtil::TimeoutState::FOREGROUND },
|
||||
{ AbilityManagerService::BACKGROUND_TIMEOUT_MSG, FreezeUtil::TimeoutState::BACKGROUND }
|
||||
};
|
||||
|
||||
FreezeUtil::TimeoutState MsgId2State(uint32_t msgId)
|
||||
{
|
||||
if (msgId == AbilityManagerService::LOAD_TIMEOUT_MSG) {
|
||||
return FreezeUtil::TimeoutState::LOAD;
|
||||
} else if (msgId == AbilityManagerService::FOREGROUND_TIMEOUT_MSG) {
|
||||
return FreezeUtil::TimeoutState::FOREGROUND;
|
||||
} else if (msgId == AbilityManagerService::BACKGROUND_TIMEOUT_MSG) {
|
||||
return FreezeUtil::TimeoutState::BACKGROUND;
|
||||
}
|
||||
return FreezeUtil::TimeoutState::UNKNOWN;
|
||||
}
|
||||
|
||||
auto g_deleteLifecycleEventTask = [](const sptr<Token> &token, FreezeUtil::TimeoutState state) {
|
||||
CHECK_POINTER_LOG(token, "token is nullptr.");
|
||||
@@ -425,7 +432,7 @@ int MissionListManager::StartAbilityLocked(const std::shared_ptr<AbilityRecord>
|
||||
if (ret != GET_TARGET_MISSION_OVER) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
// 3. move mission to target list
|
||||
bool isCallerFromLauncher = (callerAbility && callerAbility->IsLauncherAbility());
|
||||
MoveMissionToTargetList(isCallerFromLauncher, targetList, targetMission);
|
||||
@@ -855,7 +862,7 @@ std::shared_ptr<Mission> MissionListManager::GetReusedStandardMission(const Abil
|
||||
if (!missionList) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
auto mission = missionList->GetRecentStandardMission(missionName);
|
||||
if (mission && mission->GetMissionTime() >= missionTime) {
|
||||
missionTime = mission->GetMissionTime();
|
||||
@@ -2093,11 +2100,7 @@ void MissionListManager::PrintTimeOutLog(const std::shared_ptr<AbilityRecord> &a
|
||||
}
|
||||
int typeId = AppExecFwk::AppfreezeManager::TypeAttribute::NORMAL_TIMEOUT;
|
||||
std::string msgContent = "ability:" + ability->GetAbilityInfo().name + " ";
|
||||
FreezeUtil::TimeoutState state = FreezeUtil::TimeoutState::UNKNOWN;
|
||||
auto search = stateMap.find(msgId);
|
||||
if (search != stateMap.end()) {
|
||||
state = search->second;
|
||||
}
|
||||
FreezeUtil::TimeoutState state = MsgId2State(msgId);
|
||||
if (!GetContentAndTypeId(msgId, msgContent, typeId)) {
|
||||
TAG_LOGW(AAFwkTag::ABILITYMGR, "msgId is invalid!");
|
||||
return;
|
||||
@@ -3335,7 +3338,7 @@ std::shared_ptr<AbilityRecord> MissionListManager::GetAbilityRecordByNameFromCur
|
||||
return defaultStandardAbility;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// find in launcherList_
|
||||
if (launcherList_ != nullptr) {
|
||||
return launcherList_->GetAbilityRecordByName(element);
|
||||
@@ -3587,13 +3590,6 @@ bool MissionListManager::IsReachToSingleLimitLocked(const int32_t uid) const
|
||||
return false;
|
||||
}
|
||||
|
||||
bool MissionListManager::MissionDmInitCallback::isInit_ = false;
|
||||
void MissionListManager::MissionDmInitCallback::OnRemoteDied()
|
||||
{
|
||||
isInit_ = false;
|
||||
TAG_LOGW(AAFwkTag::ABILITYMGR, "DeviceManager died.");
|
||||
}
|
||||
|
||||
void MissionListManager::RegisterSnapshotHandler(const sptr<ISnapshotHandler>& handler)
|
||||
{
|
||||
DelayedSingleton<MissionInfoMgr>::GetInstance()->RegisterSnapshotHandler(handler);
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#include "scene_board/status_bar_delegate_manager.h"
|
||||
#include "session_info.h"
|
||||
#include "session_manager_lite.h"
|
||||
#include "session/host/include/zidl/session_interface.h"
|
||||
#include "startup_util.h"
|
||||
#ifdef SUPPORT_GRAPHICS
|
||||
#include "ability_first_frame_state_observer_manager.h"
|
||||
@@ -45,24 +46,31 @@ namespace AAFwk {
|
||||
namespace {
|
||||
constexpr const char* SEPARATOR = ":";
|
||||
constexpr int32_t PREPARE_TERMINATE_TIMEOUT_MULTIPLE = 10;
|
||||
const std::string PARAM_MISSION_AFFINITY_KEY = "ohos.anco.param.missionAffinity";
|
||||
const std::string DMS_SRC_NETWORK_ID = "dmsSrcNetworkId";
|
||||
const std::string DMS_MISSION_ID = "dmsMissionId";
|
||||
const int DEFAULT_DMS_MISSION_ID = -1;
|
||||
const std::string PARAM_SPECIFIED_PROCESS_FLAG = "ohoSpecifiedProcessFlag";
|
||||
const std::string DMS_PROCESS_NAME = "distributedsched";
|
||||
const std::string DMS_PERSISTENT_ID = "ohos.dms.persistentId";
|
||||
constexpr const char* PARAM_MISSION_AFFINITY_KEY = "ohos.anco.param.missionAffinity";
|
||||
constexpr const char* DMS_SRC_NETWORK_ID = "dmsSrcNetworkId";
|
||||
constexpr const char* DMS_MISSION_ID = "dmsMissionId";
|
||||
constexpr int DEFAULT_DMS_MISSION_ID = -1;
|
||||
constexpr const char* PARAM_SPECIFIED_PROCESS_FLAG = "ohoSpecifiedProcessFlag";
|
||||
constexpr const char* DMS_PROCESS_NAME = "distributedsched";
|
||||
constexpr const char* DMS_PERSISTENT_ID = "ohos.dms.persistentId";
|
||||
#ifdef SUPPORT_ASAN
|
||||
const int KILL_TIMEOUT_MULTIPLE = 45;
|
||||
constexpr int KILL_TIMEOUT_MULTIPLE = 45;
|
||||
#else
|
||||
const int KILL_TIMEOUT_MULTIPLE = 3;
|
||||
constexpr int KILL_TIMEOUT_MULTIPLE = 3;
|
||||
#endif
|
||||
constexpr int32_t DEFAULT_USER_ID = 0;
|
||||
const std::unordered_map<uint32_t, FreezeUtil::TimeoutState> stateMap = {
|
||||
{ AbilityManagerService::LOAD_TIMEOUT_MSG, FreezeUtil::TimeoutState::LOAD },
|
||||
{ AbilityManagerService::FOREGROUND_TIMEOUT_MSG, FreezeUtil::TimeoutState::FOREGROUND },
|
||||
{ AbilityManagerService::BACKGROUND_TIMEOUT_MSG, FreezeUtil::TimeoutState::BACKGROUND }
|
||||
};
|
||||
|
||||
FreezeUtil::TimeoutState MsgId2State(uint32_t msgId)
|
||||
{
|
||||
if (msgId == AbilityManagerService::LOAD_TIMEOUT_MSG) {
|
||||
return FreezeUtil::TimeoutState::LOAD;
|
||||
} else if (msgId == AbilityManagerService::FOREGROUND_TIMEOUT_MSG) {
|
||||
return FreezeUtil::TimeoutState::FOREGROUND;
|
||||
} else if (msgId == AbilityManagerService::BACKGROUND_TIMEOUT_MSG) {
|
||||
return FreezeUtil::TimeoutState::BACKGROUND;
|
||||
}
|
||||
return FreezeUtil::TimeoutState::UNKNOWN;
|
||||
}
|
||||
|
||||
auto g_deleteLifecycleEventTask = [](const sptr<Token> &token, FreezeUtil::TimeoutState state) {
|
||||
CHECK_POINTER_LOG(token, "token is nullptr.");
|
||||
@@ -932,7 +940,8 @@ int UIAbilityLifecycleManager::NotifySCBPendingActivation(sptr<SessionInfo> &ses
|
||||
TAG_LOGI(AAFwkTag::ABILITYMGR, "Call PendingSessionActivation by callerSession.");
|
||||
return static_cast<int>(callerSession->PendingSessionActivation(sessionInfo));
|
||||
}
|
||||
CHECK_POINTER_AND_RETURN(rootSceneSession_, ERR_INVALID_VALUE);
|
||||
auto tmpSceneSession = iface_cast<Rosen::ISession>(rootSceneSession_);
|
||||
CHECK_POINTER_AND_RETURN(tmpSceneSession, ERR_INVALID_VALUE);
|
||||
if (sessionInfo->persistentId == 0) {
|
||||
const auto &abilityInfo = abilityRequest.abilityInfo;
|
||||
auto isStandard = abilityInfo.launchMode == AppExecFwk::LaunchMode::STANDARD && !abilityRequest.startRecent;
|
||||
@@ -943,7 +952,7 @@ int UIAbilityLifecycleManager::NotifySCBPendingActivation(sptr<SessionInfo> &ses
|
||||
}
|
||||
}
|
||||
TAG_LOGI(AAFwkTag::ABILITYMGR, "Call PendingSessionActivation by rootSceneSession.");
|
||||
return static_cast<int>(rootSceneSession_->PendingSessionActivation(sessionInfo));
|
||||
return static_cast<int>(tmpSceneSession->PendingSessionActivation(sessionInfo));
|
||||
}
|
||||
|
||||
int UIAbilityLifecycleManager::ResolveAbility(
|
||||
@@ -1014,11 +1023,7 @@ void UIAbilityLifecycleManager::PrintTimeOutLog(std::shared_ptr<AbilityRecord> a
|
||||
.eventName = eventName,
|
||||
.bundleName = ability->GetAbilityInfo().bundleName,
|
||||
};
|
||||
FreezeUtil::TimeoutState state = FreezeUtil::TimeoutState::UNKNOWN;
|
||||
auto search = stateMap.find(msgId);
|
||||
if (search != stateMap.end()) {
|
||||
state = search->second;
|
||||
}
|
||||
FreezeUtil::TimeoutState state = MsgId2State(msgId);
|
||||
if (state != FreezeUtil::TimeoutState::UNKNOWN) {
|
||||
auto flow = std::make_unique<FreezeUtil::LifecycleFlow>();
|
||||
if (ability->GetToken() != nullptr) {
|
||||
@@ -1353,17 +1358,12 @@ void UIAbilityLifecycleManager::OnTimeOut(uint32_t msgId, int64_t abilityRecordI
|
||||
void UIAbilityLifecycleManager::SetRootSceneSession(const sptr<IRemoteObject> &rootSceneSession)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::ABILITYMGR, "call");
|
||||
if (rootSceneSession == nullptr) {
|
||||
auto tmpSceneSession = iface_cast<Rosen::ISession>(rootSceneSession);
|
||||
if (tmpSceneSession == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "rootSceneSession is invalid.");
|
||||
return;
|
||||
}
|
||||
auto tmpSceneSession = iface_cast<Rosen::ISession>(rootSceneSession);
|
||||
auto descriptor = Str16ToStr8(tmpSceneSession->GetDescriptor());
|
||||
if (descriptor != "OHOS.ISession") {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "token's Descriptor: %{public}s", descriptor.c_str());
|
||||
return;
|
||||
}
|
||||
rootSceneSession_ = tmpSceneSession;
|
||||
rootSceneSession_ = rootSceneSession;
|
||||
}
|
||||
|
||||
void UIAbilityLifecycleManager::NotifySCBToHandleException(const std::shared_ptr<AbilityRecord> &abilityRecord,
|
||||
@@ -1629,6 +1629,7 @@ int UIAbilityLifecycleManager::SendSessionInfoToSCB(std::shared_ptr<AbilityRecor
|
||||
sptr<SessionInfo> &sessionInfo)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::ABILITYMGR, "call");
|
||||
auto tmpSceneSession = iface_cast<Rosen::ISession>(rootSceneSession_);
|
||||
if (callerAbility != nullptr) {
|
||||
auto callerSessionInfo = callerAbility->GetSessionInfo();
|
||||
if (callerSessionInfo != nullptr && callerSessionInfo->sessionToken != nullptr) {
|
||||
@@ -1638,12 +1639,12 @@ int UIAbilityLifecycleManager::SendSessionInfoToSCB(std::shared_ptr<AbilityRecor
|
||||
sessionInfo->hasContinuousTask = hasContinuousTask;
|
||||
callerSession->PendingSessionActivation(sessionInfo);
|
||||
} else {
|
||||
CHECK_POINTER_AND_RETURN(rootSceneSession_, ERR_INVALID_VALUE);
|
||||
rootSceneSession_->PendingSessionActivation(sessionInfo);
|
||||
CHECK_POINTER_AND_RETURN(tmpSceneSession, ERR_INVALID_VALUE);
|
||||
tmpSceneSession->PendingSessionActivation(sessionInfo);
|
||||
}
|
||||
} else {
|
||||
CHECK_POINTER_AND_RETURN(rootSceneSession_, ERR_INVALID_VALUE);
|
||||
rootSceneSession_->PendingSessionActivation(sessionInfo);
|
||||
CHECK_POINTER_AND_RETURN(tmpSceneSession, ERR_INVALID_VALUE);
|
||||
tmpSceneSession->PendingSessionActivation(sessionInfo);
|
||||
}
|
||||
return ERR_OK;
|
||||
}
|
||||
@@ -2142,7 +2143,8 @@ void UIAbilityLifecycleManager::DumpMissionListByRecordId(std::vector<std::strin
|
||||
int UIAbilityLifecycleManager::MoveMissionToFront(int32_t sessionId, std::shared_ptr<StartOptions> startOptions)
|
||||
{
|
||||
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
|
||||
CHECK_POINTER_AND_RETURN(rootSceneSession_, ERR_INVALID_VALUE);
|
||||
auto tmpSceneSession = iface_cast<Rosen::ISession>(rootSceneSession_);
|
||||
CHECK_POINTER_AND_RETURN(tmpSceneSession, ERR_INVALID_VALUE);
|
||||
std::shared_ptr<AbilityRecord> abilityRecord = GetAbilityRecordsById(sessionId);
|
||||
CHECK_POINTER_AND_RETURN(abilityRecord, ERR_INVALID_VALUE);
|
||||
if (startOptions != nullptr) {
|
||||
@@ -2151,7 +2153,7 @@ int UIAbilityLifecycleManager::MoveMissionToFront(int32_t sessionId, std::shared
|
||||
sptr<SessionInfo> sessionInfo = abilityRecord->GetSessionInfo();
|
||||
CHECK_POINTER_AND_RETURN(sessionInfo, ERR_INVALID_VALUE);
|
||||
TAG_LOGI(AAFwkTag::ABILITYMGR, "Call PendingSessionActivation by rootSceneSession.");
|
||||
return static_cast<int>(rootSceneSession_->PendingSessionActivation(sessionInfo));
|
||||
return static_cast<int>(tmpSceneSession->PendingSessionActivation(sessionInfo));
|
||||
}
|
||||
|
||||
std::shared_ptr<StatusBarDelegateManager> UIAbilityLifecycleManager::GetStatusBarDelegateManager()
|
||||
|
||||
@@ -65,14 +65,19 @@
|
||||
#include "shared/base_shared_bundle_info.h"
|
||||
#include "task_handler_wrap.h"
|
||||
#include "want.h"
|
||||
#include "window_focus_changed_listener.h"
|
||||
#include "window_visibility_changed_listener.h"
|
||||
#include "app_jsheap_mem_info.h"
|
||||
#include "running_multi_info.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace Rosen {
|
||||
class WindowVisibilityInfo;
|
||||
class FocusChangeInfo;
|
||||
}
|
||||
namespace AppExecFwk {
|
||||
using OHOS::AAFwk::Want;
|
||||
class WindowFocusChangedListener;
|
||||
class WindowVisibilityChangedListener;
|
||||
|
||||
class AppMgrServiceInner : public std::enable_shared_from_this<AppMgrServiceInner> {
|
||||
public:
|
||||
AppMgrServiceInner();
|
||||
@@ -1382,7 +1387,7 @@ private:
|
||||
*/
|
||||
void NotifyAppRunningStatusEvent(
|
||||
const std::string &bundle, int32_t uid, AbilityRuntime::RunningStatus runningStatus);
|
||||
|
||||
|
||||
void GetRunningCloneAppInfo(const std::shared_ptr<AppRunningRecord> &appRecord,
|
||||
RunningMultiAppInfo &info);
|
||||
|
||||
|
||||
@@ -35,6 +35,9 @@
|
||||
#include "app_jsheap_mem_info.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace Rosen {
|
||||
class WindowVisibilityInfo;
|
||||
}
|
||||
namespace AppExecFwk {
|
||||
class AppRunningManager {
|
||||
public:
|
||||
|
||||
@@ -43,10 +43,12 @@
|
||||
#include "module_running_record.h"
|
||||
#include "app_spawn_client.h"
|
||||
#include "app_malloc_info.h"
|
||||
#include "window_visibility_changed_listener.h"
|
||||
#include "app_jsheap_mem_info.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace Rosen {
|
||||
class WindowVisibilityInfo;
|
||||
}
|
||||
namespace AppExecFwk {
|
||||
class AbilityRunningRecord;
|
||||
class AppMgrServiceInner;
|
||||
|
||||
@@ -81,6 +81,8 @@
|
||||
#include "app_mgr_service_const.h"
|
||||
#include "app_mgr_service_dump_error_code.h"
|
||||
#include "cache_process_manager.h"
|
||||
#include "window_focus_changed_listener.h"
|
||||
#include "window_visibility_changed_listener.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace AppExecFwk {
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
#include "suspend_manager_client.h"
|
||||
#endif
|
||||
#include "app_mgr_service_dump_error_code.h"
|
||||
#include "window_visibility_info.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace AppExecFwk {
|
||||
|
||||
@@ -24,15 +24,16 @@
|
||||
#include "app_mgr_service_const.h"
|
||||
#include "app_mgr_service_dump_error_code.h"
|
||||
#include "cache_process_manager.h"
|
||||
#include "window_visibility_info.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace AppExecFwk {
|
||||
namespace {
|
||||
static constexpr int64_t NANOSECONDS = 1000000000; // NANOSECONDS mean 10^9 nano second
|
||||
static constexpr int64_t MICROSECONDS = 1000000; // MICROSECONDS mean 10^6 millias second
|
||||
constexpr int64_t NANOSECONDS = 1000000000; // NANOSECONDS mean 10^9 nano second
|
||||
constexpr int64_t MICROSECONDS = 1000000; // MICROSECONDS mean 10^6 millias second
|
||||
constexpr int32_t MAX_RESTART_COUNT = 3;
|
||||
constexpr int32_t RESTART_INTERVAL_TIME = 120000;
|
||||
const std::string LAUNCHER_NAME = "com.ohos.sceneboard";
|
||||
constexpr const char* LAUNCHER_NAME = "com.ohos.sceneboard";
|
||||
}
|
||||
|
||||
int64_t AppRunningRecord::appEventId_ = 0;
|
||||
|
||||
@@ -44,6 +44,19 @@ using namespace testing::ext;
|
||||
|
||||
namespace OHOS {
|
||||
namespace AppExecFwk {
|
||||
class WindowFocusChangedListener : public OHOS::Rosen::IFocusChangedListener {
|
||||
public:
|
||||
WindowFocusChangedListener(const std::shared_ptr<AppMgrServiceInner>& owner,
|
||||
const std::shared_ptr<AAFwk::TaskHandlerWrap>& handler);
|
||||
virtual ~WindowFocusChangedListener();
|
||||
|
||||
void OnFocused(const sptr<OHOS::Rosen::FocusChangeInfo> &focusChangeInfo) override;
|
||||
void OnUnfocused(const sptr<OHOS::Rosen::FocusChangeInfo> &focusChangeInfo) override;
|
||||
|
||||
private:
|
||||
std::weak_ptr<AppMgrServiceInner> owner_;
|
||||
std::shared_ptr<AAFwk::TaskHandlerWrap> taskHandler_;
|
||||
};
|
||||
namespace {
|
||||
constexpr int32_t RECORD_ID = 1;
|
||||
constexpr int32_t APP_DEBUG_INFO_PID = 0;
|
||||
|
||||
@@ -31,7 +31,6 @@ ohos_unittest("AppRunningProcessesInfoTest") {
|
||||
"${ability_runtime_services_path}/appmgr/src/advanced_security_mode_manager.cpp",
|
||||
"${ability_runtime_services_path}/appmgr/src/app_config_data_manager.cpp",
|
||||
"${ability_runtime_services_path}/appmgr/src/app_debug_manager.cpp",
|
||||
"${ability_runtime_services_path}/appmgr/src/app_mgr_service_inner.cpp",
|
||||
"${ability_runtime_services_path}/appmgr/src/app_preloader.cpp",
|
||||
"${ability_runtime_services_path}/appmgr/src/app_running_record.cpp",
|
||||
"${ability_runtime_services_path}/appmgr/src/app_running_status_module.cpp",
|
||||
|
||||
Reference in New Issue
Block a user