clean code check: function parameter

Signed-off-by: yecong2332 <yecong5@h-partners.com>
This commit is contained in:
yecong2332 2024-08-08 09:30:58 +08:00
parent 25851d75e6
commit 2a13b6dbac
164 changed files with 471 additions and 471 deletions

View File

@ -60,7 +60,7 @@ public:
virtual sptr<DisplayInfo> GetDisplayInfoByScreenId(ScreenId screenId); virtual sptr<DisplayInfo> GetDisplayInfoByScreenId(ScreenId screenId);
virtual std::vector<DisplayId> GetAllDisplayIds(); virtual std::vector<DisplayId> GetAllDisplayIds();
virtual std::shared_ptr<Media::PixelMap> GetDisplaySnapshot(DisplayId displayId, DmErrorCode* errorCode = nullptr); virtual std::shared_ptr<Media::PixelMap> GetDisplaySnapshot(DisplayId displayId, DmErrorCode* errorCode = nullptr);
virtual std::shared_ptr<Media::PixelMap> GetSnapshotByPicker(Media::Rect &rect, DmErrorCode* errorCode = nullptr); virtual std::shared_ptr<Media::PixelMap> GetSnapshotByPicker(Media::Rect& rect, DmErrorCode* errorCode = nullptr);
virtual DMError HasImmersiveWindow(bool& immersive); virtual DMError HasImmersiveWindow(bool& immersive);
virtual DMError HasPrivateWindow(DisplayId displayId, bool& hasPrivateWindow); virtual DMError HasPrivateWindow(DisplayId displayId, bool& hasPrivateWindow);
virtual bool WakeUpBegin(PowerStateChangeReason reason); virtual bool WakeUpBegin(PowerStateChangeReason reason);

View File

