diff --git a/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/embedding/engine/systemchannels/NativeVsyncChannel.ets b/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/embedding/engine/systemchannels/NativeVsyncChannel.ets index 0afc63c245da2a46efdf401037dc7fc0b50d3894..2876b6fbb8501e7e0f88e6a6f011b7703f2090f1 100644 --- a/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/embedding/engine/systemchannels/NativeVsyncChannel.ets +++ b/shell/platform/ohos/flutter_embedding/flutter/src/main/ets/embedding/engine/systemchannels/NativeVsyncChannel.ets @@ -34,7 +34,7 @@ export default class NativeVsyncChannel implements MessageHandler { onMessage(message: object, reply: Reply): void { let data: HashMap = message as HashMap; let isEnable: boolean = data.get("isEnable"); - this.flutterNapi.setDVsyncSwitch(isEnable); + this.flutterNapi.SetDVsyncSwitch(isEnable); Log.d(NativeVsyncChannel.TAG, `Received message: isEnable:$isEnable`); reply.reply(StringUtils.stringToArrayBuffer("")); diff --git a/shell/platform/ohos/ohos_shell_holder.h b/shell/platform/ohos/ohos_shell_holder.h index 6fba882739c27999b0b0e596c8178e72ce9c99e3..e18c7e88de7e21f9604ba51c5d8c80545ec42bd7 100644 --- a/shell/platform/ohos/ohos_shell_holder.h +++ b/shell/platform/ohos/ohos_shell_holder.h @@ -68,7 +68,7 @@ class OHOSShellHolder { return shell_->GetPlatformMessageHandler(); } - const std::weak_ptr& GetVsyncWaiter() const { + const std::weak_ptr GetVsyncWaiter() const { return shell_->GetVsyncWaiter(); } diff --git a/shell/platform/ohos/vsync_waiter_ohos.cpp b/shell/platform/ohos/vsync_waiter_ohos.cpp index 88d1208f5efff8cc0bcdd3ceaf2d127c0f9ce546..7c60239e2de2765aef18d8a0ff7d16cbd5dcfb3e 100644 --- a/shell/platform/ohos/vsync_waiter_ohos.cpp +++ b/shell/platform/ohos/vsync_waiter_ohos.cpp @@ -22,10 +22,10 @@ namespace flutter { static std::atomic_uint g_refresh_rate_ = 60; -static constexpr uint32_t SUPPORT_API_VERSION = 14; +static constexpr int32_t SUPPORT_API_VERSION = 14; const char* flutterSyncName = "flutter_connect"; -const char* NATIVE_DVSYNC_SO = "libnative_vsync.so" +const char* NATIVE_DVSYNC_SO = "libnative_vsync.so"; thread_local bool VsyncWaiterOHOS::firstCall = true; @@ -119,7 +119,7 @@ void VsyncWaiterOHOS::SetDvsyncSwitch(bool enableDvsync) { apiVersion_ = OH_GetSdkApiVersion(); } if (apiVersion_ < SUPPORT_API_VERSION) { - LOGI("current api version not support native dvsync!") + LOGI("current api version not support native dvsync!"); return; } if (!handle_) { @@ -131,7 +131,7 @@ void VsyncWaiterOHOS::SetDvsyncSwitch(bool enableDvsync) { } if (!nativeDvsyncFunc_) { - nativeDvsyncFunc_ = reinterpret_cast(dlsm(handle_, "OH_NativeVSync_DVSyncSwitch")); + nativeDvsyncFunc_ = reinterpret_cast(dlsym(handle_, "OH_NativeVSync_DVSyncSwitch")); } if (!nativeDvsyncFunc_) { LOGE("SetDvsyncSwitch load OH_NativeVSync_DVSyncSwitch failed!");