mirror of
https://github.com/openharmony/device_manager.git
synced 2026-07-19 18:13:32 -04:00
@@ -129,8 +129,8 @@ void DmDeviceStateManager::PostDeviceOffline(const std::string &pkgName, const D
|
||||
|
||||
void DmDeviceStateManager::OnDeviceOnline(const std::string &pkgName, const DmDeviceInfo &info)
|
||||
{
|
||||
DmDistributedHhardwareLoad::GetInstance().InitDistributedHardwareLoadCount();
|
||||
DmDistributedHhardwareLoad::GetInstance().LoadDistributedHardwareFwk();
|
||||
DmDistributedHardwareLoad::GetInstance().InitDistributedHardwareLoadCount();
|
||||
DmDistributedHardwareLoad::GetInstance().LoadDistributedHardwareFwk();
|
||||
LOGI("OnDeviceOnline function is called back with pkgName: %s", pkgName.c_str());
|
||||
RegisterOffLineTimer(info);
|
||||
RegisterProfileListener(pkgName, info);
|
||||
|
||||
@@ -13,14 +13,14 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef OHOS_DM_DISTRIBUTEED_HARDWARE_LOAD_FWK_H
|
||||
#define OHOS_DM_DISTRIBUTEED_HARDWARE_LOAD_FWK_H
|
||||
#ifndef OHOS_DM_DISTRIBUTEED_HARDWARE_LOAD_H
|
||||
#define OHOS_DM_DISTRIBUTEED_HARDWARE_LOAD_H
|
||||
#include <cstdint>
|
||||
#include "single_instance.h"
|
||||
namespace OHOS {
|
||||
namespace DistributedHardware {
|
||||
class DmDistributedHhardwareLoad {
|
||||
DECLARE_SINGLE_INSTANCE(DmDistributedHhardwareLoad);
|
||||
class DmDistributedHardwareLoad {
|
||||
DECLARE_SINGLE_INSTANCE(DmDistributedHardwareLoad);
|
||||
public:
|
||||
void LoadDistributedHardwareFwk(void);
|
||||
void InitDistributedHardwareLoadCount(void);
|
||||
|
||||
@@ -13,8 +13,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef OHOS_DM_DISTRIBUTEED_HARDWARE_LOAD_FWK_H
|
||||
#define OHOS_DM_DISTRIBUTEED_HARDWARE_LOAD_FWK_H
|
||||
#ifndef OHOS_DM_DISTRIBUTEED_HARDWARE_LOAD_H
|
||||
#define OHOS_DM_DISTRIBUTEED_HARDWARE_LOAD_H
|
||||
#include "if_system_ability_manager.h"
|
||||
#include "iservice_registry.h"
|
||||
#include "single_instance.h"
|
||||
@@ -29,8 +29,8 @@ public:
|
||||
void OnLoadSystemAbilityFail(int32_t systemAbilityId) override;
|
||||
};
|
||||
|
||||
class DmDistributedHhardwareLoad {
|
||||
DECLARE_SINGLE_INSTANCE(DmDistributedHhardwareLoad);
|
||||
class DmDistributedHardwareLoad {
|
||||
DECLARE_SINGLE_INSTANCE(DmDistributedHardwareLoad);
|
||||
public:
|
||||
void LoadDistributedHardwareFwk(void);
|
||||
void InitDistributedHardwareLoadCount(void);
|
||||
|
||||
@@ -18,16 +18,16 @@
|
||||
|
||||
namespace OHOS {
|
||||
namespace DistributedHardware {
|
||||
IMPLEMENT_SINGLE_INSTANCE(DmDistributedHhardwareLoad);
|
||||
void DmDistributedHhardwareLoad::LoadDistributedHardwareFwk(void)
|
||||
IMPLEMENT_SINGLE_INSTANCE(DmDistributedHardwareLoad);
|
||||
void DmDistributedHardwareLoad::LoadDistributedHardwareFwk(void)
|
||||
{
|
||||
return;
|
||||
}
|
||||
void DmDistributedHhardwareLoad::InitDistributedHardwareLoadCount(void)
|
||||
void DmDistributedHardwareLoad::InitDistributedHardwareLoadCount(void)
|
||||
{
|
||||
return;
|
||||
}
|
||||
uint32_t DmDistributedHhardwareLoad::getDistributedHardwareLoadCount(void)
|
||||
uint32_t DmDistributedHardwareLoad::getDistributedHardwareLoadCount(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -14,12 +14,11 @@
|
||||
*/
|
||||
|
||||
#include "dm_constants.h"
|
||||
#include "dm_distributed_hardware_load.h"
|
||||
#include "dm_log.h"
|
||||
#include "dm_distributed_hardware_load.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace DistributedHardware {
|
||||
|
||||
void DistributedHardwareLoadCallback::OnLoadSystemAbilitySuccess(
|
||||
int32_t systemAbilityId, const sptr<IRemoteObject> &remoteObject)
|
||||
{
|
||||
@@ -30,21 +29,20 @@ void DistributedHardwareLoadCallback::OnLoadSystemAbilitySuccess(
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void DistributedHardwareLoadCallback::OnLoadSystemAbilityFail(int32_t systemAbilityId)
|
||||
{
|
||||
LOGE("DmDistributedHhardware Load SA failed, systemAbilityId:%d", systemAbilityId);
|
||||
uint32_t maxLoadValue = 3;
|
||||
if (DmDistributedHhardwareLoad::GetInstance().getDistributedHardwareLoadCount() < maxLoadValue) {
|
||||
DmDistributedHhardwareLoad::GetInstance().LoadDistributedHardwareFwk();
|
||||
if (DmDistributedHardwareLoad::GetInstance().getDistributedHardwareLoadCount() < maxLoadValue) {
|
||||
DmDistributedHardwareLoad::GetInstance().LoadDistributedHardwareFwk();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
IMPLEMENT_SINGLE_INSTANCE(DmDistributedHhardwareLoad);
|
||||
void DmDistributedHhardwareLoad::LoadDistributedHardwareFwk(void)
|
||||
IMPLEMENT_SINGLE_INSTANCE(DmDistributedHardwareLoad);
|
||||
void DmDistributedHardwareLoad::LoadDistributedHardwareFwk(void)
|
||||
{
|
||||
LOGI("enter DmDistributedHhardwareLoad::LoadDistributedHardwareFwk");
|
||||
LOGI("enter DmDistributedHardwareLoad::LoadDistributedHardwareFwk");
|
||||
sptr<ISystemAbilityManager> samgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
|
||||
if (samgr == nullptr) {
|
||||
LOGE("failed to get system ability mgr.");
|
||||
@@ -58,11 +56,11 @@ void DmDistributedHhardwareLoad::LoadDistributedHardwareFwk(void)
|
||||
}
|
||||
return;
|
||||
}
|
||||
void DmDistributedHhardwareLoad::InitDistributedHardwareLoadCount(void)
|
||||
void DmDistributedHardwareLoad::InitDistributedHardwareLoadCount(void)
|
||||
{
|
||||
nLoadCount_ = 0;
|
||||
}
|
||||
uint32_t DmDistributedHhardwareLoad::getDistributedHardwareLoadCount()
|
||||
uint32_t DmDistributedHardwareLoad::getDistributedHardwareLoadCount()
|
||||
{
|
||||
return nLoadCount_;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user