添加权限

Signed-off-by: guoyi <guoyi39@huawei.com>
This commit is contained in:
guoyi 2024-11-03 20:51:59 +08:00
parent 230938251e
commit 514e9b732c
4 changed files with 8 additions and 4 deletions

View File

@ -17,6 +17,7 @@
"permission" : [
"ohos.permission.DISTRIBUTED_DATASYNC",
"ohos.permission.ACCESS_SERVICE_DM",
"ohos.permission.MANAGE_LOCAL_ACCOUNTS",
"ohos.permission.MONITOR_DEVICE_NETWORK_STATE"
],
"permission_acls" : ["ohos.permission.MONITOR_DEVICE_NETWORK_STATE"],

View File

@ -291,6 +291,9 @@ void DistributedDeviceProfileService::OnStop()
void DistributedDeviceProfileService::OnAddSystemAbility(int32_t systemAbilityId, const std::string& deviceId)
{
HILOGI("called systemAbilityId:%{public}d", systemAbilityId);
if (systemAbilityId == SUBSYS_ACCOUNT_SYS_ABILITY_ID_BEGIN) {
DistributedDeviceProfile::DistributedDeviceProfileServiceNew::GetInstance().SubscribeAccountCommonEvent();
}
if (DistributedDeviceProfile::DistributedDeviceProfileServiceNew::GetInstance().IsInited()) {
return;
}

View File

@ -73,6 +73,7 @@ public:
int32_t Dump(int32_t fd, const std::vector<std::u16string>& args) override;
void DelayUnloadTask() override;
bool IsInited() override;
void SubscribeAccountCommonEvent();
protected:
void OnStart(const SystemAbilityOnDemandReason& startReason) override;
@ -89,7 +90,6 @@ private:
int32_t SaveSwitchProfilesFromTempCache();
int32_t SaveDynamicProfilesFromTempCache();
int32_t NotifyDeviceProfileInited();
void SubscribeAccountCommonEvent();
void GetDynamicProfilesFromTempCache(std::map<std::string, std::string>& entries);
void ClearProfileCache();

View File

@ -606,6 +606,9 @@ int32_t DistributedDeviceProfileServiceNew::OnIdle(const SystemAbilityOnDemandRe
void DistributedDeviceProfileServiceNew::OnAddSystemAbility(int32_t systemAbilityId, const std::string& deviceId)
{
HILOGI("called systemAbilityId:%{public}d", systemAbilityId);
if (systemAbilityId == SUBSYS_ACCOUNT_SYS_ABILITY_ID_BEGIN) {
SubscribeAccountCommonEvent();
}
if (DistributedDeviceProfile::DistributedDeviceProfileServiceNew::GetInstance().IsInited()) {
return;
}
@ -619,9 +622,6 @@ void DistributedDeviceProfileServiceNew::OnAddSystemAbility(int32_t systemAbilit
return;
}
}
if (systemAbilityId == SUBSYS_ACCOUNT_SYS_ABILITY_ID_BEGIN) {
SubscribeAccountCommonEvent();
}
PostInit();
}