mirror of
https://gitee.com/openharmony/ability_dmsfwk
synced 2024-11-23 06:20:07 +00:00
!973 增加窗口服务注册的订阅,确认服务注册成功后再注册焦点监听
Merge pull request !973 from liuhongjie/master
This commit is contained in:
commit
4d1afc7195
@ -37,6 +37,7 @@
|
||||
#include "dsched_collaborate_callback_mgr.h"
|
||||
#include "idms_interactive_adapter.h"
|
||||
#ifdef SUPPORT_DISTRIBUTED_MISSION_MANAGER
|
||||
#include "mission/distributed_mission_focused_listener.h"
|
||||
#include "mission/distributed_mission_info.h"
|
||||
#include "nocopyable.h"
|
||||
#endif
|
||||
@ -152,6 +153,7 @@ public:
|
||||
int32_t RegisterOffListener(const std::string& type, const sptr<IRemoteObject>& obj) override;
|
||||
int32_t UnRegisterMissionListener(const std::u16string& devId, const sptr<IRemoteObject>& obj) override;
|
||||
int32_t SetMissionContinueState(int32_t missionId, const AAFwk::ContinueState &state) override;
|
||||
void OnAddSystemAbility(int32_t systemAbilityId, const std::string& deviceId) override;
|
||||
#endif
|
||||
int32_t RegisterDSchedEventListener(const DSchedEventType& type, const sptr<IRemoteObject>& obj) override;
|
||||
int32_t UnRegisterDSchedEventListener(const DSchedEventType& type, const sptr<IRemoteObject>& obj) override;
|
||||
@ -338,6 +340,7 @@ private:
|
||||
std::atomic<int32_t> token_ {0};
|
||||
std::map<std::string, sptr<AppStateObserver>> bundleNameMap_;
|
||||
DataShareManager dataShareManager_;
|
||||
sptr<DistributedMissionFocusedListener> missionFocusedListener_ = nullptr;
|
||||
|
||||
#ifdef DMSFWK_INTERACTIVE_ADAPTER
|
||||
std::mutex dmsAdapetrLock_;
|
||||
|
@ -26,7 +26,6 @@
|
||||
|
||||
#include "bundle/bundle_manager_internal.h"
|
||||
#include "distributed_mission_died_listener.h"
|
||||
#include "distributed_mission_focused_listener.h"
|
||||
#include "event_handler.h"
|
||||
#include "mission_info.h"
|
||||
|
||||
@ -148,7 +147,6 @@ private:
|
||||
uint16_t& bundleNameId, uint8_t& continueTypeId);
|
||||
private:
|
||||
currentMissionInfo info_ = { INVALID_MISSION_ID, false };
|
||||
sptr<DistributedMissionFocusedListener> missionFocusedListener_;
|
||||
std::map<std::string, int32_t> focusedMission_;
|
||||
std::map<int32_t, std::string> focusedMissionAbility_;
|
||||
std::thread eventThread_;
|
||||
|
@ -137,6 +137,7 @@ constexpr int32_t DMSDURATION_DSTTOSRCRPCTIME = 3;
|
||||
constexpr int32_t DMSDURATION_SRCTODSTRPCTIME = 5;
|
||||
constexpr int32_t DMSDURATION_STARTABILITY = 6;
|
||||
constexpr int32_t HID_HAP = 10000; /* first hap user */
|
||||
constexpr int32_t WINDOW_MANAGER_SERVICE_ID = 4606;
|
||||
static const std::string CONTINUE_SWITCH_STATUS_KEY = "Continue_Switch_Status";
|
||||
}
|
||||
|
||||
@ -194,6 +195,8 @@ void DistributedSchedService::OnStop(const SystemAbilityOnDemandReason &stopReas
|
||||
#ifdef SUPPORT_DISTRIBUTED_MISSION_MANAGER
|
||||
DMSContinueSendMgr::GetInstance().UnInit();
|
||||
DMSContinueRecvMgr::GetInstance().UnInit();
|
||||
RemoveSystemAbilityListener(WINDOW_MANAGER_SERVICE_ID);
|
||||
DistributedSchedAdapter::GetInstance().UnRegisterMissionListener(missionFocusedListener_);
|
||||
#endif
|
||||
|
||||
#ifdef DMSFWK_INTERACTIVE_ADAPTER
|
||||
@ -286,6 +289,10 @@ bool DistributedSchedService::Init()
|
||||
InitDataShareManager();
|
||||
|
||||
#ifdef SUPPORT_DISTRIBUTED_MISSION_MANAGER
|
||||
if (!AddSystemAbilityListener(WINDOW_MANAGER_SERVICE_ID)) {
|
||||
HILOGE("Add System Ability Listener failed!");
|
||||
return false;
|
||||
}
|
||||
DistributedSchedMissionManager::GetInstance().Init();
|
||||
DistributedSchedMissionManager::GetInstance().InitDataStorage();
|
||||
InitCommonEventListener();
|
||||
@ -308,6 +315,16 @@ bool DistributedSchedService::Init()
|
||||
return true;
|
||||
}
|
||||
|
||||
void DistributedSchedService::OnAddSystemAbility(int32_t systemAbilityId, const std::string& deviceId)
|
||||
{
|
||||
HILOGI("OnAddSystemAbility systemAbilityId:%{public}d added!", systemAbilityId);
|
||||
missionFocusedListener_ = sptr<DistributedMissionFocusedListener>(new DistributedMissionFocusedListener());
|
||||
int32_t ret = DistributedSchedAdapter::GetInstance().RegisterMissionListener(missionFocusedListener_);
|
||||
if (ret != ERR_OK) {
|
||||
HILOGE("get RegisterMissionListener failed, ret: %{public}d", ret);
|
||||
}
|
||||
}
|
||||
|
||||
void DistributedSchedService::InitDataShareManager()
|
||||
{
|
||||
DataShareManager::ObserverCallback observerCallback = [this]() {
|
||||
|
@ -52,12 +52,6 @@ void DMSContinueSendMgr::Init()
|
||||
{
|
||||
HILOGI("Init start");
|
||||
{
|
||||
missionFocusedListener_ = new DistributedMissionFocusedListener();
|
||||
int32_t ret = DistributedSchedAdapter::GetInstance().RegisterMissionListener(missionFocusedListener_);
|
||||
if (ret != ERR_OK) {
|
||||
HILOGE("get RegisterMissionListener failed, ret: %{public}d", ret);
|
||||
return;
|
||||
}
|
||||
MMIAdapter::GetInstance().Init();
|
||||
screenOffHandler_ = std::make_shared<ScreenOffHandler>();
|
||||
|
||||
|
@ -47,6 +47,11 @@ ohos_fuzztest("DistributedSchedStubFuzzTest") {
|
||||
|
||||
deps = [ "${dms_path}/services/dtbschedmgr:distributedschedsvr" ]
|
||||
|
||||
defines = []
|
||||
if (dmsfwk_mission_manager) {
|
||||
defines += [ "SUPPORT_DISTRIBUTED_MISSION_MANAGER" ]
|
||||
}
|
||||
|
||||
external_deps = [
|
||||
"ability_base:base",
|
||||
"ability_base:want",
|
||||
|
Loading…
Reference in New Issue
Block a user