mirror of
https://gitee.com/openharmony/resourceschedule_background_task_mgr
synced 2024-11-27 09:01:19 +00:00
修改格式错误
Signed-off-by: Zhao-PengFei35 <zhaopengfei35@huawei.com>
This commit is contained in:
parent
89ae6ba2cd
commit
d70fc42ab0
@ -272,7 +272,6 @@ ErrCode BackgroundTaskMgrStub::HandleApplyEfficiencyResources(MessageParcel& dat
|
||||
|
||||
ErrCode BackgroundTaskMgrStub::HandleResetAllEfficiencyResources(MessageParcel& data, MessageParcel& reply)
|
||||
{
|
||||
int32_t id = data.ReadInt32();
|
||||
ErrCode result = ResetAllEfficiencyResources();
|
||||
if (!reply.WriteInt32(result)) {
|
||||
BGTASK_LOGE("HandleCancelSuspendDelay Write result failed, ErrCode=%{public}d", result);
|
||||
|
@ -188,6 +188,7 @@ ErrCode BackgroundTaskSubscriberStub::HandleOnAppEfficiencyResourcesApply(Messag
|
||||
return ERR_BGTASK_PARCELABLE_FAILED;
|
||||
}
|
||||
OnAppEfficiencyResourcesApply(resourceCallbackInfo);
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
ErrCode BackgroundTaskSubscriberStub::HandleOnAppEfficiencyResourcesReset(MessageParcel &data)
|
||||
@ -199,7 +200,7 @@ ErrCode BackgroundTaskSubscriberStub::HandleOnAppEfficiencyResourcesReset(Messag
|
||||
return ERR_BGTASK_PARCELABLE_FAILED;
|
||||
}
|
||||
OnAppEfficiencyResourcesReset(resourceCallbackInfo);
|
||||
return ERR_NONE;
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
ErrCode BackgroundTaskSubscriberStub::HandleOnEfficiencyResourcesApply(MessageParcel &data)
|
||||
@ -211,6 +212,7 @@ ErrCode BackgroundTaskSubscriberStub::HandleOnEfficiencyResourcesApply(MessagePa
|
||||
return ERR_BGTASK_PARCELABLE_FAILED;
|
||||
}
|
||||
OnEfficiencyResourcesApply(resourceCallbackInfo);
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
ErrCode BackgroundTaskSubscriberStub::HandleOnEfficiencyResourcesReset(MessageParcel &data)
|
||||
@ -222,7 +224,7 @@ ErrCode BackgroundTaskSubscriberStub::HandleOnEfficiencyResourcesReset(MessagePa
|
||||
return ERR_BGTASK_PARCELABLE_FAILED;
|
||||
}
|
||||
OnEfficiencyResourcesReset(resourceCallbackInfo);
|
||||
return ERR_NONE;
|
||||
return ERR_OK;
|
||||
}
|
||||
} // namespace BackgroundTaskMgr
|
||||
} // namespace OHOS
|
@ -16,7 +16,7 @@
|
||||
#ifndef FOUNDATION_RESOURCESCHEDULE_BACKGROUND_TASK_MGR_INTERFACES_INNERKITS_EFFICIENCY_RESOURCE_INFO_H
|
||||
#define FOUNDATION_RESOURCESCHEDULE_BACKGROUND_TASK_MGR_INTERFACES_INNERKITS_EFFICIENCY_RESOURCE_INFO_H
|
||||
|
||||
#include <message_parcel.h>
|
||||
#include "parcel.h"
|
||||
#include <string>
|
||||
#include <memory>
|
||||
|
||||
@ -36,7 +36,7 @@ public:
|
||||
* @param parcel Indicates the parcel object for unmarshalling.
|
||||
* @return The info of delay suspend.
|
||||
*/
|
||||
static std::shared_ptr<EfficiencyResourceInfo> Unmarshalling(Parcel& in);
|
||||
static EfficiencyResourceInfo* Unmarshalling(Parcel& in);
|
||||
|
||||
/**
|
||||
* @brief Marshals a purpose into a parcel.
|
||||
|
@ -20,7 +20,7 @@
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include <message_parcel.h>
|
||||
#include "parcel.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace BackgroundTaskMgr {
|
||||
@ -43,10 +43,19 @@ public:
|
||||
/**
|
||||
* @brief Unmarshals a purpose from a Parcel.
|
||||
*
|
||||
* @param parcel Indicates the MessageParcel object for unmarshalling.
|
||||
* @param parcel Indicates the Parcel object for unmarshalling.
|
||||
* @return App info of transient task.
|
||||
*/
|
||||
static std::shared_ptr<ResourceCallbackInfo> Unmarshalling(Parcel& in);
|
||||
static ResourceCallbackInfo* Unmarshalling(Parcel& in);
|
||||
|
||||
/**
|
||||
* @brief read date from a parcel, transform json to data
|
||||
*
|
||||
* @param in
|
||||
* @return true read data from parcel seccessed
|
||||
* @return false failed
|
||||
*/
|
||||
bool ReadFromParcel(Parcel& in);
|
||||
|
||||
/**
|
||||
* @brief Get the uid.
|
||||
@ -87,9 +96,8 @@ public:
|
||||
{
|
||||
return bundleName_;
|
||||
}
|
||||
private:
|
||||
bool ReadFromParcel(MessageParcel& in);
|
||||
|
||||
private:
|
||||
int32_t uid_ {0};
|
||||
int32_t pid_ {0};
|
||||
uint32_t resourceNumber_ {0};
|
||||
|
@ -26,17 +26,16 @@ bool EfficiencyResourceInfo::Marshalling(Parcel& out) const
|
||||
WRITE_PARCEL_WITH_RET(out, Int32, timeOut_, false);
|
||||
WRITE_PARCEL_WITH_RET(out, String, reason_, false);
|
||||
WRITE_PARCEL_WITH_RET(out, Bool, isPersist_, false);
|
||||
WRITE_PARCEL_WITH_RET(out, Bool, isProcess_, false);
|
||||
return true;
|
||||
}
|
||||
|
||||
std::shared_ptr<EfficiencyResourceInfo> EfficiencyResourceInfo::Unmarshalling(Parcel &in)
|
||||
EfficiencyResourceInfo* EfficiencyResourceInfo::Unmarshalling(Parcel &in)
|
||||
{
|
||||
auto info = std::make_shared<EfficiencyResourceInfo>();
|
||||
if (info == nullptr || !info->ReadFromParcel(in)) {
|
||||
auto info = new (std::nothrow) EfficiencyResourceInfo();
|
||||
if (info && !info->ReadFromParcel(in)) {
|
||||
BGTASK_LOGE("read from parcel failed");
|
||||
info.reset();
|
||||
return nullptr;
|
||||
delete info;
|
||||
info = nullptr;
|
||||
}
|
||||
return info;
|
||||
}
|
||||
@ -48,7 +47,6 @@ bool EfficiencyResourceInfo::ReadFromParcel(Parcel& in)
|
||||
READ_PARCEL_WITH_RET(in, Int32, timeOut_, false);
|
||||
READ_PARCEL_WITH_RET(in, String, reason_, false);
|
||||
READ_PARCEL_WITH_RET(in, Bool, isPersist_, false);
|
||||
READ_PARCEL_WITH_RET(in, Bool, isProcess_, false);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -37,13 +37,14 @@ bool ResourceCallbackInfo::ReadFromParcel(Parcel& in)
|
||||
return true;
|
||||
}
|
||||
|
||||
std::shared_ptr<ResourceCallbackInfo> ResourceCallbackInfo::Unmarshalling(Parcel& in)
|
||||
ResourceCallbackInfo* ResourceCallbackInfo::Unmarshalling(Parcel& in)
|
||||
{
|
||||
auto transientAppInfo = std::make_shared<ResourceCallbackInfo>();
|
||||
if (!transientAppInfo->ReadFromParcel(in)) {
|
||||
return nullptr;
|
||||
auto resourceInfo = new (std::nothrow) ResourceCallbackInfo();
|
||||
if (resourceInfo && !resourceInfo->ReadFromParcel(in)) {
|
||||
delete resourceInfo;
|
||||
resourceInfo = nullptr;
|
||||
}
|
||||
return transientAppInfo;
|
||||
return resourceInfo;
|
||||
}
|
||||
} // namespace BackgroundTaskMgr
|
||||
} // namespace OHOS
|
@ -69,6 +69,6 @@ ohos_systemtest("BgtaskDumpTest") {
|
||||
|
||||
group("systemtest") {
|
||||
testonly = true
|
||||
|
||||
|
||||
deps = [ ":BgtaskDumpTest" ]
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user