@ -678,7 +678,7 @@ std::shared_ptr<Media::PixelMap> DisplayManager::GetScreenshot(DisplayId display
return screenShot; return screenShot;
} }
std::shared_ptr<Media::PixelMap> DisplayManager::GetSnapshotByPicker(Media::Rect &rect, DmErrorCode* errorCode) std::shared_ptr<Media::PixelMap> DisplayManager::GetSnapshotByPicker(Media::Rect& rect, DmErrorCode* errorCode)
{ {
std::unique_lock<std::mutex> lock(snapBypickerMutex, std::defer_lock); std::unique_lock<std::mutex> lock(snapBypickerMutex, std::defer_lock);
if (!lock.try_lock()) { if (!lock.try_lock()) {
@ -712,8 +712,8 @@ std::shared_ptr<Media::PixelMap> DisplayManager::GetSnapshotByPicker(Media::Rect
return pixelMap; return pixelMap;
} }
std::shared_ptr<Media::PixelMap> DisplayManager::GetScreenshot(DisplayId displayId, const Media::Rect &rect, std::shared_ptr<Media::PixelMap> DisplayManager::GetScreenshot(DisplayId displayId, const Media::Rect& rect,
const Media::Size &size, int rotation, DmErrorCode* errorCode) const Media::Size& size, int rotation, DmErrorCode* errorCode)
{ {
std::shared_ptr<Media::PixelMap> screenShot = GetScreenshot(displayId, errorCode); std::shared_ptr<Media::PixelMap> screenShot = GetScreenshot(displayId, errorCode);
if (screenShot == nullptr) { if (screenShot == nullptr) {

View File

@ -62,7 +62,7 @@ std::shared_ptr<Media::PixelMap> DisplayManagerAdapter::GetDisplaySnapshot(Displ
return displayManagerServiceProxy_->GetDisplaySnapshot(displayId, errorCode); return displayManagerServiceProxy_->GetDisplaySnapshot(displayId, errorCode);
} }
std::shared_ptr<Media::PixelMap> DisplayManagerAdapter::GetSnapshotByPicker(Media::Rect &rect, DmErrorCode* errorCode) std::shared_ptr<Media::PixelMap> DisplayManagerAdapter::GetSnapshotByPicker(Media::Rect& rect, DmErrorCode* errorCode)
{ {
INIT_PROXY_CHECK_RETURN(nullptr); INIT_PROXY_CHECK_RETURN(nullptr);

View File

@ -121,7 +121,7 @@ HWTEST_F(DisplayTestLite, GetId01, Function | SmallTest | Level1)
HWTEST_F(DisplayTestLite, GetId02, Function | SmallTest | Level1) HWTEST_F(DisplayTestLite, GetId02, Function | SmallTest | Level1)
{ {
GTEST_LOG_(INFO) << "DisplayLite::GetId start"; GTEST_LOG_(INFO) << "DisplayLite::GetId start";
DisplayInfo *displayInfo = new DisplayInfo(); DisplayInfo* displayInfo = new DisplayInfo();
sptr<DisplayLite> display = new DisplayLite("", displayInfo); sptr<DisplayLite> display = new DisplayLite("", displayInfo);
uint64_t id; uint64_t id;
id = display->GetId(); id = display->GetId();
@ -154,7 +154,7 @@ HWTEST_F(DisplayTestLite, GetDisplayInfo01, Function | SmallTest | Level1)
HWTEST_F(DisplayTestLite, GetDisplayInfo02, Function | SmallTest | Level1) HWTEST_F(DisplayTestLite, GetDisplayInfo02, Function | SmallTest | Level1)
{ {
GTEST_LOG_(INFO) << "DisplayLite::GetId start"; GTEST_LOG_(INFO) << "DisplayLite::GetId start";
DisplayInfo *displayInfo = new DisplayInfo(); DisplayInfo* displayInfo = new DisplayInfo();
sptr<DisplayLite> display = new DisplayLite("", displayInfo);; sptr<DisplayLite> display = new DisplayLite("", displayInfo);;
displayInfo = display->GetDisplayInfo(); displayInfo = display->GetDisplayInfo();
ASSERT_NE(displayInfo, nullptr); ASSERT_NE(displayInfo, nullptr);

View File

@ -161,7 +161,7 @@ public:
virtual DMError SetOrientation(ScreenId screenId, Orientation orientation) = 0; virtual DMError SetOrientation(ScreenId screenId, Orientation orientation) = 0;
virtual std::shared_ptr<Media::PixelMap> GetDisplaySnapshot(DisplayId displayId, virtual std::shared_ptr<Media::PixelMap> GetDisplaySnapshot(DisplayId displayId,
DmErrorCode* errorCode = nullptr) = 0; DmErrorCode* errorCode = nullptr) = 0;
virtual std::shared_ptr<Media::PixelMap> GetSnapshotByPicker(Media::Rect &rect, DmErrorCode* errorCode = nullptr) virtual std::shared_ptr<Media::PixelMap> GetSnapshotByPicker(Media::Rect& rect, DmErrorCode* errorCode = nullptr)
{ {
*errorCode = DmErrorCode::DM_ERROR_DEVICE_NOT_SUPPORT; *errorCode = DmErrorCode::DM_ERROR_DEVICE_NOT_SUPPORT;
return nullptr; return nullptr;

View File

@ -27,7 +27,7 @@
namespace OHOS::Rosen { namespace OHOS::Rosen {
class DisplayManagerProxy : public IRemoteProxy<IDisplayManager> { class DisplayManagerProxy : public IRemoteProxy<IDisplayManager> {
public: public:
explicit DisplayManagerProxy(const sptr<IRemoteObject> &impl) explicit DisplayManagerProxy(const sptr<IRemoteObject>& impl)
: IRemoteProxy<IDisplayManager>(impl) {}; : IRemoteProxy<IDisplayManager>(impl) {};
~DisplayManagerProxy() {}; ~DisplayManagerProxy() {};

View File

@ -25,8 +25,8 @@ class DisplayManagerStub : public IRemoteStub<IDisplayManager> {
public: public:
DisplayManagerStub() = default; DisplayManagerStub() = default;
~DisplayManagerStub() = default; ~DisplayManagerStub() = default;
virtual int32_t OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, virtual int32_t OnRemoteRequest(uint32_t code, MessageParcel& data, MessageParcel& reply,
MessageOption &option) override; MessageOption& option) override;
}; };
} // namespace OHOS::Rosen } // namespace OHOS::Rosen

View File

@ -53,7 +53,7 @@ private:
static void SubscribeGravitySensor(); static void SubscribeGravitySensor();
static void UnsubscribeGravitySensor(); static void UnsubscribeGravitySensor();
static void HandleGravitySensorEventCallback(SensorEvent *event); static void HandleGravitySensorEventCallback(SensorEvent* event);
static bool CheckCallbackTimeInterval(); static bool CheckCallbackTimeInterval();
static int CalcRotationDegree(GravityData* gravityData); static int CalcRotationDegree(GravityData* gravityData);
static SensorRotation CalcSensorRotation(int sensorDegree); static SensorRotation CalcSensorRotation(int sensorDegree);

View File

@ -797,7 +797,7 @@ void AbstractScreenController::UpdateScreenGroupLayout(sptr<AbstractScreenGroup>
} }
// update display node's start point from left to right. // update display node's start point from left to right.
std::sort(screens.begin(), screens.end(), [](const auto &a, const auto &b) { std::sort(screens.begin(), screens.end(), [](const auto& a, const auto& b) {
return a->startPoint_.posX_ < b->startPoint_.posX_; return a->startPoint_.posX_ < b->startPoint_.posX_;
}); });

View File

@ -30,8 +30,8 @@ namespace {
const static uint32_t MAX_SCREEN_SIZE = 32; const static uint32_t MAX_SCREEN_SIZE = 32;
} }
int32_t DisplayManagerStub::OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, int32_t DisplayManagerStub::OnRemoteRequest(uint32_t code, MessageParcel& data, MessageParcel& reply,
MessageOption &option) MessageOption& option)
{ {
WLOGFD("OnRemoteRequest code is %{public}u", code); WLOGFD("OnRemoteRequest code is %{public}u", code);
if (data.ReadInterfaceToken() != GetDescriptor()) { if (data.ReadInterfaceToken() != GetDescriptor()) {

View File

@ -124,7 +124,7 @@ void GravitySensorSubscriber::UnsubscribeGravitySensor()
isGravitySensorSubscribed_ = false; isGravitySensorSubscribed_ = false;
} }
void GravitySensorSubscriber::HandleGravitySensorEventCallback(SensorEvent *event) void GravitySensorSubscriber::HandleGravitySensorEventCallback(SensorEvent* event)
{ {
if (!CheckCallbackTimeInterval() || event == nullptr) { if (!CheckCallbackTimeInterval() || event == nullptr) {
return; return;

View File

@ -39,7 +39,7 @@ public:
* *
* @return errCode WM_OK on success, others on failure. * @return errCode WM_OK on success, others on failure.
*/ */
WMError StartAbility(const AAFwk::Want &want, const AAFwk::StartOptions &startOptions) const; WMError StartAbility(const AAFwk::Want& want, const AAFwk::StartOptions& startOptions) const;
static const size_t CONTEXT_TYPE_ID; static const size_t CONTEXT_TYPE_ID;
private: private:

View File

@ -51,7 +51,7 @@ public:
} }
}; };
napi_value AttachWindowExtensionContext(napi_env env, void *value, void *) napi_value AttachWindowExtensionContext(napi_env env, void* value, void *)
{ {
WLOGI("AttachWindowExtensionContext"); WLOGI("AttachWindowExtensionContext");
if (value == nullptr) { if (value == nullptr) {
@ -82,7 +82,7 @@ napi_value AttachWindowExtensionContext(napi_env env, void *value, void *)
return nullptr; return nullptr;
} }
napi_wrap(env, contextObj, workContext, napi_wrap(env, contextObj, workContext,
[](napi_env, void *data, void *) { [](napi_env, void* data, void *) {
WLOGI("Finalizer for weak_ptr service extension context is called"); WLOGI("Finalizer for weak_ptr service extension context is called");
delete static_cast<std::weak_ptr<WindowExtensionContext> *>(data); delete static_cast<std::weak_ptr<WindowExtensionContext> *>(data);
}, nullptr, nullptr); }, nullptr, nullptr);
@ -174,7 +174,7 @@ void JsWindowExtension::BindContext(napi_env env, napi_value obj)
napi_set_named_property(env, obj, "context", contextObj); napi_set_named_property(env, obj, "context", contextObj);
napi_wrap(env, contextObj, workContext, napi_wrap(env, contextObj, workContext,
[](napi_env, void *data, void *) { [](napi_env, void* data, void *) {
WLOGI("Finalizer for weak_ptr extension context is called"); WLOGI("Finalizer for weak_ptr extension context is called");
delete static_cast<std::weak_ptr<WindowExtensionContext>*>(data); delete static_cast<std::weak_ptr<WindowExtensionContext>*>(data);
}, nullptr, nullptr); }, nullptr, nullptr);

View File

@ -29,7 +29,7 @@ namespace {
const size_t WindowExtensionContext::CONTEXT_TYPE_ID(std::hash<const char*> {} ("WindowExtensionContext")); const size_t WindowExtensionContext::CONTEXT_TYPE_ID(std::hash<const char*> {} ("WindowExtensionContext"));
int WindowExtensionContext::ILLEGAL_REQUEST_CODE(-1); int WindowExtensionContext::ILLEGAL_REQUEST_CODE(-1);
WMError WindowExtensionContext::StartAbility(const AAFwk::Want &want, const AAFwk::StartOptions &startOptions) const WMError WindowExtensionContext::StartAbility(const AAFwk::Want& want, const AAFwk::StartOptions& startOptions) const
{ {
WLOGFD("Start ability begin, ability:%{public}s.", want.GetElement().GetAbilityName().c_str()); WLOGFD("Start ability begin, ability:%{public}s.", want.GetElement().GetAbilityName().c_str());
ErrCode err = AAFwk::AbilityManagerClient::GetInstance()->StartAbility(want, startOptions, token_, ErrCode err = AAFwk::AbilityManagerClient::GetInstance()->StartAbility(want, startOptions, token_,

View File

@ -229,7 +229,7 @@ public:
* @param errorCode error code. * @param errorCode error code.
* @return PixelMap object of screenshot. * @return PixelMap object of screenshot.
*/ */
std::shared_ptr<Media::PixelMap> GetSnapshotByPicker(Media::Rect &rect, DmErrorCode* errorCode = nullptr); std::shared_ptr<Media::PixelMap> GetSnapshotByPicker(Media::Rect& rect, DmErrorCode* errorCode = nullptr);
/** /**
* @brief Get screenshot of the target display. * @brief Get screenshot of the target display.
@ -241,8 +241,8 @@ public:
* @param errorCode error code. * @param errorCode error code.
* @return PixelMap object of screenshot. * @return PixelMap object of screenshot.
*/ */
std::shared_ptr<Media::PixelMap> GetScreenshot(DisplayId displayId, const Media::Rect &rect, std::shared_ptr<Media::PixelMap> GetScreenshot(DisplayId displayId, const Media::Rect& rect,
const Media::Size &size, int rotation, DmErrorCode* errorCode = nullptr); const Media::Size& size, int rotation, DmErrorCode* errorCode = nullptr);
/** /**
* @brief Begin to wake up screen. * @brief Begin to wake up screen.

View File

@ -446,7 +446,7 @@ struct PointInfo {
* @brief topN main window info. * @brief topN main window info.
*/ */
struct MainWindowInfo : public Parcelable { struct MainWindowInfo : public Parcelable {
virtual bool Marshalling(Parcel &parcel) const override virtual bool Marshalling(Parcel& parcel) const override
{ {
if (!parcel.WriteInt32(pid_)) { if (!parcel.WriteInt32(pid_)) {
return false; return false;

View File

@ -37,7 +37,7 @@ namespace {
static thread_local std::map<uint64_t, sptr<DisplayImpl>> g_cjDisplayMap; static thread_local std::map<uint64_t, sptr<DisplayImpl>> g_cjDisplayMap;
std::recursive_mutex g_mutex; std::recursive_mutex g_mutex;
void SetCRect(const DMRect &row, CRect *ptr) void SetCRect(const DMRect& row, CRect* ptr)
{ {
ptr->left = row.posX_; ptr->left = row.posX_;
ptr->top = row.posY_; ptr->top = row.posY_;
@ -59,7 +59,7 @@ CRect* CreateCBoundingRects(std::vector<DMRect> &bound)
return result; return result;
} }
void SetCWaterfallDisplayAreaRects(const WaterfallDisplayAreaRects &area, CCutoutInfo * info) void SetCWaterfallDisplayAreaRects(const WaterfallDisplayAreaRects& area, CCutoutInfo * info)
{ {
if (info == nullptr || info->boundingRects == nullptr) { if (info == nullptr || info->boundingRects == nullptr) {
return; return;

View File

@ -23,7 +23,7 @@
namespace OHOS { namespace OHOS {
namespace Rosen { namespace Rosen {
static void SetDisplayObject(sptr<Display> &obj, RetStruct &ret) static void SetDisplayObject(sptr<Display> &obj, RetStruct& ret)
{ {
auto result = DisplayImpl::CreateDisplayImpl(obj); auto result = DisplayImpl::CreateDisplayImpl(obj);
if (result == nullptr || ret.data == nullptr) { if (result == nullptr || ret.data == nullptr) {
@ -42,7 +42,7 @@ static void SetDisplayObject(sptr<Display> &obj, RetStruct &ret)
ret.code = static_cast<int32_t>(DmErrorCode::DM_OK); ret.code = static_cast<int32_t>(DmErrorCode::DM_OK);
} }
static void SetDisplaysArrayObject(std::vector<sptr<Display>> &list, RetStruct &ret) static void SetDisplaysArrayObject(std::vector<sptr<Display>> &list, RetStruct& ret)
{ {
int64_t *displayImplIdList = static_cast<int64_t*>(malloc(sizeof(int64_t) * list.size())); int64_t *displayImplIdList = static_cast<int64_t*>(malloc(sizeof(int64_t) * list.size()));
if (displayImplIdList == nullptr) { if (displayImplIdList == nullptr) {

View File

@ -398,7 +398,7 @@ int32_t FFiOHOSWindowSetPreferredOrientation(int64_t id, uint32_t orientation)
return res; return res;
} }
int32_t FFiOHOSWindowGetWindowAvoidArea(int64_t id, uint32_t areaType, OHOS::Rosen::CAvoidArea *retPtr) int32_t FFiOHOSWindowGetWindowAvoidArea(int64_t id, uint32_t areaType, OHOS::Rosen::CAvoidArea* retPtr)
{ {
TLOGI(WmsLogTag::WMS_DIALOG, "[Window] FFiOHOSWindowGetWindowAvoidArea start"); TLOGI(WmsLogTag::WMS_DIALOG, "[Window] FFiOHOSWindowGetWindowAvoidArea start");
auto instance = FFIData::GetData<CJWindowImpl>(id); auto instance = FFIData::GetData<CJWindowImpl>(id);
@ -817,7 +817,7 @@ RetDataI64 FfiOHOSGetMainWindow(int64_t id)
return ret; return ret;
} }
RetDataI64 FfiOHOSCreateSubWindow(int64_t id, char *name) RetDataI64 FfiOHOSCreateSubWindow(int64_t id, char* name)
{ {
TLOGI(WmsLogTag::WMS_DIALOG, "[WindowStage] createSubWindow start"); TLOGI(WmsLogTag::WMS_DIALOG, "[WindowStage] createSubWindow start");
RetDataI64 ret; RetDataI64 ret;
@ -842,7 +842,7 @@ RetStruct FfiOHOSGetSubWindow(int64_t id)
return ret; return ret;
} }
int32_t FfiOHOSLoadContent(int64_t id, char *path) int32_t FfiOHOSLoadContent(int64_t id, char* path)
{ {
TLOGI(WmsLogTag::WMS_DIALOG, "[WindowStage] loadContent start"); TLOGI(WmsLogTag::WMS_DIALOG, "[WindowStage] loadContent start");
std::string url = path; std::string url = path;
@ -854,7 +854,7 @@ int32_t FfiOHOSLoadContent(int64_t id, char *path)
return instance->OnLoadContent(url, storageJson, false); return instance->OnLoadContent(url, storageJson, false);
} }
int32_t FfiOHOSLoadContentByName(int64_t id, char *name) int32_t FfiOHOSLoadContentByName(int64_t id, char* name)
{ {
TLOGI(WmsLogTag::WMS_DIALOG, "[WindowStage] loadContentByName start"); TLOGI(WmsLogTag::WMS_DIALOG, "[WindowStage] loadContentByName start");
return SUCCESS_CODE; return SUCCESS_CODE;

View File

@ -21,7 +21,7 @@
namespace OHOS { namespace OHOS {
namespace Rosen { namespace Rosen {
void CreateCjSubWindowArrayObject(std::vector<sptr<Window>> &vec, RetStruct &ret) void CreateCjSubWindowArrayObject(std::vector<sptr<Window>> &vec, RetStruct& ret)
{ {
int64_t *windowList = static_cast<int64_t *>(malloc(sizeof(int64_t) * vec.size())); int64_t *windowList = static_cast<int64_t *>(malloc(sizeof(int64_t) * vec.size()));
if (windowList == nullptr) { if (windowList == nullptr) {
@ -45,7 +45,7 @@ void CreateCjSubWindowArrayObject(std::vector<sptr<Window>> &vec, RetStruct &ret
return; return;
} }
int32_t CJWindowStageImpl::GetMainWindow(int64_t &windowId) int32_t CJWindowStageImpl::GetMainWindow(int64_t& windowId)
{ {
auto weakScene = windowScene_.lock(); auto weakScene = windowScene_.lock();
if (weakScene == nullptr) { if (weakScene == nullptr) {
@ -66,7 +66,7 @@ int32_t CJWindowStageImpl::GetMainWindow(int64_t &windowId)
return static_cast<int32_t>(WmErrorCode::WM_OK); return static_cast<int32_t>(WmErrorCode::WM_OK);
} }
int32_t CJWindowStageImpl::CreateSubWindow(std::string name, int64_t &windowId) int32_t CJWindowStageImpl::CreateSubWindow(std::string name, int64_t& windowId)
{ {
auto weakScene = windowScene_.lock(); auto weakScene = windowScene_.lock();
if (weakScene == nullptr) { if (weakScene == nullptr) {
@ -109,8 +109,8 @@ RetStruct CJWindowStageImpl::GetSubWindow()
return ret; return ret;
} }
int32_t CJWindowStageImpl::OnLoadContent(const std::string &contexUrl, int32_t CJWindowStageImpl::OnLoadContent(const std::string& contexUrl,
const std::string &storageJson, bool isLoadedByName) const std::string& storageJson, bool isLoadedByName)
{ {
auto weakScene = windowScene_.lock(); auto weakScene = windowScene_.lock();
if (weakScene == nullptr) { if (weakScene == nullptr) {

View File

@ -23,7 +23,7 @@
#include "ipc_skeleton.h" #include "ipc_skeleton.h"
namespace OHOS { namespace OHOS {
napi_status SetMemberInt32(napi_env env, napi_value result, const char *key, int32_t value) napi_status SetMemberInt32(napi_env env, napi_value result, const char* key, int32_t value)
{ {
napi_value num; napi_value num;
napi_status ret = napi_ok; napi_status ret = napi_ok;
@ -40,7 +40,7 @@ napi_status SetMemberInt32(napi_env env, napi_value result, const char *key, int
return ret; return ret;
} }
napi_status SetMemberUint32(napi_env env, napi_value result, const char *key, uint32_t value) napi_status SetMemberUint32(napi_env env, napi_value result, const char* key, uint32_t value)
{ {
napi_value num; napi_value num;
napi_status ret = napi_ok; napi_status ret = napi_ok;
@ -57,7 +57,7 @@ napi_status SetMemberUint32(napi_env env, napi_value result, const char *key, ui
return ret; return ret;
} }
napi_status SetMemberUndefined(napi_env env, napi_value result, const char *key) napi_status SetMemberUndefined(napi_env env, napi_value result, const char* key)
{ {
napi_value undefined; napi_value undefined;
napi_status ret = napi_ok; napi_status ret = napi_ok;
@ -74,7 +74,7 @@ napi_status SetMemberUndefined(napi_env env, napi_value result, const char *key)
return ret; return ret;
} }
bool CheckCallingPermission(const std::string &permission) bool CheckCallingPermission(const std::string& permission)
{ {
WLOGI("CheckCallingPermission, permission:%{public}s", permission.c_str()); WLOGI("CheckCallingPermission, permission:%{public}s", permission.c_str());
if (!permission.empty() && if (!permission.empty() &&

View File

@ -44,9 +44,9 @@ const int PARAM_NUMBER = 2; // 2: callback func input number, also reused by Pro
} while (0) } while (0)
namespace OHOS { namespace OHOS {
napi_status SetMemberInt32(napi_env env, napi_value result, const char *key, int32_t value); napi_status SetMemberInt32(napi_env env, napi_value result, const char* key, int32_t value);
napi_status SetMemberUint32(napi_env env, napi_value result, const char *key, uint32_t value); napi_status SetMemberUint32(napi_env env, napi_value result, const char* key, uint32_t value);
napi_status SetMemberUndefined(napi_env env, napi_value result, const char *key); napi_status SetMemberUndefined(napi_env env, napi_value result, const char* key);
bool CheckCallingPermission(const std::string& permission); bool CheckCallingPermission(const std::string& permission);
void SetErrorInfo(napi_env env, Rosen::DmErrorCode wret, const std::string& errMessage, void SetErrorInfo(napi_env env, Rosen::DmErrorCode wret, const std::string& errMessage,
@ -67,7 +67,7 @@ struct AsyncCallbackInfo {
}; };
template<typename ParamT> template<typename ParamT>
void AsyncFunc(napi_env env, void *data) void AsyncFunc(napi_env env, void* data)
{ {
AsyncCallbackInfo<ParamT> *info = reinterpret_cast<AsyncCallbackInfo<ParamT> *>(data); AsyncCallbackInfo<ParamT> *info = reinterpret_cast<AsyncCallbackInfo<ParamT> *>(data);
if (info->async) { if (info->async) {
@ -76,7 +76,7 @@ void AsyncFunc(napi_env env, void *data)
} }
template<typename ParamT> template<typename ParamT>
void CompleteFunc(napi_env env, napi_status status, void *data) void CompleteFunc(napi_env env, napi_status status, void* data)
{ {
AsyncCallbackInfo<ParamT> *info = reinterpret_cast<AsyncCallbackInfo<ParamT> *>(data); AsyncCallbackInfo<ParamT> *info = reinterpret_cast<AsyncCallbackInfo<ParamT> *>(data);
napi_value result[PARAM_NUMBER] = {nullptr}; napi_value result[PARAM_NUMBER] = {nullptr};

View File

@ -31,7 +31,7 @@ extern "C" __attribute__((constructor)) void NAPI_application_embeddablewindowst
} }
extern "C" __attribute__((visibility("default"))) extern "C" __attribute__((visibility("default")))
void NAPI_application_embeddablewindowstage_GetJSCode(const char **buf, int *bufLen) void NAPI_application_embeddablewindowstage_GetJSCode(const char **buf, int* bufLen)
{ {
if (buf != nullptr) { if (buf != nullptr) {
*buf = _binary_embeddable_window_stage_js_start; *buf = _binary_embeddable_window_stage_js_start;
@ -44,7 +44,7 @@ void NAPI_application_embeddablewindowstage_GetJSCode(const char **buf, int *buf
// embeddable_window_stage JS register // embeddable_window_stage JS register
extern "C" __attribute__((visibility("default"))) extern "C" __attribute__((visibility("default")))
void NAPI_application_embeddablewindowstage_GetABCCode(const char **buf, int *buflen) void NAPI_application_embeddablewindowstage_GetABCCode(const char **buf, int* buflen)
{ {
if (buf != nullptr) { if (buf != nullptr) {
*buf = _binary_embeddable_window_stage_abc_start; *buf = _binary_embeddable_window_stage_abc_start;

View File

@ -31,7 +31,7 @@ extern "C" __attribute__((constructor)) void NAPI_application_extensionWindow_Au
} }
extern "C" __attribute__((visibility("default"))) extern "C" __attribute__((visibility("default")))
void NAPI_application_extensionWindow_GetJSCode(const char **buf, int *bufLen) void NAPI_application_extensionWindow_GetJSCode(const char **buf, int* bufLen)
{ {
if (buf != nullptr) { if (buf != nullptr) {
*buf = _binary_extension_window_js_start; *buf = _binary_extension_window_js_start;
@ -44,7 +44,7 @@ void NAPI_application_extensionWindow_GetJSCode(const char **buf, int *bufLen)
// extension_window JS register // extension_window JS register
extern "C" __attribute__((visibility("default"))) extern "C" __attribute__((visibility("default")))
void NAPI_application_extensionWindow_GetABCCode(const char **buf, int *buflen) void NAPI_application_extensionWindow_GetABCCode(const char **buf, int* buflen)
{ {
if (buf != nullptr) { if (buf != nullptr) {
*buf = _binary_extension_window_abc_start; *buf = _binary_extension_window_abc_start;

View File

@ -125,7 +125,7 @@ void JsExtensionWindowListener::OnAvoidAreaChanged(const AvoidArea avoidArea, Av
TLOGI(WmsLogTag::WMS_UIEXT, "[NAPI]OnAvoidAreaChanged"); TLOGI(WmsLogTag::WMS_UIEXT, "[NAPI]OnAvoidAreaChanged");
// js callback should run in js thread // js callback should run in js thread
std::unique_ptr<NapiAsyncTask::CompleteCallback> complete = std::make_unique<NapiAsyncTask::CompleteCallback> ( std::unique_ptr<NapiAsyncTask::CompleteCallback> complete = std::make_unique<NapiAsyncTask::CompleteCallback> (
[self = weakRef_, avoidArea, type, eng = env_] (napi_env env, NapiAsyncTask &task, int32_t status) { [self = weakRef_, avoidArea, type, eng = env_] (napi_env env, NapiAsyncTask& task, int32_t status) {
auto thisListener = self.promote(); auto thisListener = self.promote();
if (thisListener == nullptr || eng == nullptr) { if (thisListener == nullptr || eng == nullptr) {
TLOGE(WmsLogTag::WMS_UIEXT, "[NAPI]this listener or eng is nullptr"); TLOGE(WmsLogTag::WMS_UIEXT, "[NAPI]this listener or eng is nullptr");

View File

@ -36,7 +36,7 @@ namespace {
const std::string CONTROL_EVENT_CB = "controlEvent"; const std::string CONTROL_EVENT_CB = "controlEvent";
} }
void BindFunctions(napi_env env, napi_value object, const char *moduleName) void BindFunctions(napi_env env, napi_value object, const char* moduleName)
{ {
BindNativeFunction(env, object, "startPiP", moduleName, JsPipController::StartPictureInPicture); BindNativeFunction(env, object, "startPiP", moduleName, JsPipController::StartPictureInPicture);
BindNativeFunction(env, object, "stopPiP", moduleName, JsPipController::StopPictureInPicture); BindNativeFunction(env, object, "stopPiP", moduleName, JsPipController::StopPictureInPicture);

View File

@ -61,7 +61,7 @@ static napi_valuetype GetType(napi_env env, napi_value root)
return res; return res;
} }
static void GetDisplayId(napi_env env, std::unique_ptr<Param> &param, napi_value &argv) static void GetDisplayId(napi_env env, std::unique_ptr<Param>& param, napi_value& argv)
{ {
GNAPI_LOG("Get Screenshot Option: GetDisplayId"); GNAPI_LOG("Get Screenshot Option: GetDisplayId");
napi_value displayId; napi_value displayId;
@ -76,7 +76,7 @@ static void GetDisplayId(napi_env env, std::unique_ptr<Param> &param, napi_value
} }
} }
static void GetRotation(napi_env env, std::unique_ptr<Param> &param, napi_value &argv) static void GetRotation(napi_env env, std::unique_ptr<Param>& param, napi_value& argv)
{ {
GNAPI_LOG("Get Screenshot Option: GetRotation"); GNAPI_LOG("Get Screenshot Option: GetRotation");
napi_value rotation; napi_value rotation;
@ -89,7 +89,7 @@ static void GetRotation(napi_env env, std::unique_ptr<Param> &param, napi_value
} }
} }
static void GetScreenRect(napi_env env, std::unique_ptr<Param> &param, napi_value &argv) static void GetScreenRect(napi_env env, std::unique_ptr<Param>& param, napi_value& argv)
{ {
GNAPI_LOG("Get Screenshot Option: GetScreenRect"); GNAPI_LOG("Get Screenshot Option: GetScreenRect");
napi_value screenRect; napi_value screenRect;
@ -137,7 +137,7 @@ static void GetScreenRect(napi_env env, std::unique_ptr<Param> &param, napi_valu
} }
} }
static void GetImageSize(napi_env env, std::unique_ptr<Param> &param, napi_value &argv) static void GetImageSize(napi_env env, std::unique_ptr<Param>& param, napi_value& argv)
{ {
GNAPI_LOG("Get Screenshot Option: ImageSize"); GNAPI_LOG("Get Screenshot Option: ImageSize");
napi_value imageSize; napi_value imageSize;
@ -163,7 +163,7 @@ static void GetImageSize(napi_env env, std::unique_ptr<Param> &param, napi_value
} }
} }
static void GetScreenshotParam(napi_env env, std::unique_ptr<Param> &param, napi_value &argv) static void GetScreenshotParam(napi_env env, std::unique_ptr<Param>& param, napi_value& argv)
{ {
if (param == nullptr) { if (param == nullptr) {
GNAPI_LOG("param == nullptr, use default param"); GNAPI_LOG("param == nullptr, use default param");
@ -333,7 +333,7 @@ napi_value MainFunc(napi_env env, napi_callback_info info)
} }
} // namespace save } // namespace save
void SetNamedProperty(napi_env env, napi_value dstObj, const int32_t objValue, const char *propName) void SetNamedProperty(napi_env env, napi_value dstObj, const int32_t objValue, const char* propName)
{ {
napi_value prop = nullptr; napi_value prop = nullptr;
napi_create_int32(env, objValue, &prop); napi_create_int32(env, objValue, &prop);

View File

@ -32,7 +32,7 @@ void NAPI_application_WindowExtensionAbility_AutoRegister()
} }
extern "C" __attribute__((visibility("default"))) extern "C" __attribute__((visibility("default")))
void NAPI_application_WindowExtensionAbility_GetJSCode(const char **buf, int *bufLen) void NAPI_application_WindowExtensionAbility_GetJSCode(const char** buf, int* bufLen)
{ {
if (buf != nullptr) { if (buf != nullptr) {
*buf = _binary_window_extension_ability_js_start; *buf = _binary_window_extension_ability_js_start;
@ -44,7 +44,7 @@ void NAPI_application_WindowExtensionAbility_GetJSCode(const char **buf, int *bu
} }
extern "C" __attribute__((visibility("default"))) extern "C" __attribute__((visibility("default")))
void NAPI_application_WindowExtensionAbility_GetABCCode(const char **buf, int *buflen) void NAPI_application_WindowExtensionAbility_GetABCCode(const char** buf, int* buflen)
{ {
if (buf != nullptr) { if (buf != nullptr) {
*buf = _binary_window_extension_ability_abc_start; *buf = _binary_window_extension_ability_abc_start;

View File

@ -31,7 +31,7 @@ extern "C" __attribute__((constructor)) void NAPI_application_WindowExtensionCon
} }
extern "C" __attribute__((visibility("default"))) void NAPI_application_WindowExtensionContext_GetJSCode( extern "C" __attribute__((visibility("default"))) void NAPI_application_WindowExtensionContext_GetJSCode(
const char **buf, int *bufLen) const char** buf, int* bufLen)
{ {
if (buf != nullptr) { if (buf != nullptr) {
*buf = _binary_window_extension_context_js_start; *buf = _binary_window_extension_context_js_start;
@ -44,7 +44,7 @@ extern "C" __attribute__((visibility("default"))) void NAPI_application_WindowEx
// window extension context JS register // window extension context JS register
extern "C" __attribute__((visibility("default"))) void NAPI_application_WindowExtensionContext_GetABCCode( extern "C" __attribute__((visibility("default"))) void NAPI_application_WindowExtensionContext_GetABCCode(
const char **buf, int *buflen) const char** buf, int* buflen)
{ {
if (buf != nullptr) { if (buf != nullptr) {
*buf = _binary_window_extension_context_abc_start; *buf = _binary_window_extension_context_abc_start;

View File

@ -2493,7 +2493,7 @@ napi_value JsWindow::OnDisableLandscapeMultiWindow(napi_env env, napi_callback_i
wptr<Window> weakToken(windowToken_); wptr<Window> weakToken(windowToken_);
NapiAsyncTask::CompleteCallback complete = NapiAsyncTask::CompleteCallback complete =
[weakToken, err](napi_env env, NapiAsyncTask &task, int32_t status) mutable { [weakToken, err](napi_env env, NapiAsyncTask& task, int32_t status) mutable {
auto weakWindow = weakToken.promote(); auto weakWindow = weakToken.promote();
err = (weakWindow == nullptr) ? WmErrorCode::WM_ERROR_STATE_ABNORMALLY : err; err = (weakWindow == nullptr) ? WmErrorCode::WM_ERROR_STATE_ABNORMALLY : err;
if (err != WmErrorCode::WM_OK) { if (err != WmErrorCode::WM_OK) {
@ -3930,7 +3930,7 @@ napi_value JsWindow::OnSetSingleFrameComposerEnabled(napi_env env, napi_callback
return result; return result;
} }
void GetSubWindowId(napi_env env, napi_value nativeVal, WmErrorCode &errCode, int32_t &subWindowId) void GetSubWindowId(napi_env env, napi_value nativeVal, WmErrorCode& errCode, int32_t& subWindowId)
{ {
if (nativeVal == nullptr) { if (nativeVal == nullptr) {
WLOGFE("Failed to get subWindowId"); WLOGFE("Failed to get subWindowId");
@ -6051,7 +6051,7 @@ napi_value JsWindow::OnIsFocused(napi_env env, napi_callback_info info)
return CreateJsValue(env, isFocused); return CreateJsValue(env, isFocused);
} }
void BindFunctions(napi_env env, napi_value object, const char *moduleName) void BindFunctions(napi_env env, napi_value object, const char* moduleName)
{ {
BindNativeFunction(env, object, "show", moduleName, JsWindow::Show); BindNativeFunction(env, object, "show", moduleName, JsWindow::Show);
BindNativeFunction(env, object, "showWindow", moduleName, JsWindow::ShowWindow); BindNativeFunction(env, object, "showWindow", moduleName, JsWindow::ShowWindow);

View File

@ -33,7 +33,7 @@ namespace OHOS {
namespace Rosen { namespace Rosen {
napi_value CreateJsWindowObject(napi_env env, sptr<Window>& window); napi_value CreateJsWindowObject(napi_env env, sptr<Window>& window);
std::shared_ptr<NativeReference> FindJsWindowObject(const std::string& windowName); std::shared_ptr<NativeReference> FindJsWindowObject(const std::string& windowName);
void BindFunctions(napi_env env, napi_value object, const char *moduleName); void BindFunctions(napi_env env, napi_value object, const char* moduleName);
napi_value NapiGetUndefined(napi_env env); napi_value NapiGetUndefined(napi_env env);
napi_valuetype GetType(napi_env env, napi_value value); napi_valuetype GetType(napi_env env, napi_value value);
bool NapiIsCallable(napi_env env, napi_value value); bool NapiIsCallable(napi_env env, napi_value value);

View File

@ -118,7 +118,7 @@ void JsWindowListener::OnSystemBarPropertyChange(DisplayId displayId, const Syst
// js callback should run in js thread // js callback should run in js thread
std::unique_ptr<NapiAsyncTask::CompleteCallback> complete = std::make_unique<NapiAsyncTask::CompleteCallback> ( std::unique_ptr<NapiAsyncTask::CompleteCallback> complete = std::make_unique<NapiAsyncTask::CompleteCallback> (
[self = weakRef_, displayId, tints, eng = env_] (napi_env env, [self = weakRef_, displayId, tints, eng = env_] (napi_env env,
NapiAsyncTask &task, int32_t status) { NapiAsyncTask& task, int32_t status) {
auto thisListener = self.promote(); auto thisListener = self.promote();
if (thisListener == nullptr || eng == nullptr) { if (thisListener == nullptr || eng == nullptr) {
@ -152,7 +152,7 @@ void JsWindowListener::OnAvoidAreaChanged(const AvoidArea avoidArea, AvoidAreaTy
// js callback should run in js thread // js callback should run in js thread
std::unique_ptr<NapiAsyncTask::CompleteCallback> complete = std::make_unique<NapiAsyncTask::CompleteCallback> ( std::unique_ptr<NapiAsyncTask::CompleteCallback> complete = std::make_unique<NapiAsyncTask::CompleteCallback> (
[self = weakRef_, avoidArea, type, eng = env_] (napi_env env, [self = weakRef_, avoidArea, type, eng = env_] (napi_env env,
NapiAsyncTask &task, int32_t status) { NapiAsyncTask& task, int32_t status) {
auto thisListener = self.promote(); auto thisListener = self.promote();
if (thisListener == nullptr || eng == nullptr) { if (thisListener == nullptr || eng == nullptr) {
WLOGFE("[NAPI]this listener or eng is nullptr"); WLOGFE("[NAPI]this listener or eng is nullptr");
@ -270,7 +270,7 @@ void JsWindowListener::OnSizeChange(const sptr<OccupiedAreaChangeInfo>& info,
// js callback should run in js thread // js callback should run in js thread
std::unique_ptr<NapiAsyncTask::CompleteCallback> complete = std::make_unique<NapiAsyncTask::CompleteCallback> ( std::unique_ptr<NapiAsyncTask::CompleteCallback> complete = std::make_unique<NapiAsyncTask::CompleteCallback> (
[self = weakRef_, info, eng = env_] (napi_env env, [self = weakRef_, info, eng = env_] (napi_env env,
NapiAsyncTask &task, int32_t status) { NapiAsyncTask& task, int32_t status) {
auto thisListener = self.promote(); auto thisListener = self.promote();
if (thisListener == nullptr || eng == nullptr) { if (thisListener == nullptr || eng == nullptr) {
WLOGFE("[NAPI]this listener or eng is nullptr"); WLOGFE("[NAPI]this listener or eng is nullptr");
@ -291,7 +291,7 @@ void JsWindowListener::OnTouchOutside() const
{ {
WLOGI("CALLED"); WLOGI("CALLED");
std::unique_ptr<NapiAsyncTask::CompleteCallback> complete = std::make_unique<NapiAsyncTask::CompleteCallback> ( std::unique_ptr<NapiAsyncTask::CompleteCallback> complete = std::make_unique<NapiAsyncTask::CompleteCallback> (
[self = weakRef_] (napi_env env, NapiAsyncTask &task, int32_t status) { [self = weakRef_] (napi_env env, NapiAsyncTask& task, int32_t status) {
auto thisListener = self.promote(); auto thisListener = self.promote();
if (thisListener == nullptr) { if (thisListener == nullptr) {
WLOGFE("[NAPI]this listener is nullptr"); WLOGFE("[NAPI]this listener is nullptr");
@ -311,7 +311,7 @@ void JsWindowListener::OnScreenshot()
{ {
WLOGI("CALLED"); WLOGI("CALLED");
std::unique_ptr<NapiAsyncTask::CompleteCallback> complete = std::make_unique<NapiAsyncTask::CompleteCallback> ( std::unique_ptr<NapiAsyncTask::CompleteCallback> complete = std::make_unique<NapiAsyncTask::CompleteCallback> (
[self = wptr<JsWindowListener>(this)] (napi_env env, NapiAsyncTask &task, int32_t status) { [self = wptr<JsWindowListener>(this)] (napi_env env, NapiAsyncTask& task, int32_t status) {
auto thisListener = self.promote(); auto thisListener = self.promote();
if (thisListener == nullptr) { if (thisListener == nullptr) {
WLOGFE("[NAPI]this listener is nullptr"); WLOGFE("[NAPI]this listener is nullptr");
@ -330,7 +330,7 @@ void JsWindowListener::OnScreenshot()
void JsWindowListener::OnDialogTargetTouch() const void JsWindowListener::OnDialogTargetTouch() const
{ {
std::unique_ptr<NapiAsyncTask::CompleteCallback> complete = std::make_unique<NapiAsyncTask::CompleteCallback> ( std::unique_ptr<NapiAsyncTask::CompleteCallback> complete = std::make_unique<NapiAsyncTask::CompleteCallback> (
[self = weakRef_] (napi_env env, NapiAsyncTask &task, int32_t status) { [self = weakRef_] (napi_env env, NapiAsyncTask& task, int32_t status) {
auto thisListener = self.promote(); auto thisListener = self.promote();
if (thisListener == nullptr) { if (thisListener == nullptr) {
WLOGFE("[NAPI]this listener is nullptr"); WLOGFE("[NAPI]this listener is nullptr");
@ -349,7 +349,7 @@ void JsWindowListener::OnDialogTargetTouch() const
void JsWindowListener::OnDialogDeathRecipient() const void JsWindowListener::OnDialogDeathRecipient() const
{ {
std::unique_ptr<NapiAsyncTask::CompleteCallback> complete = std::make_unique<NapiAsyncTask::CompleteCallback> ( std::unique_ptr<NapiAsyncTask::CompleteCallback> complete = std::make_unique<NapiAsyncTask::CompleteCallback> (
[self = weakRef_] (napi_env env, NapiAsyncTask &task, int32_t status) { [self = weakRef_] (napi_env env, NapiAsyncTask& task, int32_t status) {
auto thisListener = self.promote(); auto thisListener = self.promote();
if (thisListener == nullptr) { if (thisListener == nullptr) {
WLOGFE("[NAPI]this listener is nullptr"); WLOGFE("[NAPI]this listener is nullptr");
@ -368,7 +368,7 @@ void JsWindowListener::OnDialogDeathRecipient() const
void JsWindowListener::OnGestureNavigationEnabledUpdate(bool enable) void JsWindowListener::OnGestureNavigationEnabledUpdate(bool enable)
{ {
std::unique_ptr<NapiAsyncTask::CompleteCallback> complete = std::make_unique<NapiAsyncTask::CompleteCallback> ( std::unique_ptr<NapiAsyncTask::CompleteCallback> complete = std::make_unique<NapiAsyncTask::CompleteCallback> (
[self = weakRef_, enable, eng = env_] (napi_env env, NapiAsyncTask &task, int32_t status) { [self = weakRef_, enable, eng = env_] (napi_env env, NapiAsyncTask& task, int32_t status) {
auto thisListener = self.promote(); auto thisListener = self.promote();
if (thisListener == nullptr || eng == nullptr) { if (thisListener == nullptr || eng == nullptr) {
WLOGFE("[NAPI]this listener or eng is nullptr"); WLOGFE("[NAPI]this listener or eng is nullptr");
@ -388,7 +388,7 @@ void JsWindowListener::OnGestureNavigationEnabledUpdate(bool enable)
void JsWindowListener::OnWaterMarkFlagUpdate(bool showWaterMark) void JsWindowListener::OnWaterMarkFlagUpdate(bool showWaterMark)
{ {
std::unique_ptr<NapiAsyncTask::CompleteCallback> complete = std::make_unique<NapiAsyncTask::CompleteCallback> ( std::unique_ptr<NapiAsyncTask::CompleteCallback> complete = std::make_unique<NapiAsyncTask::CompleteCallback> (
[self = weakRef_, showWaterMark, eng = env_] (napi_env env, NapiAsyncTask &task, int32_t status) { [self = weakRef_, showWaterMark, eng = env_] (napi_env env, NapiAsyncTask& task, int32_t status) {
auto thisListener = self.promote(); auto thisListener = self.promote();
if (thisListener == nullptr || eng == nullptr) { if (thisListener == nullptr || eng == nullptr) {
WLOGFE("[NAPI]this listener or eng is nullptr"); WLOGFE("[NAPI]this listener or eng is nullptr");
@ -418,7 +418,7 @@ int64_t JsWindowListener::GetTimeout() const
void JsWindowListener::OnWindowNoInteractionCallback() void JsWindowListener::OnWindowNoInteractionCallback()
{ {
std::unique_ptr<NapiAsyncTask::CompleteCallback> complete = std::make_unique<NapiAsyncTask::CompleteCallback> ( std::unique_ptr<NapiAsyncTask::CompleteCallback> complete = std::make_unique<NapiAsyncTask::CompleteCallback> (
[self = weakRef_] (napi_env env, NapiAsyncTask &task, int32_t status) { [self = weakRef_] (napi_env env, NapiAsyncTask& task, int32_t status) {
auto thisListener = self.promote(); auto thisListener = self.promote();
if (thisListener == nullptr) { if (thisListener == nullptr) {
WLOGFE("[NAPI]this listener is nullptr"); WLOGFE("[NAPI]this listener is nullptr");
@ -440,7 +440,7 @@ void JsWindowListener::OnWindowStatusChange(WindowStatus windowstatus)
// js callback should run in js thread // js callback should run in js thread
std::unique_ptr<NapiAsyncTask::CompleteCallback> complete = std::make_unique<NapiAsyncTask::CompleteCallback> ( std::unique_ptr<NapiAsyncTask::CompleteCallback> complete = std::make_unique<NapiAsyncTask::CompleteCallback> (
[self = weakRef_, windowstatus, eng = env_] (napi_env env, [self = weakRef_, windowstatus, eng = env_] (napi_env env,
NapiAsyncTask &task, int32_t status) { NapiAsyncTask& task, int32_t status) {
auto thisListener = self.promote(); auto thisListener = self.promote();
if (thisListener == nullptr || eng == nullptr) { if (thisListener == nullptr || eng == nullptr) {
WLOGFE("[NAPI]this listener or eng is nullptr"); WLOGFE("[NAPI]this listener or eng is nullptr");
@ -463,7 +463,7 @@ void JsWindowListener::OnWindowStatusChange(WindowStatus windowstatus)
void JsWindowListener::OnWindowVisibilityChangedCallback(const bool isVisible) void JsWindowListener::OnWindowVisibilityChangedCallback(const bool isVisible)
{ {
std::unique_ptr<NapiAsyncTask::CompleteCallback> complete = std::make_unique<NapiAsyncTask::CompleteCallback>( std::unique_ptr<NapiAsyncTask::CompleteCallback> complete = std::make_unique<NapiAsyncTask::CompleteCallback>(
[self = weakRef_, isVisible, eng = env_] (napi_env env, NapiAsyncTask &task, int32_t status) { [self = weakRef_, isVisible, eng = env_] (napi_env env, NapiAsyncTask& task, int32_t status) {
auto thisListener = self.promote(); auto thisListener = self.promote();
if (thisListener == nullptr || eng == nullptr) { if (thisListener == nullptr || eng == nullptr) {
WLOGFE("This listener or eng is nullptr"); WLOGFE("This listener or eng is nullptr");
@ -485,7 +485,7 @@ void JsWindowListener::OnWindowTitleButtonRectChanged(const TitleButtonRect& tit
WLOGFD("[NAPI]OnWindowTitleButtonRectChanged"); WLOGFD("[NAPI]OnWindowTitleButtonRectChanged");
std::unique_ptr<NapiAsyncTask::CompleteCallback> complete = std::make_unique<NapiAsyncTask::CompleteCallback> ( std::unique_ptr<NapiAsyncTask::CompleteCallback> complete = std::make_unique<NapiAsyncTask::CompleteCallback> (
[self = weakRef_, titleButtonRect, eng = env_] (napi_env env, [self = weakRef_, titleButtonRect, eng = env_] (napi_env env,
NapiAsyncTask &task, int32_t status) { NapiAsyncTask& task, int32_t status) {
auto thisListener = self.promote(); auto thisListener = self.promote();
if (thisListener == nullptr || eng == nullptr) { if (thisListener == nullptr || eng == nullptr) {
WLOGFE("[NAPI]this listener or eng is nullptr"); WLOGFE("[NAPI]this listener or eng is nullptr");

View File

@ -728,7 +728,7 @@ napi_value CreateJsWindowStage(napi_env env, std::shared_ptr<Rosen::WindowScene>
std::unique_ptr<JsWindowStage> jsWindowStage = std::make_unique<JsWindowStage>(windowScene); std::unique_ptr<JsWindowStage> jsWindowStage = std::make_unique<JsWindowStage>(windowScene);
napi_wrap(env, objValue, jsWindowStage.release(), JsWindowStage::Finalizer, nullptr, nullptr); napi_wrap(env, objValue, jsWindowStage.release(), JsWindowStage::Finalizer, nullptr, nullptr);
const char *moduleName = "JsWindowStage"; const char* moduleName = "JsWindowStage";
BindNativeFunction(env, BindNativeFunction(env,
objValue, "setUIContent", moduleName, JsWindowStage::SetUIContent); objValue, "setUIContent", moduleName, JsWindowStage::SetUIContent);
BindNativeFunction(env, BindNativeFunction(env,

View File

@ -31,7 +31,7 @@ extern "C" __attribute__((constructor)) void NAPI_application_WindowStage_AutoRe
} }
extern "C" __attribute__((visibility("default"))) extern "C" __attribute__((visibility("default")))
void NAPI_application_WindowStage_GetJSCode(const char **buf, int *bufLen) void NAPI_application_WindowStage_GetJSCode(const char** buf, int* bufLen)
{ {
if (buf != nullptr) { if (buf != nullptr) {
*buf = _binary_window_stage_js_start; *buf = _binary_window_stage_js_start;
@ -44,7 +44,7 @@ void NAPI_application_WindowStage_GetJSCode(const char **buf, int *bufLen)
// window_stage JS register // window_stage JS register
extern "C" __attribute__((visibility("default"))) extern "C" __attribute__((visibility("default")))
void NAPI_application_WindowStage_GetABCCode(const char **buf, int *buflen) void NAPI_application_WindowStage_GetABCCode(const char** buf, int* buflen)
{ {
if (buf != nullptr) { if (buf != nullptr) {
*buf = _binary_window_stage_abc_start; *buf = _binary_window_stage_abc_start;

View File

@ -39,7 +39,7 @@ public:
: env_(env), jsCallBack_(callback), weakRef_(wptr<JsWindowListener>(this)) {} : env_(env), jsCallBack_(callback), weakRef_(wptr<JsWindowListener>(this)) {}
~JsWindowListener(); ~JsWindowListener();
void OnAvoidAreaChanged(const AvoidArea avoidArea, AvoidAreaType type) override; void OnAvoidAreaChanged(const AvoidArea avoidArea, AvoidAreaType type) override;
void CallJsMethod(const char* methodName, napi_value const *argv = nullptr, size_t argc = 0); void CallJsMethod(const char* methodName, napi_value const* argv = nullptr, size_t argc = 0);
void SetMainEventHandler(); void SetMainEventHandler();
private: private:

View File

@ -33,7 +33,7 @@ public:
SetResolutionUtils() = default; SetResolutionUtils() = default;
~SetResolutionUtils() = default; ~SetResolutionUtils() = default;
static void PrintUsage(const std::string &cmdLine); static void PrintUsage(const std::string& cmdLine);
static bool ProcessArgs(int argc, char * const argv[], CmdArgments& cmdArgments); static bool ProcessArgs(int argc, char * const argv[], CmdArgments& cmdArgments);
}; };
} }

View File

@ -29,7 +29,7 @@ constexpr int32_t DEBUG_ON_DEFAULT = 0;
static const std::string ENG_PARAMETER = "const.debuggable"; static const std::string ENG_PARAMETER = "const.debuggable";
static const bool IS_ENG_MODE = static_cast<bool>(GetIntParameter(ENG_PARAMETER, DEBUG_ON_DEFAULT)); static const bool IS_ENG_MODE = static_cast<bool>(GetIntParameter(ENG_PARAMETER, DEBUG_ON_DEFAULT));
int main(int argc, char *argv[]) int main(int argc, char* argv[])
{ {
CmdArgments cmdArgments; CmdArgments cmdArgments;

View File

@ -20,13 +20,13 @@
#include <string> #include <string>
namespace OHOS { namespace OHOS {
void SetResolutionUtils::PrintUsage(const std::string &cmdLine) void SetResolutionUtils::PrintUsage(const std::string& cmdLine)
{ {
std::cout << "usage: " << cmdLine.c_str() << std::cout << "usage: " << cmdLine.c_str() <<
" [-w width] [-h height] [-d dpi] [-m]" << std::endl; " [-w width] [-h height] [-d dpi] [-m]" << std::endl;
} }
bool SetResolutionUtils::ProcessArgs(int argc, char * const argv[], CmdArgments &cmdArgments) bool SetResolutionUtils::ProcessArgs(int argc, char * const argv[], CmdArgments& cmdArgments)
{ {
int opt = 0; int opt = 0;
const struct option longOption[] = { const struct option longOption[] = {

View File

@ -49,23 +49,23 @@ public:
SnapShotUtils() = default; SnapShotUtils() = default;
~SnapShotUtils() = default; ~SnapShotUtils() = default;
static void PrintUsage(const std::string &cmdLine); static void PrintUsage(const std::string& cmdLine);
static bool CheckFileNameValid(const std::string &fileName, std::string fileType = "jpeg"); static bool CheckFileNameValid(const std::string& fileName, std::string fileType = "jpeg");
static std::string GenerateFileName(std::string fileType, int offset = 0); static std::string GenerateFileName(std::string fileType, int offset = 0);
static bool CheckWidthAndHeightValid(int32_t w, int32_t h); static bool CheckWidthAndHeightValid(int32_t w, int32_t h);
static bool RGBA8888ToRGB888(const uint8_t* rgba8888Buf, uint8_t *rgb888Buf, int32_t size); static bool RGBA8888ToRGB888(const uint8_t* rgba8888Buf, uint8_t* rgb888Buf, int32_t size);
static bool RGB565ToRGB888(const uint8_t* rgb565Buf, uint8_t *rgb888Buf, int32_t size); static bool RGB565ToRGB888(const uint8_t* rgb565Buf, uint8_t* rgb888Buf, int32_t size);
static bool WriteRgb888ToJpeg(FILE* file, uint32_t width, uint32_t height, const uint8_t* data); static bool WriteRgb888ToJpeg(FILE* file, uint32_t width, uint32_t height, const uint8_t* data);
static bool WriteToJpeg(const std::string &fileName, const WriteToJpegParam &param); static bool WriteToJpeg(const std::string& fileName, const WriteToJpegParam& param);
static bool WriteToJpeg(int fd, const WriteToJpegParam &param); static bool WriteToJpeg(int fd, const WriteToJpegParam& param);
static bool WriteToJpegWithPixelMap(const std::string &fileName, Media::PixelMap &pixelMap); static bool WriteToJpegWithPixelMap(const std::string& fileName, Media::PixelMap& pixelMap);
static bool WriteToJpegWithPixelMap(int fd, Media::PixelMap &pixelMap); static bool WriteToJpegWithPixelMap(int fd, Media::PixelMap& pixelMap);
static bool ProcessArgs(int argc, char * const argv[], CmdArguments& cmdArgments); static bool ProcessArgs(int argc, char * const argv[], CmdArguments& cmdArgments);
static bool CheckWHValid(int32_t param); static bool CheckWHValid(int32_t param);
static bool CheckParamValid(const WriteToJpegParam &param); static bool CheckParamValid(const WriteToJpegParam& param);
static bool SaveSnapShot(const std::string &filename, Media::PixelMap &pixelMap, std::string fileType = "jpeg"); static bool SaveSnapShot(const std::string& filename, Media::PixelMap& pixelMap, std::string fileType = "jpeg");
private: private:
static bool ProcessDisplayId(Rosen::DisplayId &displayId, bool isDisplayIdSet); static bool ProcessDisplayId(Rosen::DisplayId& displayId, bool isDisplayIdSet);
}; };
} }

View File

@ -38,7 +38,7 @@ static const std::string IS_DEVELOPER_MODE = GetParameter(DEVELOPER_MODE_PARAMET
static bool GetScreenshotByCmdArguments(CmdArguments& cmdArguments, sptr<Display> display, static bool GetScreenshotByCmdArguments(CmdArguments& cmdArguments, sptr<Display> display,
std::shared_ptr<OHOS::Media::PixelMap>& pixelMap); std::shared_ptr<OHOS::Media::PixelMap>& pixelMap);
int main(int argc, char *argv[]) int main(int argc, char* argv[])
{ {
CmdArguments cmdArguments; CmdArguments cmdArguments;
cmdArguments.fileName = ""; cmdArguments.fileName = "";

View File

@ -80,7 +80,7 @@ const char *DEFAULT_SNAPSHOT_PREFIX = "/snapshot";
const char *VALID_SNAPSHOT_SUFFIX = ".jpeg"; const char *VALID_SNAPSHOT_SUFFIX = ".jpeg";
const char *VALID_SNAPSHOT_PNG_SUFFIX = ".png"; const char *VALID_SNAPSHOT_PNG_SUFFIX = ".png";
void SnapShotUtils::PrintUsage(const std::string &cmdLine) void SnapShotUtils::PrintUsage(const std::string& cmdLine)
{ {
std::cout << "usage: " << cmdLine.c_str() << std::cout << "usage: " << cmdLine.c_str() <<
" [-i displayId] [-f output_file] [-w width] [-h height] [-t type] [-m]" << std::endl; " [-i displayId] [-f output_file] [-w width] [-h height] [-t type] [-m]" << std::endl;
@ -108,7 +108,7 @@ std::string SnapShotUtils::GenerateFileName(std::string fileType, int offset)
return fileName; return fileName;
} }
bool SnapShotUtils::CheckFileNameValid(const std::string &fileName, std::string fileType) bool SnapShotUtils::CheckFileNameValid(const std::string& fileName, std::string fileType)
{ {
std::cout << "fileType: " << fileType << std::endl; std::cout << "fileType: " << fileType << std::endl;
size_t fileMinLength = (fileType == "png") ? strlen(VALID_SNAPSHOT_PNG_SUFFIX) : strlen(VALID_SNAPSHOT_SUFFIX); size_t fileMinLength = (fileType == "png") ? strlen(VALID_SNAPSHOT_PNG_SUFFIX) : strlen(VALID_SNAPSHOT_SUFFIX);
@ -156,7 +156,7 @@ bool SnapShotUtils::CheckWidthAndHeightValid(int32_t w, int32_t h)
return CheckWHValid(w) && CheckWHValid(h); return CheckWHValid(w) && CheckWHValid(h);
} }
bool SnapShotUtils::CheckParamValid(const WriteToJpegParam &param) bool SnapShotUtils::CheckParamValid(const WriteToJpegParam& param)
{ {
switch (param.format) { switch (param.format) {
case Media::PixelFormat::RGBA_8888: case Media::PixelFormat::RGBA_8888:
@ -188,7 +188,7 @@ bool SnapShotUtils::CheckParamValid(const WriteToJpegParam &param)
return true; return true;
} }
bool SnapShotUtils::RGBA8888ToRGB888(const uint8_t* rgba8888Buf, uint8_t *rgb888Buf, int32_t size) bool SnapShotUtils::RGBA8888ToRGB888(const uint8_t* rgba8888Buf, uint8_t* rgb888Buf, int32_t size)
{ {
if (rgba8888Buf == nullptr || rgb888Buf == nullptr || size <= 0) { if (rgba8888Buf == nullptr || rgb888Buf == nullptr || size <= 0) {
std::cout << __func__ << ": params are invalid." << std::endl; std::cout << __func__ << ": params are invalid." << std::endl;
@ -203,7 +203,7 @@ bool SnapShotUtils::RGBA8888ToRGB888(const uint8_t* rgba8888Buf, uint8_t *rgb888
return true; return true;
} }
bool SnapShotUtils::RGB565ToRGB888(const uint8_t* rgb565Buf, uint8_t *rgb888Buf, int32_t size) bool SnapShotUtils::RGB565ToRGB888(const uint8_t* rgb565Buf, uint8_t* rgb888Buf, int32_t size)
{ {
if (rgb565Buf == nullptr || rgb888Buf == nullptr || size <= 0) { if (rgb565Buf == nullptr || rgb888Buf == nullptr || size <= 0) {
std::cout << __func__ << ": params are invalid." << std::endl; std::cout << __func__ << ": params are invalid." << std::endl;
@ -267,7 +267,7 @@ bool SnapShotUtils::WriteRgb888ToJpeg(FILE* file, uint32_t width, uint32_t heigh
return true; return true;
} }
bool SnapShotUtils::WriteToJpeg(const std::string &fileName, const WriteToJpegParam &param) bool SnapShotUtils::WriteToJpeg(const std::string& fileName, const WriteToJpegParam& param)
{ {
bool ret = false; bool ret = false;
if (!CheckFileNameValid(fileName)) { if (!CheckFileNameValid(fileName)) {
@ -315,7 +315,7 @@ bool SnapShotUtils::WriteToJpeg(const std::string &fileName, const WriteToJpegPa
return ret; return ret;
} }
bool SnapShotUtils::WriteToJpeg(int fd, const WriteToJpegParam &param) bool SnapShotUtils::WriteToJpeg(int fd, const WriteToJpegParam& param)
{ {
bool ret = false; bool ret = false;
if (!CheckParamValid(param)) { if (!CheckParamValid(param)) {
@ -358,7 +358,7 @@ bool SnapShotUtils::WriteToJpeg(int fd, const WriteToJpegParam &param)
return ret; return ret;
} }
bool SnapShotUtils::SaveSnapShot(const std::string &fileName, Media::PixelMap &pixelMap, std::string fileType) bool SnapShotUtils::SaveSnapShot(const std::string& fileName, Media::PixelMap& pixelMap, std::string fileType)
{ {
OHOS::Media::ImagePacker imagePacker; OHOS::Media::ImagePacker imagePacker;
OHOS::Media::PackOption option; OHOS::Media::PackOption option;
@ -383,7 +383,7 @@ bool SnapShotUtils::SaveSnapShot(const std::string &fileName, Media::PixelMap &p
return true; return true;
} }
bool SnapShotUtils::WriteToJpegWithPixelMap(const std::string &fileName, Media::PixelMap &pixelMap) bool SnapShotUtils::WriteToJpegWithPixelMap(const std::string& fileName, Media::PixelMap& pixelMap)
{ {
if (pixelMap.GetAllocatorType() == Media::AllocatorType::DMA_ALLOC) { if (pixelMap.GetAllocatorType() == Media::AllocatorType::DMA_ALLOC) {
return SaveSnapShot(fileName, pixelMap); return SaveSnapShot(fileName, pixelMap);
@ -397,7 +397,7 @@ bool SnapShotUtils::WriteToJpegWithPixelMap(const std::string &fileName, Media::
return SnapShotUtils::WriteToJpeg(fileName, param); return SnapShotUtils::WriteToJpeg(fileName, param);
} }
bool SnapShotUtils::WriteToJpegWithPixelMap(int fd, Media::PixelMap &pixelMap) bool SnapShotUtils::WriteToJpegWithPixelMap(int fd, Media::PixelMap& pixelMap)
{ {
WriteToJpegParam param; WriteToJpegParam param;
param.width = static_cast<uint32_t>(pixelMap.GetWidth()); param.width = static_cast<uint32_t>(pixelMap.GetWidth());
@ -408,7 +408,7 @@ bool SnapShotUtils::WriteToJpegWithPixelMap(int fd, Media::PixelMap &pixelMap)
return SnapShotUtils::WriteToJpeg(fd, param); return SnapShotUtils::WriteToJpeg(fd, param);
} }
bool SnapShotUtils::ProcessDisplayId(Rosen::DisplayId &displayId, bool isDisplayIdSet) bool SnapShotUtils::ProcessDisplayId(Rosen::DisplayId& displayId, bool isDisplayIdSet)
{ {
if (!isDisplayIdSet) { if (!isDisplayIdSet) {
displayId = DisplayManager::GetInstance().GetDefaultDisplayId(); displayId = DisplayManager::GetInstance().GetDefaultDisplayId();
@ -433,7 +433,7 @@ bool SnapShotUtils::ProcessDisplayId(Rosen::DisplayId &displayId, bool isDisplay
return true; return true;
} }
bool SnapShotUtils::ProcessArgs(int argc, char * const argv[], CmdArguments &cmdArguments) bool SnapShotUtils::ProcessArgs(int argc, char * const argv[], CmdArguments& cmdArguments)
{ {
int opt = 0; int opt = 0;
const struct option longOption[] = { const struct option longOption[] = {

View File

@ -35,7 +35,7 @@ public:
return 0; return 0;
} }
int SendRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) int SendRequest(uint32_t code, MessageParcel& data, MessageParcel& reply, MessageOption& option)
{ {
return 0; return 0;
} }
@ -85,7 +85,7 @@ public:
return 0; return 0;
} }
int SendRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) int SendRequest(uint32_t code, MessageParcel& data, MessageParcel& reply, MessageOption& option)
{ {
return sendRequestResult_; return sendRequestResult_;
} }

View File

@ -88,10 +88,10 @@ public:
int64_t baseParent, std::list<Accessibility::AccessibilityElementInfo>& output)); int64_t baseParent, std::list<Accessibility::AccessibilityElementInfo>& output));
MOCK_METHOD4( MOCK_METHOD4(
FindFocusedElementInfo, void(int64_t elementId, FindFocusedElementInfo, void(int64_t elementId,
int32_t focusType, int64_t baseParent, Accessibility::AccessibilityElementInfo &output)); int32_t focusType, int64_t baseParent, Accessibility::AccessibilityElementInfo& output));
MOCK_METHOD4( MOCK_METHOD4(
FocusMoveSearch, void(int64_t elementId, int32_t direction, int64_t baseParent, FocusMoveSearch, void(int64_t elementId, int32_t direction, int64_t baseParent,
Accessibility::AccessibilityElementInfo &output)); Accessibility::AccessibilityElementInfo& output));
MOCK_METHOD1(GetAppPaintSize, void(OHOS::Rosen::Rect& drawableRect)); MOCK_METHOD1(GetAppPaintSize, void(OHOS::Rosen::Rect& drawableRect));
MOCK_METHOD2(SetContainerModalTitleVisible, void(bool customTitleSettedShow, bool floatingTitleSettedShow)); MOCK_METHOD2(SetContainerModalTitleVisible, void(bool customTitleSettedShow, bool floatingTitleSettedShow));
MOCK_METHOD1(SetContainerModalTitleHeight, void(int height)); MOCK_METHOD1(SetContainerModalTitleHeight, void(int height));

View File

@ -19,7 +19,7 @@
using namespace OHOS; using namespace OHOS;
using namespace OHOS::Rosen; using namespace OHOS::Rosen;
int main(int argc, char *argv[]) int main(int argc, char* argv[])
{ {
auto displayId = DisplayManager::GetInstance().GetDefaultDisplayId(); auto displayId = DisplayManager::GetInstance().GetDefaultDisplayId();
std::vector<DisplayId> ids; std::vector<DisplayId> ids;

View File

@ -20,7 +20,7 @@
using namespace OHOS; using namespace OHOS;
using namespace OHOS::Rosen; using namespace OHOS::Rosen;
int main(int argc, char *argv[]) int main(int argc, char* argv[])
{ {
std::cout << "===========================Start===========================" << std::endl; std::cout << "===========================Start===========================" << std::endl;
std::cout << "Please do screen mirror in 20s..." << std::endl; std::cout << "Please do screen mirror in 20s..." << std::endl;

View File

@ -20,7 +20,7 @@
using namespace OHOS; using namespace OHOS;
using namespace OHOS::Rosen; using namespace OHOS::Rosen;
int main(int argc, char *argv[]) int main(int argc, char* argv[])
{ {
std::cout << "===========================Start===========================" << std::endl; std::cout << "===========================Start===========================" << std::endl;
std::cout << "Please do screenshot in 20s..." << std::endl; std::cout << "Please do screenshot in 20s..." << std::endl;

View File

@ -22,7 +22,7 @@
using namespace OHOS; using namespace OHOS;
using namespace OHOS::Rosen; using namespace OHOS::Rosen;
int main(int argc, char *argv[]) int main(int argc, char* argv[])
{ {
SessionManager sessionManager; SessionManager sessionManager;

View File

@ -69,7 +69,7 @@ static bool InitMirror(SurfaceReader& surfaceReader)
return true; return true;
} }
int main(int argc, char *argv[]) int main(int argc, char* argv[])
{ {
SurfaceReader surfaceReader; SurfaceReader surfaceReader;
sptr<SurfaceReaderHandlerImpl> surfaceReaderHandler = new SurfaceReaderHandlerImpl(); sptr<SurfaceReaderHandlerImpl> surfaceReaderHandler = new SurfaceReaderHandlerImpl();

View File

@ -53,7 +53,7 @@ void OutputWindowInfos(const std::vector<sptr<AccessibilityWindowInfo>>& infos)
} }
} }
int main(int argc, char *argv[]) int main(int argc, char* argv[])
{ {
std::cout << "===========================Start===========================" << std::endl; std::cout << "===========================Start===========================" << std::endl;
std::cout << "Wait 20s, The Windows will close itself" << std::endl; std::cout << "Wait 20s, The Windows will close itself" << std::endl;

View File

@ -42,7 +42,7 @@ public:
using namespace OHOS; using namespace OHOS;
using namespace OHOS::Rosen; using namespace OHOS::Rosen;
int main(int argc, char *argv[]) int main(int argc, char* argv[])
{ {
std::cout << "===========================Start===========================" << std::endl; std::cout << "===========================Start===========================" << std::endl;

View File

@ -41,7 +41,7 @@ public:
using namespace OHOS; using namespace OHOS;
using namespace OHOS::Rosen; using namespace OHOS::Rosen;
int main(int argc, char *argv[]) int main(int argc, char* argv[])
{ {
std::cout << "===========================Start===========================" << std::endl; std::cout << "===========================Start===========================" << std::endl;

View File

@ -59,7 +59,7 @@ public:
}; };
template<class T> template<class T>
size_t GetObject(T &object, const uint8_t *data, size_t size) size_t GetObject(T& object, const uint8_t* data, size_t size)
{ {
size_t objectSize = sizeof(object); size_t objectSize = sizeof(object);
if (objectSize > size) { if (objectSize > size) {

View File

@ -29,7 +29,7 @@ namespace {
constexpr HiviewDFX::HiLogLabel LABEL = {LOG_CORE, HILOG_DOMAIN_DISPLAY, "DisplayManagerIPC_Fuzzer"}; constexpr HiviewDFX::HiLogLabel LABEL = {LOG_CORE, HILOG_DOMAIN_DISPLAY, "DisplayManagerIPC_Fuzzer"};
} }
template<class T> template<class T>
size_t GetObject(T &object, const uint8_t *data, size_t size) size_t GetObject(T& object, const uint8_t* data, size_t size)
{ {
size_t objectSize = sizeof(object); size_t objectSize = sizeof(object);
if (objectSize > size) { if (objectSize > size) {

View File

@ -32,7 +32,7 @@ namespace {
constexpr size_t LEN = 10; constexpr size_t LEN = 10;
} }
template<class T> template<class T>
size_t GetObject(T &object, const uint8_t *data, size_t size) size_t GetObject(T& object, const uint8_t* data, size_t size)
{ {
size_t objectSize = sizeof(object); size_t objectSize = sizeof(object);
if (objectSize > size) { if (objectSize > size) {
@ -41,7 +41,7 @@ size_t GetObject(T &object, const uint8_t *data, size_t size)
return memcpy_s(&object, objectSize, data, objectSize) == EOK ? objectSize : 0; return memcpy_s(&object, objectSize, data, objectSize) == EOK ? objectSize : 0;
} }
sptr<ScreenInfo> CreateScreenInfo(const uint8_t *data, size_t size) sptr<ScreenInfo> CreateScreenInfo(const uint8_t* data, size_t size)
{ {
sptr<ScreenInfo> info = new(std::nothrow) ScreenInfo(); sptr<ScreenInfo> info = new(std::nothrow) ScreenInfo();
if (info == nullptr) { if (info == nullptr) {
@ -68,7 +68,7 @@ sptr<ScreenInfo> CreateScreenInfo(const uint8_t *data, size_t size)
GetObject<uint32_t>(info->modeId_, data + startPos, size - startPos); GetObject<uint32_t>(info->modeId_, data + startPos, size - startPos);
return info; return info;
} }
bool ScreenFuzzTest(sptr<Screen> screen, sptr<Display> display, const uint8_t *data, size_t size) bool ScreenFuzzTest(sptr<Screen> screen, sptr<Display> display, const uint8_t* data, size_t size)
{ {
if (screen == nullptr || display == nullptr) { if (screen == nullptr || display == nullptr) {
return false; return false;
@ -94,7 +94,7 @@ bool ScreenFuzzTest(sptr<Screen> screen, sptr<Display> display, const uint8_t *d
return true; return true;
} }
bool ScreenFuzzTestNoDisplay(sptr<Screen> screen, const uint8_t *data, size_t size) bool ScreenFuzzTestNoDisplay(sptr<Screen> screen, const uint8_t* data, size_t size)
{ {
if (screen == nullptr) { if (screen == nullptr) {
return false; return false;
@ -122,7 +122,7 @@ bool ScreenFuzzTestNoDisplay(sptr<Screen> screen, const uint8_t *data, size_t si
return true; return true;
} }
bool ColorGamutsFuzzTest(sptr<Screen> screen, const uint8_t *data, size_t size) bool ColorGamutsFuzzTest(sptr<Screen> screen, const uint8_t* data, size_t size)
{ {
if (screen == nullptr) { if (screen == nullptr) {
return false; return false;

View File

@ -56,7 +56,7 @@ public:
}; };
template<class T> template<class T>
size_t GetObject(T &object, const uint8_t *data, size_t size) size_t GetObject(T& object, const uint8_t* data, size_t size)
{ {
size_t objectSize = sizeof(object); size_t objectSize = sizeof(object);
if (objectSize > size) { if (objectSize > size) {
@ -65,7 +65,7 @@ size_t GetObject(T &object, const uint8_t *data, size_t size)
return memcpy_s(&object, objectSize, data, objectSize) == EOK ? objectSize : 0; return memcpy_s(&object, objectSize, data, objectSize) == EOK ? objectSize : 0;
} }
bool ScreenPowerFuzzTest(const uint8_t *data, size_t size) bool ScreenPowerFuzzTest(const uint8_t* data, size_t size)
{ {
uint32_t screenPowerState; uint32_t screenPowerState;
uint32_t powerStateChangeReason; uint32_t powerStateChangeReason;
@ -94,7 +94,7 @@ bool ScreenPowerFuzzTest(const uint8_t *data, size_t size)
return true; return true;
} }
bool MakeMirrorWithVirtualScreenFuzzTest(const uint8_t *data, size_t size) bool MakeMirrorWithVirtualScreenFuzzTest(const uint8_t* data, size_t size)
{ {
if (data == nullptr || size < DATA_MIN_SIZE) { if (data == nullptr || size < DATA_MIN_SIZE) {
return false; return false;
@ -135,7 +135,7 @@ bool MakeMirrorWithVirtualScreenFuzzTest(const uint8_t *data, size_t size)
return true; return true;
} }
bool MakeExpandWithVirtualScreenFuzzTest(const uint8_t *data, size_t size) bool MakeExpandWithVirtualScreenFuzzTest(const uint8_t* data, size_t size)
{ {
if (data == nullptr || size < DATA_MIN_SIZE) { if (data == nullptr || size < DATA_MIN_SIZE) {
return false; return false;
@ -176,7 +176,7 @@ bool MakeExpandWithVirtualScreenFuzzTest(const uint8_t *data, size_t size)
return true; return true;
} }
bool CreateAndDestroyVirtualScreenFuzzTest(const uint8_t *data, size_t size) bool CreateAndDestroyVirtualScreenFuzzTest(const uint8_t* data, size_t size)
{ {
if (data == nullptr || size < DATA_MIN_SIZE) { if (data == nullptr || size < DATA_MIN_SIZE) {
return false; return false;
@ -204,7 +204,7 @@ bool CreateAndDestroyVirtualScreenFuzzTest(const uint8_t *data, size_t size)
return true; return true;
} }
bool SetVirtualScreenSurfaceFuzzTest(const uint8_t *data, size_t size) bool SetVirtualScreenSurfaceFuzzTest(const uint8_t* data, size_t size)
{ {
ScreenId screenId; ScreenId screenId;
if (data == nullptr || size < sizeof(screenId)) { if (data == nullptr || size < sizeof(screenId)) {
@ -217,7 +217,7 @@ bool SetVirtualScreenSurfaceFuzzTest(const uint8_t *data, size_t size)
return true; return true;
} }
bool SetScreenRotationLockedFuzzTest(const uint8_t *data, size_t size) bool SetScreenRotationLockedFuzzTest(const uint8_t* data, size_t size)
{ {
ScreenId screenId; ScreenId screenId;
if (data == nullptr || size < sizeof(screenId)) { if (data == nullptr || size < sizeof(screenId)) {
@ -231,7 +231,7 @@ bool SetScreenRotationLockedFuzzTest(const uint8_t *data, size_t size)
return true; return true;
} }
bool IsScreenRotationLocked(const uint8_t *data, size_t size) bool IsScreenRotationLocked(const uint8_t* data, size_t size)
{ {
ScreenId screenId; ScreenId screenId;
if (data == nullptr || size < sizeof(screenId)) { if (data == nullptr || size < sizeof(screenId)) {
@ -245,7 +245,7 @@ bool IsScreenRotationLocked(const uint8_t *data, size_t size)
return true; return true;
} }
bool RemoveVirtualScreenFromGroupFuzzTest(const uint8_t *data, size_t size) bool RemoveVirtualScreenFromGroupFuzzTest(const uint8_t* data, size_t size)
{ {
ScreenId screenId; ScreenId screenId;
if (data == nullptr || size < sizeof(screenId)) { if (data == nullptr || size < sizeof(screenId)) {
@ -259,7 +259,7 @@ bool RemoveVirtualScreenFromGroupFuzzTest(const uint8_t *data, size_t size)
return true; return true;
} }
bool MakeMirrorFuzzTest(const uint8_t *data, size_t size) bool MakeMirrorFuzzTest(const uint8_t* data, size_t size)
{ {
ScreenId screenId; ScreenId screenId;
// 10 screens. // 10 screens.
@ -287,7 +287,7 @@ bool MakeMirrorFuzzTest(const uint8_t *data, size_t size)
return true; return true;
} }
bool MakeExpandFuzzTest(const uint8_t *data, size_t size) bool MakeExpandFuzzTest(const uint8_t* data, size_t size)
{ {
ScreenId screenId; ScreenId screenId;
// 10 screens. // 10 screens.

View File

@ -35,7 +35,7 @@ namespace {
constexpr size_t DATA_MIN_SIZE = 2; constexpr size_t DATA_MIN_SIZE = 2;
} }
void SceneSessionMgrLsTest(MessageParcel &parcel, MessageParcel &reply, MessageOption &option) void SceneSessionMgrLsTest(MessageParcel& parcel, MessageParcel& reply, MessageOption& option)
{ {
parcel.RewindRead(0); parcel.RewindRead(0);
SceneSessionManagerLite::GetInstance().OnRemoteRequest(static_cast<uint32_t>(ISceneSessionManagerLite:: SceneSessionManagerLite::GetInstance().OnRemoteRequest(static_cast<uint32_t>(ISceneSessionManagerLite::

View File

@ -34,7 +34,7 @@ namespace {
constexpr size_t DATA_MIN_SIZE = 2; constexpr size_t DATA_MIN_SIZE = 2;
} }
template<class T> template<class T>
size_t GetObject(T &object, const uint8_t *data, size_t size) size_t GetObject(T& object, const uint8_t* data, size_t size)
{ {
size_t objectSize = sizeof(object); size_t objectSize = sizeof(object);
if (objectSize > size) { if (objectSize > size) {
@ -42,7 +42,7 @@ size_t GetObject(T &object, const uint8_t *data, size_t size)
} }
return memcpy_s(&object, objectSize, data, objectSize) == EOK ? objectSize : 0; return memcpy_s(&object, objectSize, data, objectSize) == EOK ? objectSize : 0;
} }
void ScreenSessionMgrClientStubTest1(MessageParcel &parcel, MessageParcel &reply, MessageOption &option) void ScreenSessionMgrClientStubTest1(MessageParcel& parcel, MessageParcel& reply, MessageOption& option)
{ {
parcel.RewindRead(0); parcel.RewindRead(0);
ScreenSessionManagerClient::GetInstance().OnRemoteRequest( ScreenSessionManagerClient::GetInstance().OnRemoteRequest(
@ -74,7 +74,7 @@ void ScreenSessionMgrClientStubTest1(MessageParcel &parcel, MessageParcel &reply
ScreenSessionManagerClientMessage::TRANS_ID_ON_DISPLAY_STATE_CHANGED), parcel, reply, option); ScreenSessionManagerClientMessage::TRANS_ID_ON_DISPLAY_STATE_CHANGED), parcel, reply, option);
return; return;
} }
void ScreenSessionMgrClientStubTest2(MessageParcel &parcel, MessageParcel &reply, MessageOption &option) void ScreenSessionMgrClientStubTest2(MessageParcel& parcel, MessageParcel& reply, MessageOption& option)
{ {
parcel.RewindRead(0); parcel.RewindRead(0);
ScreenSessionManagerClient::GetInstance().OnRemoteRequest( ScreenSessionManagerClient::GetInstance().OnRemoteRequest(

View File

@ -31,7 +31,7 @@ namespace {
} }
template<class T> template<class T>
size_t GetObject(T &object, const uint8_t *data, size_t size) size_t GetObject(T& object, const uint8_t* data, size_t size)
{ {
size_t objectSize = sizeof(object); size_t objectSize = sizeof(object);
if (objectSize > size) { if (objectSize > size) {

View File

@ -221,7 +221,7 @@ public:
}; };
template<class T> template<class T>
size_t GetObject(T &object, const uint8_t *data, size_t size) size_t GetObject(T& object, const uint8_t* data, size_t size)
{ {
size_t objectSize = sizeof(object); size_t objectSize = sizeof(object);
if (objectSize > size) { if (objectSize > size) {
@ -231,7 +231,7 @@ size_t GetObject(T &object, const uint8_t *data, size_t size)
} }
/* 调用该接口后, 需要释放内存 */ /* 调用该接口后, 需要释放内存 */
char *CopyDataToString(const uint8_t *data, size_t size) char *CopyDataToString(const uint8_t* data, size_t size)
{ {
if (size > DATA_MAX_SIZE) { if (size > DATA_MAX_SIZE) {
return nullptr; return nullptr;

View File

@ -34,7 +34,7 @@ namespace {
} }
template<class T> template<class T>
size_t GetObject(T &object, const uint8_t *data, size_t size) size_t GetObject(T& object, const uint8_t* data, size_t size)
{ {
size_t objectSize = sizeof(object); size_t objectSize = sizeof(object);
if (objectSize > size) { if (objectSize > size) {

View File

@ -28,7 +28,7 @@ namespace {
constexpr HiviewDFX::HiLogLabel LABEL = {LOG_CORE, HILOG_DOMAIN_DISPLAY, "DisplayManagerIPC_Fuzzer"}; constexpr HiviewDFX::HiLogLabel LABEL = {LOG_CORE, HILOG_DOMAIN_DISPLAY, "DisplayManagerIPC_Fuzzer"};
} }
template<class T> template<class T>
size_t GetObject(T &object, const uint8_t *data, size_t size) size_t GetObject(T& object, const uint8_t* data, size_t size)
{ {
size_t objectSize = sizeof(object); size_t objectSize = sizeof(object);
if (objectSize > size) { if (objectSize > size) {

View File

@ -28,7 +28,7 @@ namespace {
} }
template<class T> template<class T>
size_t GetObject(T &object, const uint8_t *data, size_t size) size_t GetObject(T& object, const uint8_t* data, size_t size)
{ {
size_t objectSize = sizeof(object); size_t objectSize = sizeof(object);
if (objectSize > size) { if (objectSize > size) {

View File

@ -63,7 +63,7 @@ public:
}; };
template<class T> template<class T>
size_t GetObject(T &object, const uint8_t *data, size_t size) size_t GetObject(T& object, const uint8_t* data, size_t size)
{ {
size_t objectSize = sizeof(object); size_t objectSize = sizeof(object);
if (objectSize > size) { if (objectSize > size) {
@ -72,7 +72,7 @@ size_t GetObject(T &object, const uint8_t *data, size_t size)
return memcpy_s(&object, objectSize, data, objectSize) == EOK ? objectSize : 0; return memcpy_s(&object, objectSize, data, objectSize) == EOK ? objectSize : 0;
} }
size_t InitWindowOption1(WindowOption &windowOption, const uint8_t *data, size_t size) size_t InitWindowOption1(WindowOption& windowOption, const uint8_t* data, size_t size)
{ {
size_t startPos = 0; size_t startPos = 0;
Rect windowRect; Rect windowRect;
@ -106,7 +106,7 @@ size_t InitWindowOption1(WindowOption &windowOption, const uint8_t *data, size_t
return startPos; return startPos;
} }
size_t InitWindowOption2(WindowOption &windowOption, const uint8_t *data, size_t size) size_t InitWindowOption2(WindowOption& windowOption, const uint8_t* data, size_t size)
{ {
size_t startPos = 0; size_t startPos = 0;
uint32_t flags; uint32_t flags;
@ -150,7 +150,7 @@ size_t InitWindowOption2(WindowOption &windowOption, const uint8_t *data, size_t
return startPos; return startPos;
} }
size_t InitWindowOption(WindowOption &windowOption, const uint8_t *data, size_t size) size_t InitWindowOption(WindowOption& windowOption, const uint8_t* data, size_t size)
{ {
size_t startPos = 0; size_t startPos = 0;
startPos += InitWindowOption1(windowOption, data + startPos, size - startPos); startPos += InitWindowOption1(windowOption, data + startPos, size - startPos);

View File

@ -32,7 +32,7 @@ namespace {
} }
template<class T> template<class T>
size_t GetObject(T &object, const uint8_t *data, size_t size) size_t GetObject(T& object, const uint8_t* data, size_t size)
{ {
size_t objectSize = sizeof(object); size_t objectSize = sizeof(object);
if (objectSize > size) { if (objectSize > size) {
@ -42,7 +42,7 @@ size_t GetObject(T &object, const uint8_t *data, size_t size)
} }
size_t InitMatrix3(OHOS::Rosen::TransformHelper::Matrix3& mat3, size_t InitMatrix3(OHOS::Rosen::TransformHelper::Matrix3& mat3,
const uint8_t *data, size_t size, size_t startPos) const uint8_t* data, size_t size, size_t startPos)
{ {
if (data == nullptr || size < DATA_MIN_SIZE) { if (data == nullptr || size < DATA_MIN_SIZE) {
return 0; return 0;
@ -58,7 +58,7 @@ size_t InitMatrix3(OHOS::Rosen::TransformHelper::Matrix3& mat3,
} }
void InitMatrix4(OHOS::Rosen::TransformHelper::Matrix4& mat4, void InitMatrix4(OHOS::Rosen::TransformHelper::Matrix4& mat4,
const uint8_t *data, size_t size, size_t& startPos) const uint8_t* data, size_t size, size_t& startPos)
{ {
if (data == nullptr || size < DATA_MIN_SIZE) { if (data == nullptr || size < DATA_MIN_SIZE) {
return; return;
@ -73,7 +73,7 @@ void InitMatrix4(OHOS::Rosen::TransformHelper::Matrix4& mat4,
} }
void InitVector2(OHOS::Rosen::TransformHelper::Vector2& vec2, void InitVector2(OHOS::Rosen::TransformHelper::Vector2& vec2,
const uint8_t *data, size_t size, size_t& startPos) const uint8_t* data, size_t size, size_t& startPos)
{ {
if (data == nullptr || size < DATA_MIN_SIZE) { if (data == nullptr || size < DATA_MIN_SIZE) {
return; return;
@ -83,7 +83,7 @@ void InitVector2(OHOS::Rosen::TransformHelper::Vector2& vec2,
} }
void InitVector3(OHOS::Rosen::TransformHelper::Vector3& vec3, void InitVector3(OHOS::Rosen::TransformHelper::Vector3& vec3,
const uint8_t *data, size_t size, size_t& startPos) const uint8_t* data, size_t size, size_t& startPos)
{ {
if (data == nullptr || size < DATA_MIN_SIZE) { if (data == nullptr || size < DATA_MIN_SIZE) {
return; return;
@ -93,7 +93,7 @@ void InitVector3(OHOS::Rosen::TransformHelper::Vector3& vec3,
startPos += GetObject<float>(vec3.y_, data + startPos, size - startPos); startPos += GetObject<float>(vec3.y_, data + startPos, size - startPos);
} }
void WindowUtilMathFuzzPart1(const uint8_t *data, size_t size) void WindowUtilMathFuzzPart1(const uint8_t* data, size_t size)
{ {
if (data == nullptr || size < DATA_MIN_SIZE) { if (data == nullptr || size < DATA_MIN_SIZE) {
return; return;
@ -137,7 +137,7 @@ void WindowUtilMathFuzzPart1(const uint8_t *data, size_t size)
OHOS::Rosen::TransformHelper::CreateTranslation(vec3); OHOS::Rosen::TransformHelper::CreateTranslation(vec3);
} }
void WindowUtilMathFuzzPart2(const uint8_t *data, size_t size) void WindowUtilMathFuzzPart2(const uint8_t* data, size_t size)
{ {
if (data == nullptr || size < DATA_MIN_SIZE) { if (data == nullptr || size < DATA_MIN_SIZE) {
return; return;

View File

@ -44,7 +44,7 @@ public:
void SetDefaultWH(const sptr<Display>& display); void SetDefaultWH(const sptr<Display>& display);
class BufferListener : public IBufferConsumerListener { class BufferListener : public IBufferConsumerListener {
public: public:
explicit BufferListener(DisplayTestUtils &displayTestUtils): utils_(displayTestUtils) explicit BufferListener(DisplayTestUtils& displayTestUtils): utils_(displayTestUtils)
{ {
} }
~BufferListener() noexcept override = default; ~BufferListener() noexcept override = default;

View File

@ -52,9 +52,9 @@ public:
DEFINE_VAR_FUNC_GET_SET(std::vector<DMRect>, BoundingRects, boundingRects); DEFINE_VAR_FUNC_GET_SET(std::vector<DMRect>, BoundingRects, boundingRects);
private: private:
const static uint32_t MAX_CUTOUT_INFO_SIZE = 20; const static uint32_t MAX_CUTOUT_INFO_SIZE = 20;
bool WriteBoundingRectsVector(const std::vector<DMRect>& boundingRects, Parcel &parcel) const; bool WriteBoundingRectsVector(const std::vector<DMRect>& boundingRects, Parcel& parcel) const;
static bool ReadBoundingRectsVector(std::vector<DMRect>& unmarBoundingRects, Parcel &parcel); static bool ReadBoundingRectsVector(std::vector<DMRect>& unmarBoundingRects, Parcel& parcel);
static bool ReadWaterfallDisplayAreaRects(WaterfallDisplayAreaRects& waterfallDisplayAreaRects, Parcel &parcel); static bool ReadWaterfallDisplayAreaRects(WaterfallDisplayAreaRects& waterfallDisplayAreaRects, Parcel& parcel);
}; };
} // namespace OHOS::Rosen } // namespace OHOS::Rosen
#endif // FOUNDATION_DMSERVER_CUTOUT_INFO_H #endif // FOUNDATION_DMSERVER_CUTOUT_INFO_H

View File

@ -61,7 +61,7 @@ public:
} }
} }
static FocusChangeInfo* Unmarshalling(Parcel &parcel) static FocusChangeInfo* Unmarshalling(Parcel& parcel)
{ {
auto focusChangeInfo = new FocusChangeInfo(); auto focusChangeInfo = new FocusChangeInfo();
bool res = parcel.ReadInt32(focusChangeInfo->windowId_) && parcel.ReadUint64(focusChangeInfo->displayId_) && bool res = parcel.ReadInt32(focusChangeInfo->windowId_) && parcel.ReadUint64(focusChangeInfo->displayId_) &&

View File

@ -23,7 +23,7 @@ class MarshallingHelper : public Parcelable {
public: public:
MarshallingHelper() = delete; MarshallingHelper() = delete;
template<class T> template<class T>
static bool MarshallingVectorParcelableObj(Parcel &parcel, const std::vector<sptr<T>>& data) static bool MarshallingVectorParcelableObj(Parcel& parcel, const std::vector<sptr<T>>& data)
{ {
if (data.size() > INT_MAX) { if (data.size() > INT_MAX) {
return false; return false;
@ -40,7 +40,7 @@ public:
} }
template<class T> template<class T>
static bool UnmarshallingVectorParcelableObj(Parcel &parcel, std::vector<sptr<T>>& data) static bool UnmarshallingVectorParcelableObj(Parcel& parcel, std::vector<sptr<T>>& data)
{ {
int32_t len = parcel.ReadInt32(); int32_t len = parcel.ReadInt32();
if (len < 0) { if (len < 0) {
@ -71,7 +71,7 @@ public:
} }
template<class T> template<class T>
static bool MarshallingVectorObj(Parcel &parcel, const std::vector<T>& data, static bool MarshallingVectorObj(Parcel& parcel, const std::vector<T>& data,
std::function<bool(Parcel&, const T&)> func) std::function<bool(Parcel&, const T&)> func)
{ {
if (data.size() > INT_MAX) { if (data.size() > INT_MAX) {
@ -92,7 +92,7 @@ public:
} }
template<class T> template<class T>
static bool UnmarshallingVectorObj(Parcel &parcel, std::vector<T>& data, std::function<bool(Parcel&, T&)> func) static bool UnmarshallingVectorObj(Parcel& parcel, std::vector<T>& data, std::function<bool(Parcel&, T&)> func)
{ {
if (func == nullptr) { if (func == nullptr) {
return false; return false;

View File

@ -26,10 +26,10 @@ class PiPReporter {
WM_DECLARE_SINGLE_INSTANCE(PiPReporter); WM_DECLARE_SINGLE_INSTANCE(PiPReporter);
public: public:
void SetCurrentPackageName(const std::string &packageName); void SetCurrentPackageName(const std::string& packageName);
void ReportPiPStartWindow(int32_t source, int32_t templateType, int32_t isSuccess, const std::string &errorReason); void ReportPiPStartWindow(int32_t source, int32_t templateType, int32_t isSuccess, const std::string& errorReason);
void ReportPiPStopWindow(int32_t source, int32_t templateType, int32_t isSuccess, const std::string &errorReason); void ReportPiPStopWindow(int32_t source, int32_t templateType, int32_t isSuccess, const std::string& errorReason);
void ReportPiPActionEvent(int32_t templateType, const std::string &actionEvent); void ReportPiPActionEvent(int32_t templateType, const std::string& actionEvent);
void ReportPiPControlEvent(int32_t templateType, PiPControlType controlType); void ReportPiPControlEvent(int32_t templateType, PiPControlType controlType);
void ReportPiPRatio(int32_t windowWidth, int32_t windowHeight); void ReportPiPRatio(int32_t windowWidth, int32_t windowHeight);
void ReportPiPRestore(); void ReportPiPRestore();

View File

@ -45,14 +45,14 @@ public:
Rect transparentRect); Rect transparentRect);
private: private:
static bool DoDraw(uint8_t *addr, uint32_t width, uint32_t height, const std::string& imagePath); static bool DoDraw(uint8_t* addr, uint32_t width, uint32_t height, const std::string& imagePath);
static bool DoDraw(uint8_t *addr, uint32_t width, uint32_t height, uint32_t color); static bool DoDraw(uint8_t* addr, uint32_t width, uint32_t height, uint32_t color);
static bool DoDraw(uint8_t *addr, uint32_t width, uint32_t height, std::shared_ptr<Media::PixelMap> pixelMap); static bool DoDraw(uint8_t* addr, uint32_t width, uint32_t height, std::shared_ptr<Media::PixelMap> pixelMap);
static sptr<OHOS::Surface> GetLayer(std::shared_ptr<RSSurfaceNode> surfaceNode); static sptr<OHOS::Surface> GetLayer(std::shared_ptr<RSSurfaceNode> surfaceNode);
static sptr<OHOS::SurfaceBuffer> GetSurfaceBuffer(sptr<OHOS::Surface> layer, int32_t bufferWidth, static sptr<OHOS::SurfaceBuffer> GetSurfaceBuffer(sptr<OHOS::Surface> layer, int32_t bufferWidth,
int32_t bufferHeight); int32_t bufferHeight);
static void DrawPixelmap(Drawing::Canvas &canvas, const std::string& imagePath); static void DrawPixelmap(Drawing::Canvas& canvas, const std::string& imagePath);
static std::unique_ptr<OHOS::Media::PixelMap> DecodeImageToPixelMap(const std::string &imagePath); static std::unique_ptr<OHOS::Media::PixelMap> DecodeImageToPixelMap(const std::string& imagePath);
static bool DoDrawImageRect(sptr<OHOS::SurfaceBuffer> buffer, const Rect& rect, static bool DoDrawImageRect(sptr<OHOS::SurfaceBuffer> buffer, const Rect& rect,
std::shared_ptr<Media::PixelMap> pixelMap, uint32_t color, bool fillWindow = false); std::shared_ptr<Media::PixelMap> pixelMap, uint32_t color, bool fillWindow = false);
}; };

View File

@ -37,7 +37,7 @@ public:
private: private:
class BufferListener : public IBufferConsumerListener { class BufferListener : public IBufferConsumerListener {
public: public:
explicit BufferListener(SurfaceReader &surfaceReader): surfaceReader_(surfaceReader) explicit BufferListener(SurfaceReader& surfaceReader): surfaceReader_(surfaceReader)
{ {
} }
~BufferListener() noexcept override = default; ~BufferListener() noexcept override = default;

View File

@ -22,7 +22,7 @@ CutoutInfo::CutoutInfo(const std::vector<DMRect>& boundingRects,
{ {
} }
bool CutoutInfo::Marshalling(Parcel &parcel) const bool CutoutInfo::Marshalling(Parcel& parcel) const
{ {
return parcel.WriteInt32(waterfallDisplayAreaRects_.left.posX_) && return parcel.WriteInt32(waterfallDisplayAreaRects_.left.posX_) &&
parcel.WriteInt32(waterfallDisplayAreaRects_.left.posY_) && parcel.WriteInt32(waterfallDisplayAreaRects_.left.posY_) &&
@ -43,7 +43,7 @@ bool CutoutInfo::Marshalling(Parcel &parcel) const
WriteBoundingRectsVector(boundingRects_, parcel); WriteBoundingRectsVector(boundingRects_, parcel);
} }
CutoutInfo *CutoutInfo::Unmarshalling(Parcel &parcel) CutoutInfo *CutoutInfo::Unmarshalling(Parcel& parcel)
{ {
WaterfallDisplayAreaRects waterfallDisplayAreaRects; WaterfallDisplayAreaRects waterfallDisplayAreaRects;
std::vector<DMRect> boundingRects; std::vector<DMRect> boundingRects;
@ -53,7 +53,7 @@ CutoutInfo *CutoutInfo::Unmarshalling(Parcel &parcel)
return cutoutInfo; return cutoutInfo;
} }
bool CutoutInfo::WriteBoundingRectsVector(const std::vector<DMRect>& boundingRects, Parcel &parcel) const bool CutoutInfo::WriteBoundingRectsVector(const std::vector<DMRect>& boundingRects, Parcel& parcel) const
{ {
uint32_t size = static_cast<uint32_t>(boundingRects.size()); uint32_t size = static_cast<uint32_t>(boundingRects.size());
if (!parcel.WriteUint32(size)) { if (!parcel.WriteUint32(size)) {
@ -71,7 +71,7 @@ bool CutoutInfo::WriteBoundingRectsVector(const std::vector<DMRect>& boundingRec
return true; return true;
} }
bool CutoutInfo::ReadBoundingRectsVector(std::vector<DMRect>& unmarBoundingRects, Parcel &parcel) bool CutoutInfo::ReadBoundingRectsVector(std::vector<DMRect>& unmarBoundingRects, Parcel& parcel)
{ {
uint32_t size; uint32_t size;
if (!parcel.ReadUint32(size)) { if (!parcel.ReadUint32(size)) {
@ -95,7 +95,7 @@ bool CutoutInfo::ReadBoundingRectsVector(std::vector<DMRect>& unmarBoundingRects
return true; return true;
} }
bool CutoutInfo::ReadWaterfallDisplayAreaRects(WaterfallDisplayAreaRects& waterfallDisplayAreaRects, Parcel &parcel) bool CutoutInfo::ReadWaterfallDisplayAreaRects(WaterfallDisplayAreaRects& waterfallDisplayAreaRects, Parcel& parcel)
{ {
if (!(parcel.ReadInt32(waterfallDisplayAreaRects.left.posX_) && if (!(parcel.ReadInt32(waterfallDisplayAreaRects.left.posX_) &&
parcel.ReadInt32(waterfallDisplayAreaRects.left.posY_) && parcel.ReadInt32(waterfallDisplayAreaRects.left.posY_) &&

View File

@ -20,7 +20,7 @@
namespace OHOS::Rosen { namespace OHOS::Rosen {
bool DisplayInfo::Marshalling(Parcel &parcel) const bool DisplayInfo::Marshalling(Parcel& parcel) const
{ {
return parcel.WriteString(name_) && parcel.WriteUint64(id_) && parcel.WriteUint32(static_cast<uint32_t>(type_)) && return parcel.WriteString(name_) && parcel.WriteUint64(id_) && parcel.WriteUint32(static_cast<uint32_t>(type_)) &&
parcel.WriteInt32(width_) && parcel.WriteInt32(height_) && parcel.WriteInt32(width_) && parcel.WriteInt32(height_) &&
@ -42,7 +42,7 @@ bool DisplayInfo::Marshalling(Parcel &parcel) const
parcel.WriteFloat(scaleY_) && parcel.WriteFloat(pivotX_) && parcel.WriteFloat(pivotY_); parcel.WriteFloat(scaleY_) && parcel.WriteFloat(pivotX_) && parcel.WriteFloat(pivotY_);
} }
DisplayInfo *DisplayInfo::Unmarshalling(Parcel &parcel) DisplayInfo *DisplayInfo::Unmarshalling(Parcel& parcel)
{ {
DisplayInfo *displayInfo = new(std::nothrow) DisplayInfo(); DisplayInfo *displayInfo = new(std::nothrow) DisplayInfo();
if (displayInfo == nullptr) { if (displayInfo == nullptr) {

View File

@ -57,7 +57,7 @@ constexpr char EVENT_KEY_ACTION_EVENT[] = "ACTION_EVENT";
constexpr char EVENT_KEY_WINDOW_WIDTH[] = "WINDOW_WIDTH"; constexpr char EVENT_KEY_WINDOW_WIDTH[] = "WINDOW_WIDTH";
constexpr char EVENT_KEY_WINDOW_HEIGHT[] = "WINDOW_HEIGHT"; constexpr char EVENT_KEY_WINDOW_HEIGHT[] = "WINDOW_HEIGHT";
void PiPReporter::SetCurrentPackageName(const std::string &packageName) void PiPReporter::SetCurrentPackageName(const std::string& packageName)
{ {
std::lock_guard<std::mutex> lock(packageNameMutex_); std::lock_guard<std::mutex> lock(packageNameMutex_);
packageName_ = packageName; packageName_ = packageName;
@ -113,7 +113,7 @@ void PiPReporter::ReportPiPStopWindow(int32_t source, int32_t templateType,
LOG_WHEN_ERROR(ret); LOG_WHEN_ERROR(ret);
} }
void PiPReporter::ReportPiPActionEvent(int32_t templateType, const std::string &actionEvent) void PiPReporter::ReportPiPActionEvent(int32_t templateType, const std::string& actionEvent)
{ {
TLOGI(WmsLogTag::WMS_PIP, "Report pip widow action event"); TLOGI(WmsLogTag::WMS_PIP, "Report pip widow action event");
std::string eventName = "CONTROL_PANNEL_ACTION_EVENT"; std::string eventName = "CONTROL_PANNEL_ACTION_EVENT";

View File

@ -16,7 +16,7 @@
#include "screen_group_info.h" #include "screen_group_info.h"
namespace OHOS::Rosen { namespace OHOS::Rosen {
bool ScreenGroupInfo::Marshalling(Parcel &parcel) const bool ScreenGroupInfo::Marshalling(Parcel& parcel) const
{ {
bool res = ScreenInfo::Marshalling(parcel) && parcel.WriteUint32((uint32_t)combination_) && bool res = ScreenInfo::Marshalling(parcel) && parcel.WriteUint32((uint32_t)combination_) &&
parcel.WriteUInt64Vector(children_); parcel.WriteUInt64Vector(children_);
@ -38,7 +38,7 @@ bool ScreenGroupInfo::Marshalling(Parcel &parcel) const
return true; return true;
} }
ScreenGroupInfo* ScreenGroupInfo::Unmarshalling(Parcel &parcel) ScreenGroupInfo* ScreenGroupInfo::Unmarshalling(Parcel& parcel)
{ {
ScreenGroupInfo* screenGroupInfo = new(std::nothrow) ScreenGroupInfo(); ScreenGroupInfo* screenGroupInfo = new(std::nothrow) ScreenGroupInfo();
if (screenGroupInfo == nullptr) { if (screenGroupInfo == nullptr) {

View File

@ -16,7 +16,7 @@
#include "screen_info.h" #include "screen_info.h"
namespace OHOS::Rosen { namespace OHOS::Rosen {
bool ScreenInfo::Marshalling(Parcel &parcel) const bool ScreenInfo::Marshalling(Parcel& parcel) const
{ {
bool res = parcel.WriteString(name_) && parcel.WriteUint64(id_) && bool res = parcel.WriteString(name_) && parcel.WriteUint64(id_) &&
parcel.WriteUint32(virtualWidth_) && parcel.WriteUint32(virtualHeight_) && parcel.WriteUint32(virtualWidth_) && parcel.WriteUint32(virtualHeight_) &&
@ -44,7 +44,7 @@ bool ScreenInfo::Marshalling(Parcel &parcel) const
return true; return true;
} }
ScreenInfo* ScreenInfo::Unmarshalling(Parcel &parcel) ScreenInfo* ScreenInfo::Unmarshalling(Parcel& parcel)
{ {
ScreenInfo* info = new(std::nothrow) ScreenInfo(); ScreenInfo* info = new(std::nothrow) ScreenInfo();
if (info == nullptr) { if (info == nullptr) {

View File

@ -16,12 +16,12 @@
#include "screenshot_info.h" #include "screenshot_info.h"
namespace OHOS::Rosen { namespace OHOS::Rosen {
bool ScreenshotInfo::Marshalling(Parcel &parcel) const bool ScreenshotInfo::Marshalling(Parcel& parcel) const
{ {
return parcel.WriteString(trigger_) && parcel.WriteUint64(displayId_); return parcel.WriteString(trigger_) && parcel.WriteUint64(displayId_);
} }
ScreenshotInfo *ScreenshotInfo::Unmarshalling(Parcel &parcel) ScreenshotInfo *ScreenshotInfo::Unmarshalling(Parcel& parcel)
{ {
ScreenshotInfo *info = new(std::nothrow) ScreenshotInfo(); ScreenshotInfo *info = new(std::nothrow) ScreenshotInfo();
if (info == nullptr) { if (info == nullptr) {

View File

@ -157,7 +157,7 @@ sptr<OHOS::SurfaceBuffer> SurfaceDraw::GetSurfaceBuffer(sptr<OHOS::Surface> laye
return buffer; return buffer;
} }
std::unique_ptr<OHOS::Media::PixelMap> SurfaceDraw::DecodeImageToPixelMap(const std::string &imagePath) std::unique_ptr<OHOS::Media::PixelMap> SurfaceDraw::DecodeImageToPixelMap(const std::string& imagePath)
{ {
OHOS::Media::SourceOptions opts; OHOS::Media::SourceOptions opts;
opts.formatHint = "image/png"; opts.formatHint = "image/png";
@ -179,7 +179,7 @@ std::unique_ptr<OHOS::Media::PixelMap> SurfaceDraw::DecodeImageToPixelMap(const
return pixelMap; return pixelMap;
} }
void SurfaceDraw::DrawPixelmap(Drawing::Canvas &canvas, const std::string& imagePath) void SurfaceDraw::DrawPixelmap(Drawing::Canvas& canvas, const std::string& imagePath)
{ {
std::unique_ptr<OHOS::Media::PixelMap> pixelmap = DecodeImageToPixelMap(imagePath); std::unique_ptr<OHOS::Media::PixelMap> pixelmap = DecodeImageToPixelMap(imagePath);
if (pixelmap == nullptr) { if (pixelmap == nullptr) {
@ -195,7 +195,7 @@ void SurfaceDraw::DrawPixelmap(Drawing::Canvas &canvas, const std::string& image
RSPixelMapUtil::DrawPixelMap(canvas, *pixelmap, 0, 0); RSPixelMapUtil::DrawPixelMap(canvas, *pixelmap, 0, 0);
} }
bool SurfaceDraw::DoDraw(uint8_t *addr, uint32_t width, uint32_t height, const std::string& imagePath) bool SurfaceDraw::DoDraw(uint8_t* addr, uint32_t width, uint32_t height, const std::string& imagePath)
{ {
Drawing::Bitmap bitmap; Drawing::Bitmap bitmap;
Drawing::BitmapFormat format { Drawing::ColorType::COLORTYPE_RGBA_8888, Drawing::BitmapFormat format { Drawing::ColorType::COLORTYPE_RGBA_8888,
@ -214,7 +214,7 @@ bool SurfaceDraw::DoDraw(uint8_t *addr, uint32_t width, uint32_t height, const s
return true; return true;
} }
bool SurfaceDraw::DoDraw(uint8_t *addr, uint32_t width, uint32_t height, std::shared_ptr<Media::PixelMap> pixelMap) bool SurfaceDraw::DoDraw(uint8_t* addr, uint32_t width, uint32_t height, std::shared_ptr<Media::PixelMap> pixelMap)
{ {
Drawing::Bitmap bitmap; Drawing::Bitmap bitmap;
Drawing::Canvas canvas; Drawing::Canvas canvas;
@ -244,7 +244,7 @@ bool SurfaceDraw::DoDraw(uint8_t *addr, uint32_t width, uint32_t height, std::sh
return true; return true;
} }
bool SurfaceDraw::DoDraw(uint8_t *addr, uint32_t width, uint32_t height, uint32_t color) bool SurfaceDraw::DoDraw(uint8_t* addr, uint32_t width, uint32_t height, uint32_t color)
{ {
Drawing::Bitmap bitmap; Drawing::Bitmap bitmap;
Drawing::BitmapFormat format { Drawing::ColorType::COLORTYPE_RGBA_8888, Drawing::BitmapFormat format { Drawing::ColorType::COLORTYPE_RGBA_8888,

View File

@ -21,14 +21,14 @@ namespace {
constexpr HiviewDFX::HiLogLabel LABEL = {LOG_CORE, HILOG_DOMAIN_WINDOW, "WindowDrawingContentInfo"}; constexpr HiviewDFX::HiLogLabel LABEL = {LOG_CORE, HILOG_DOMAIN_WINDOW, "WindowDrawingContentInfo"};
} }
bool WindowDrawingContentInfo::Marshalling(Parcel &parcel) const bool WindowDrawingContentInfo::Marshalling(Parcel& parcel) const
{ {
return parcel.WriteUint32(windowId_) && parcel.WriteInt32(pid_) && return parcel.WriteUint32(windowId_) && parcel.WriteInt32(pid_) &&
parcel.WriteInt32(uid_) && parcel.WriteUint32(static_cast<uint32_t>(drawingContentState_)) && parcel.WriteInt32(uid_) && parcel.WriteUint32(static_cast<uint32_t>(drawingContentState_)) &&
parcel.WriteUint32(static_cast<uint32_t>(windowType_)); parcel.WriteUint32(static_cast<uint32_t>(windowType_));
} }
WindowDrawingContentInfo* WindowDrawingContentInfo::Unmarshalling(Parcel &parcel) WindowDrawingContentInfo* WindowDrawingContentInfo::Unmarshalling(Parcel& parcel)
{ {
auto windowDrawingContentInfo = new (std::nothrow) WindowDrawingContentInfo(); auto windowDrawingContentInfo = new (std::nothrow) WindowDrawingContentInfo();
if (windowDrawingContentInfo == nullptr) { if (windowDrawingContentInfo == nullptr) {

View File

@ -21,7 +21,7 @@ namespace {
constexpr HiviewDFX::HiLogLabel LABEL = {LOG_CORE, HILOG_DOMAIN_WINDOW, "WindowVisibilityInfo"}; constexpr HiviewDFX::HiLogLabel LABEL = {LOG_CORE, HILOG_DOMAIN_WINDOW, "WindowVisibilityInfo"};
} }
bool WindowVisibilityInfo::Marshalling(Parcel &parcel) const bool WindowVisibilityInfo::Marshalling(Parcel& parcel) const
{ {
return parcel.WriteUint32(windowId_) && parcel.WriteInt32(pid_) && return parcel.WriteUint32(windowId_) && parcel.WriteInt32(pid_) &&
parcel.WriteInt32(uid_) && parcel.WriteUint32(static_cast<uint32_t>(visibilityState_)) && parcel.WriteInt32(uid_) && parcel.WriteUint32(static_cast<uint32_t>(visibilityState_)) &&
@ -31,7 +31,7 @@ bool WindowVisibilityInfo::Marshalling(Parcel &parcel) const
parcel.WriteString(bundleName_) && parcel.WriteString(abilityName_); parcel.WriteString(bundleName_) && parcel.WriteString(abilityName_);
} }
WindowVisibilityInfo* WindowVisibilityInfo::Unmarshalling(Parcel &parcel) WindowVisibilityInfo* WindowVisibilityInfo::Unmarshalling(Parcel& parcel)
{ {
auto windowVisibilityInfo = new (std::nothrow) WindowVisibilityInfo(); auto windowVisibilityInfo = new (std::nothrow) WindowVisibilityInfo();
if (windowVisibilityInfo == nullptr) { if (windowVisibilityInfo == nullptr) {

View File

@ -58,7 +58,7 @@ sptr<AppExecFwk::IBundleMgr> GetBundleManagerProxy()
return bundleManagerServiceProxy; return bundleManagerServiceProxy;
} }
bool GetInputMethodBundleName(std::string &name) bool GetInputMethodBundleName(std::string& name)
{ {
auto imc = MiscServices::InputMethodController::GetInstance(); auto imc = MiscServices::InputMethodController::GetInstance();
if (!imc) { if (!imc) {

View File

@ -78,7 +78,7 @@ std::vector<int32_t> EventStage::DelEvents(int32_t persistentId, int32_t eventId
return {}; return {};
} }
auto &events = events_[persistentId]; auto &events = events_[persistentId];
auto fistMatchIter = find_if(events.begin(), events.end(), [eventId](const auto &item) { auto fistMatchIter = find_if(events.begin(), events.end(), [eventId](const auto& item) {
return item.eventId > eventId; return item.eventId > eventId;
}); });
std::vector<int32_t> timerIds; std::vector<int32_t> timerIds;

View File

@ -26,7 +26,7 @@ int64_t GetSysClockTime();
int64_t GetMillisTime(); int64_t GetMillisTime();
template<typename T> template<typename T>
bool AddInt(T op1, T op2, T minVal, T maxVal, T &res) bool AddInt(T op1, T op2, T minVal, T maxVal, T& res)
{ {
if (op1 >= 0) { if (op1 >= 0) {
if (op2 > maxVal - op1) { if (op2 > maxVal - op1) {
@ -41,12 +41,12 @@ bool AddInt(T op1, T op2, T minVal, T maxVal, T &res)
return true; return true;
} }
inline bool AddInt32(int32_t op1, int32_t op2, int32_t &res) inline bool AddInt32(int32_t op1, int32_t op2, int32_t& res)
{ {
return AddInt(op1, op2, INT32_MIN, INT32_MAX, res); return AddInt(op1, op2, INT32_MIN, INT32_MAX, res);
} }
inline bool AddInt64(int64_t op1, int64_t op2, int64_t &res) inline bool AddInt64(int64_t op1, int64_t op2, int64_t& res)
{ {
return AddInt(op1, op2, INT64_MIN, INT64_MAX, res); return AddInt(op1, op2, INT64_MIN, INT64_MAX, res);
} }

View File

@ -2299,7 +2299,7 @@ void JsSceneSession::TerminateSessionTotal(const SessionInfo& info, TerminateTyp
taskScheduler_->PostMainThreadTask(task, "TerminateSessionTotal:name:" + info.abilityName_); taskScheduler_->PostMainThreadTask(task, "TerminateSessionTotal:name:" + info.abilityName_);
} }
void JsSceneSession::UpdateSessionLabel(const std::string &label) void JsSceneSession::UpdateSessionLabel(const std::string& label)
{ {
WLOGFI("[NAPI]run UpdateSessionLabel"); WLOGFI("[NAPI]run UpdateSessionLabel");
@ -2349,7 +2349,7 @@ void JsSceneSession::ProcessUpdateSessionIconRegister()
WLOGFD("ProcessUpdateSessionIconRegister success"); WLOGFD("ProcessUpdateSessionIconRegister success");
} }
void JsSceneSession::UpdateSessionIcon(const std::string &iconPath) void JsSceneSession::UpdateSessionIcon(const std::string& iconPath)
{ {
WLOGFI("[NAPI]run UpdateSessionIcon"); WLOGFI("[NAPI]run UpdateSessionIcon");

View File

@ -235,8 +235,8 @@ private:
void TerminateSession(const SessionInfo& info); void TerminateSession(const SessionInfo& info);
void TerminateSessionNew(const SessionInfo& info, bool needStartCaller, bool isFromBroker); void TerminateSessionNew(const SessionInfo& info, bool needStartCaller, bool isFromBroker);
void TerminateSessionTotal(const SessionInfo& info, TerminateType terminateType); void TerminateSessionTotal(const SessionInfo& info, TerminateType terminateType);
void UpdateSessionLabel(const std::string &label); void UpdateSessionLabel(const std::string& label);
void UpdateSessionIcon(const std::string &iconPath); void UpdateSessionIcon(const std::string& iconPath);
void OnSessionException(const SessionInfo& info, bool needRemoveSession); void OnSessionException(const SessionInfo& info, bool needRemoveSession);
void OnSystemBarPropertyChange(const std::unordered_map<WindowType, SystemBarProperty>& propertyMap); void OnSystemBarPropertyChange(const std::unordered_map<WindowType, SystemBarProperty>& propertyMap);
void OnNeedAvoid(bool status); void OnNeedAvoid(bool status);

View File

@ -1052,7 +1052,7 @@ napi_value JsSceneSessionManager::OnGetAllAbilityInfos(napi_env env, napi_callba
*errCode = static_cast<int32_t>(code); *errCode = static_cast<int32_t>(code);
}; };
auto complete = [obj = this, errCode, infos = scbAbilityInfos] auto complete = [obj = this, errCode, infos = scbAbilityInfos]
(napi_env env, NapiAsyncTask &task, int32_t status) { (napi_env env, NapiAsyncTask& task, int32_t status) {
if (*errCode != static_cast<int32_t>(WSErrorCode::WS_OK)) { if (*errCode != static_cast<int32_t>(WSErrorCode::WS_OK)) {
std::string errMsg = "invalid params can not get All AbilityInfos!"; std::string errMsg = "invalid params can not get All AbilityInfos!";
task.RejectWithCustomize(env, CreateJsValue(env, *errCode), CreateJsValue(env, errMsg)); task.RejectWithCustomize(env, CreateJsValue(env, *errCode), CreateJsValue(env, errMsg));

View File

@ -796,7 +796,7 @@ napi_value CreateJsSessionInfo(napi_env env, const SessionInfo& sessionInfo)
} }
napi_value CreateJsSessionRecoverInfo( napi_value CreateJsSessionRecoverInfo(
napi_env env, const SessionInfo &sessionInfo, const sptr<WindowSessionProperty> property) napi_env env, const SessionInfo& sessionInfo, const sptr<WindowSessionProperty> property)
{ {
napi_value objValue = nullptr; napi_value objValue = nullptr;
napi_create_object(env, &objValue); napi_create_object(env, &objValue);

View File

@ -154,7 +154,7 @@ bool ConvertProcessOptionFromJs(napi_env env, napi_value jsObject,
std::shared_ptr<AAFwk::ProcessOptions> processOptions); std::shared_ptr<AAFwk::ProcessOptions> processOptions);
napi_value CreateJsSessionInfo(napi_env env, const SessionInfo& sessionInfo); napi_value CreateJsSessionInfo(napi_env env, const SessionInfo& sessionInfo);
napi_value CreateJsSessionRecoverInfo( napi_value CreateJsSessionRecoverInfo(
napi_env env, const SessionInfo &sessionInfo, const sptr<WindowSessionProperty> property); napi_env env, const SessionInfo& sessionInfo, const sptr<WindowSessionProperty> property);
void SetJsSessionInfoByWant(napi_env env, const SessionInfo& sessionInfo, napi_value objValue); void SetJsSessionInfoByWant(napi_env env, const SessionInfo& sessionInfo, napi_value objValue);
napi_value CreateJsProcessOption(napi_env env, std::shared_ptr<AAFwk::ProcessOptions> processOptions); napi_value CreateJsProcessOption(napi_env env, std::shared_ptr<AAFwk::ProcessOptions> processOptions);
napi_value CreateJsSessionStartupVisibility(napi_env env); napi_value CreateJsSessionStartupVisibility(napi_env env);

View File

@ -30,8 +30,8 @@ public:
SessionStageStub() = default; SessionStageStub() = default;
~SessionStageStub() = default; ~SessionStageStub() = default;
int OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, int OnRemoteRequest(uint32_t code, MessageParcel& data, MessageParcel& reply,
MessageOption &option) override; MessageOption& option) override;
private: private:
int HandleSetActive(MessageParcel& data, MessageParcel& reply); int HandleSetActive(MessageParcel& data, MessageParcel& reply);

View File

@ -28,8 +28,8 @@ public:
WindowEventChannelStub() = default; WindowEventChannelStub() = default;
~WindowEventChannelStub() = default; ~WindowEventChannelStub() = default;
int OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, int OnRemoteRequest(uint32_t code, MessageParcel& data, MessageParcel& reply,
MessageOption &option) override; MessageOption& option) override;
private: private:
int HandleTransferBackpressedEvent(MessageParcel& data, MessageParcel& reply); int HandleTransferBackpressedEvent(MessageParcel& data, MessageParcel& reply);

View File

@ -27,7 +27,7 @@ namespace {
constexpr HiviewDFX::HiLogLabel LABEL = {LOG_CORE, HILOG_DOMAIN_WINDOW, "SessionStageStub"}; constexpr HiviewDFX::HiLogLabel LABEL = {LOG_CORE, HILOG_DOMAIN_WINDOW, "SessionStageStub"};
} }
int SessionStageStub::OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) int SessionStageStub::OnRemoteRequest(uint32_t code, MessageParcel& data, MessageParcel& reply, MessageOption& option)
{ {
WLOGFD("Scene session stage on remote request!, code: %{public}u", code); WLOGFD("Scene session stage on remote request!, code: %{public}u", code);
if (data.ReadInterfaceToken() != GetDescriptor()) { if (data.ReadInterfaceToken() != GetDescriptor()) {

View File

@ -30,8 +30,8 @@ namespace {
constexpr HiviewDFX::HiLogLabel LABEL = {LOG_CORE, HILOG_DOMAIN_WINDOW, "WindowEventChannelStub"}; constexpr HiviewDFX::HiLogLabel LABEL = {LOG_CORE, HILOG_DOMAIN_WINDOW, "WindowEventChannelStub"};
} }
int WindowEventChannelStub::OnRemoteRequest(uint32_t code, MessageParcel &data, int WindowEventChannelStub::OnRemoteRequest(uint32_t code, MessageParcel& data,
MessageParcel &reply, MessageOption &option) MessageParcel& reply, MessageOption& option)
{ {
WLOGFD("Window event channel on remote request!, code: %{public}u", code); WLOGFD("Window event channel on remote request!, code: %{public}u", code);
if (data.ReadInterfaceToken() != GetDescriptor()) { if (data.ReadInterfaceToken() != GetDescriptor()) {
@ -178,7 +178,7 @@ int WindowEventChannelStub::HandleTransferAccessibilityHoverEvent(MessageParcel&
return ERR_NONE; return ERR_NONE;
} }
int32_t WindowEventChannelStub::HandleTransferAccessibilityChildTreeRegister(MessageParcel &data, MessageParcel &reply) int32_t WindowEventChannelStub::HandleTransferAccessibilityChildTreeRegister(MessageParcel& data, MessageParcel& reply)
{ {
uint32_t windowId = 0; uint32_t windowId = 0;
int32_t treeId = -1; int32_t treeId = -1;
@ -195,14 +195,14 @@ int32_t WindowEventChannelStub::HandleTransferAccessibilityChildTreeRegister(Mes
} }
int32_t WindowEventChannelStub::HandleTransferAccessibilityChildTreeUnregister( int32_t WindowEventChannelStub::HandleTransferAccessibilityChildTreeUnregister(
MessageParcel &data, MessageParcel &reply) MessageParcel& data, MessageParcel& reply)
{ {
WSError errCode = TransferAccessibilityChildTreeUnregister(); WSError errCode = TransferAccessibilityChildTreeUnregister();
reply.WriteInt32(static_cast<int32_t>(errCode)); reply.WriteInt32(static_cast<int32_t>(errCode));
return ERR_NONE; return ERR_NONE;
} }
int32_t WindowEventChannelStub::HandleTransferAccessibilityDumpChildInfo(MessageParcel &data, MessageParcel &reply) int32_t WindowEventChannelStub::HandleTransferAccessibilityDumpChildInfo(MessageParcel& data, MessageParcel& reply)
{ {
std::vector<std::string> params; std::vector<std::string> params;
if (!data.ReadStringVector(&params)) { if (!data.ReadStringVector(&params)) {

View File

@ -431,7 +431,7 @@ private:
bool SaveAspectRatio(float ratio); bool SaveAspectRatio(float ratio);
void NotifyPropertyWhenConnect(); void NotifyPropertyWhenConnect();
WSError RaiseAppMainWindowToTop() override; WSError RaiseAppMainWindowToTop() override;
void SetSurfaceBounds(const WSRect &rect); void SetSurfaceBounds(const WSRect& rect);
void UpdateWinRectForSystemBar(WSRect& rect); void UpdateWinRectForSystemBar(WSRect& rect);
bool UpdateInputMethodSessionRect(const WSRect& rect, WSRect& newWinRect, WSRect& newRequestRect); bool UpdateInputMethodSessionRect(const WSRect& rect, WSRect& newWinRect, WSRect& newRequestRect);
bool IsMovableWindowType(); bool IsMovableWindowType();

View File

@ -62,8 +62,8 @@ using NotifyTerminateSessionFunc = std::function<void(const SessionInfo& info)>;
using NotifyTerminateSessionFuncNew = using NotifyTerminateSessionFuncNew =
std::function<void(const SessionInfo& info, bool needStartCaller, bool isFromBroker)>; std::function<void(const SessionInfo& info, bool needStartCaller, bool isFromBroker)>;
using NotifyTerminateSessionFuncTotal = std::function<void(const SessionInfo& info, TerminateType terminateType)>; using NotifyTerminateSessionFuncTotal = std::function<void(const SessionInfo& info, TerminateType terminateType)>;
using NofitySessionLabelUpdatedFunc = std::function<void(const std::string &label)>; using NofitySessionLabelUpdatedFunc = std::function<void(const std::string& label)>;
using NofitySessionIconUpdatedFunc = std::function<void(const std::string &iconPath)>; using NofitySessionIconUpdatedFunc = std::function<void(const std::string& iconPath)>;
using NotifySessionExceptionFunc = std::function<void(const SessionInfo& info, bool needRemoveSession)>; using NotifySessionExceptionFunc = std::function<void(const SessionInfo& info, bool needRemoveSession)>;
using NotifySessionSnapshotFunc = std::function<void(const int32_t& persistentId)>; using NotifySessionSnapshotFunc = std::function<void(const int32_t& persistentId)>;
using NotifyPendingSessionToForegroundFunc = std::function<void(const SessionInfo& info)>; using NotifyPendingSessionToForegroundFunc = std::function<void(const SessionInfo& info)>;
@ -234,7 +234,7 @@ public:
WSError TerminateSessionTotal(const sptr<AAFwk::SessionInfo> info, TerminateType terminateType); WSError TerminateSessionTotal(const sptr<AAFwk::SessionInfo> info, TerminateType terminateType);
void SetTerminateSessionListenerTotal(const NotifyTerminateSessionFuncTotal& func); void SetTerminateSessionListenerTotal(const NotifyTerminateSessionFuncTotal& func);
WSError Clear(bool needStartCaller = false); WSError Clear(bool needStartCaller = false);
WSError SetSessionLabel(const std::string &label); WSError SetSessionLabel(const std::string& label);
void SetUpdateSessionLabelListener(const NofitySessionLabelUpdatedFunc& func); void SetUpdateSessionLabelListener(const NofitySessionLabelUpdatedFunc& func);
WSError SetSessionIcon(const std::shared_ptr<Media::PixelMap> &icon); WSError SetSessionIcon(const std::shared_ptr<Media::PixelMap> &icon);
void SetUpdateSessionIconListener(const NofitySessionIconUpdatedFunc& func); void SetUpdateSessionIconListener(const NofitySessionIconUpdatedFunc& func);
@ -358,8 +358,8 @@ public:
void SetRaiseToAppTopForPointDownFunc(const NotifyRaiseToTopForPointDownFunc& func); void SetRaiseToAppTopForPointDownFunc(const NotifyRaiseToTopForPointDownFunc& func);
void NotifyScreenshot(); void NotifyScreenshot();
void RemoveLifeCycleTask(const LifeCycleTaskType &taskType); void RemoveLifeCycleTask(const LifeCycleTaskType& taskType);
void PostLifeCycleTask(Task &&task, const std::string &name, const LifeCycleTaskType &taskType); void PostLifeCycleTask(Task &&task, const std::string& name, const LifeCycleTaskType& taskType);
WSError UpdateMaximizeMode(bool isMaximize); WSError UpdateMaximizeMode(bool isMaximize);
void NotifySessionForeground(uint32_t reason, bool withAnimation); void NotifySessionForeground(uint32_t reason, bool withAnimation);
void NotifySessionBackground(uint32_t reason, bool withAnimation, bool isFromInnerkits); void NotifySessionBackground(uint32_t reason, bool withAnimation, bool isFromInnerkits);
@ -441,7 +441,7 @@ public:
protected: protected:
class SessionLifeCycleTask : public virtual RefBase { class SessionLifeCycleTask : public virtual RefBase {
public: public:
SessionLifeCycleTask(const Task &task, const std::string &name, const LifeCycleTaskType &type) SessionLifeCycleTask(const Task& task, const std::string& name, const LifeCycleTaskType& type)
: task(task), name(name), type(type) {} : task(task), name(name), type(type) {}
Task task; Task task;
const std::string name; const std::string name;

View File

@ -56,8 +56,8 @@ inline void CalcFloatWindowRectLimits(const WindowLimits& limits, uint32_t maxFl
maxHeight = std::min(maxHeight, static_cast<int32_t>(maxFloatingWindowSize * vpr)); maxHeight = std::min(maxHeight, static_cast<int32_t>(maxFloatingWindowSize * vpr));
} }
inline std::string ConvertSessionName(const std::string &bundleName, const std::string &name, inline std::string ConvertSessionName(const std::string& bundleName, const std::string& name,
const std::string &moduleName, const int32_t appIndex = 0) const std::string& moduleName, const int32_t appIndex = 0)
{ {
std::string strName; std::string strName;
if (appIndex == 0) { if (appIndex == 0) {

View File

@ -30,7 +30,7 @@ public:
SessionStub() = default; SessionStub() = default;
virtual ~SessionStub() = default; virtual ~SessionStub() = default;
int OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override; int OnRemoteRequest(uint32_t code, MessageParcel& data, MessageParcel& reply, MessageOption& option) override;
private: private:
int HandleConnect(MessageParcel& data, MessageParcel& reply); int HandleConnect(MessageParcel& data, MessageParcel& reply);
@ -55,9 +55,9 @@ private:
int HandleSetWindowAnimationFlag(MessageParcel& data, MessageParcel& reply); int HandleSetWindowAnimationFlag(MessageParcel& data, MessageParcel& reply);
int HandleUpdateWindowSceneAfterCustomAnimation(MessageParcel& data, MessageParcel& reply); int HandleUpdateWindowSceneAfterCustomAnimation(MessageParcel& data, MessageParcel& reply);
int HandleRaiseAboveTarget(MessageParcel& data, MessageParcel& reply); int HandleRaiseAboveTarget(MessageParcel& data, MessageParcel& reply);
int HandleRaiseAppMainWindowToTop(MessageParcel &data, MessageParcel &reply); int HandleRaiseAppMainWindowToTop(MessageParcel& data, MessageParcel& reply);
int HandleChangeSessionVisibilityWithStatusBar(MessageParcel &data, MessageParcel &reply); int HandleChangeSessionVisibilityWithStatusBar(MessageParcel& data, MessageParcel& reply);
int HandlePendingSessionActivation(MessageParcel &data, MessageParcel &reply); int HandlePendingSessionActivation(MessageParcel& data, MessageParcel& reply);
int HandleTerminateSession(MessageParcel& data, MessageParcel& reply); int HandleTerminateSession(MessageParcel& data, MessageParcel& reply);
int HandleSessionException(MessageParcel& data, MessageParcel& reply); int HandleSessionException(MessageParcel& data, MessageParcel& reply);
int HandleProcessPointDownSession(MessageParcel& data, MessageParcel& reply); int HandleProcessPointDownSession(MessageParcel& data, MessageParcel& reply);

View File

@ -151,7 +151,7 @@ bool ScenePersistence::IsSavingSnapshot()
return isSavingSnapshot_.load(); return isSavingSnapshot_.load();
} }
void ScenePersistence::RenameSnapshotFromOldPersistentId(const int32_t &oldPersistentId) void ScenePersistence::RenameSnapshotFromOldPersistentId(const int32_t& oldPersistentId)
{ {
auto task = [weakThis = wptr(this), oldPersistentId]() { auto task = [weakThis = wptr(this), oldPersistentId]() {
auto scenePersistence = weakThis.promote(); auto scenePersistence = weakThis.promote();

View File

@ -467,7 +467,7 @@ WSError SceneSession::SetGlobalMaximizeMode(MaximizeMode mode)
return PostSyncTask(task, "SetGlobalMaximizeMode"); return PostSyncTask(task, "SetGlobalMaximizeMode");
} }
WSError SceneSession::GetGlobalMaximizeMode(MaximizeMode &mode) WSError SceneSession::GetGlobalMaximizeMode(MaximizeMode& mode)
{ {
auto task = [weakThis = wptr(this), &mode]() { auto task = [weakThis = wptr(this), &mode]() {
auto session = weakThis.promote(); auto session = weakThis.promote();

View File

@ -1249,7 +1249,7 @@ void Session::SetTerminateSessionListener(const NotifyTerminateSessionFunc& func
terminateSessionFunc_ = func; terminateSessionFunc_ = func;
} }
void Session::RemoveLifeCycleTask(const LifeCycleTaskType &taskType) void Session::RemoveLifeCycleTask(const LifeCycleTaskType& taskType)
{ {
std::lock_guard<std::mutex> lock(lifeCycleTaskQueueMutex_); std::lock_guard<std::mutex> lock(lifeCycleTaskQueueMutex_);
if (lifeCycleTaskQueue_.empty()) { if (lifeCycleTaskQueue_.empty()) {
@ -1382,7 +1382,7 @@ void Session::SetTerminateSessionListenerTotal(const NotifyTerminateSessionFuncT
terminateSessionFuncTotal_ = func; terminateSessionFuncTotal_ = func;
} }
WSError Session::SetSessionLabel(const std::string &label) WSError Session::SetSessionLabel(const std::string& label)
{ {
WLOGFI("run Session::SetSessionLabel"); WLOGFI("run Session::SetSessionLabel");
if (updateSessionLabelFunc_) { if (updateSessionLabelFunc_) {
@ -1391,7 +1391,7 @@ WSError Session::SetSessionLabel(const std::string &label)
return WSError::WS_OK; return WSError::WS_OK;
} }
void Session::SetUpdateSessionLabelListener(const NofitySessionLabelUpdatedFunc &func) void Session::SetUpdateSessionLabelListener(const NofitySessionLabelUpdatedFunc& func)
{ {
updateSessionLabelFunc_ = func; updateSessionLabelFunc_ = func;
} }
@ -1411,7 +1411,7 @@ WSError Session::SetSessionIcon(const std::shared_ptr<Media::PixelMap> &icon)
return WSError::WS_OK; return WSError::WS_OK;
} }
void Session::SetUpdateSessionIconListener(const NofitySessionIconUpdatedFunc &func) void Session::SetUpdateSessionIconListener(const NofitySessionIconUpdatedFunc& func)
{ {
updateSessionIconFunc_ = func; updateSessionIconFunc_ = func;
} }

View File

@ -36,7 +36,7 @@ namespace {
constexpr HiviewDFX::HiLogLabel LABEL = { LOG_CORE, HILOG_DOMAIN_WINDOW, "SessionStub" }; constexpr HiviewDFX::HiLogLabel LABEL = { LOG_CORE, HILOG_DOMAIN_WINDOW, "SessionStub" };
} // namespace } // namespace
int SessionStub::OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) int SessionStub::OnRemoteRequest(uint32_t code, MessageParcel& data, MessageParcel& reply, MessageOption& option)
{ {
WLOGFD("Scene session on remote request!, code: %{public}u", code); WLOGFD("Scene session on remote request!, code: %{public}u", code);
if (data.ReadInterfaceToken() != GetDescriptor()) { if (data.ReadInterfaceToken() != GetDescriptor()) {
@ -485,7 +485,7 @@ int SessionStub::HandleMarkProcessed(MessageParcel& data, MessageParcel& reply)
return ERR_NONE; return ERR_NONE;
} }
int SessionStub::HandleSetGlobalMaximizeMode(MessageParcel &data, MessageParcel &reply) int SessionStub::HandleSetGlobalMaximizeMode(MessageParcel& data, MessageParcel& reply)
{ {
WLOGFD("HandleSetGlobalMaximizeMode!"); WLOGFD("HandleSetGlobalMaximizeMode!");
auto mode = data.ReadUint32(); auto mode = data.ReadUint32();
@ -494,7 +494,7 @@ int SessionStub::HandleSetGlobalMaximizeMode(MessageParcel &data, MessageParcel
return ERR_NONE; return ERR_NONE;
} }
int SessionStub::HandleGetGlobalMaximizeMode(MessageParcel &data, MessageParcel &reply) int SessionStub::HandleGetGlobalMaximizeMode(MessageParcel& data, MessageParcel& reply)
{ {
WLOGFD("HandleGetGlobalMaximizeMode!"); WLOGFD("HandleGetGlobalMaximizeMode!");
MaximizeMode mode = MaximizeMode::MODE_FULL_FILL; MaximizeMode mode = MaximizeMode::MODE_FULL_FILL;
@ -692,7 +692,7 @@ int SessionStub::HandleUpdateRectChangeListenerRegistered(MessageParcel& data, M
return ERR_NONE; return ERR_NONE;
} }
int SessionStub::HandleSetKeyboardSessionGravity(MessageParcel &data, MessageParcel &reply) int SessionStub::HandleSetKeyboardSessionGravity(MessageParcel& data, MessageParcel& reply)
{ {
TLOGD(WmsLogTag::WMS_KEYBOARD, "run HandleSetKeyboardSessionGravity!"); TLOGD(WmsLogTag::WMS_KEYBOARD, "run HandleSetKeyboardSessionGravity!");
SessionGravity gravity = static_cast<SessionGravity>(data.ReadUint32()); SessionGravity gravity = static_cast<SessionGravity>(data.ReadUint32());

Some files were not shown because too many files have changed in this diff Show More