From 4209b8a89b22df37f43d3e90e4a92344ee4babf6 Mon Sep 17 00:00:00 2001 From: yanxuejun Date: Fri, 19 Jul 2024 13:14:07 +0000 Subject: [PATCH] fix: the difference between blue and yellow Signed-off-by: yanxuejun --- frameworks/napi/power/power_napi.cpp | 2 +- frameworks/native/power_mgr_client.cpp | 32 +++++++++---------- .../native/include/power_mgr_client.h | 4 ++- .../include/power_mgr_ipc_interface_code.h | 6 ++-- .../PowerUiExtensionAbility.ts | 5 ++- powermanager.yaml | 9 +++--- 6 files changed, 29 insertions(+), 29 deletions(-) diff --git a/frameworks/napi/power/power_napi.cpp b/frameworks/napi/power/power_napi.cpp index bc3d29bf..a3be7496 100644 --- a/frameworks/napi/power/power_napi.cpp +++ b/frameworks/napi/power/power_napi.cpp @@ -191,8 +191,8 @@ static void SetFrameworkBootStage(bool isReboot) ret = ioctl(fd, SET_SHUT_STAGE, &stage); if (ret < 0) { POWER_HILOGE(FEATURE_SHUTDOWN, "set shut stage failed!"); - close(fd); } + close(fd); return; } diff --git a/frameworks/native/power_mgr_client.cpp b/frameworks/native/power_mgr_client.cpp index d12ad241..4e33882a 100644 --- a/frameworks/native/power_mgr_client.cpp +++ b/frameworks/native/power_mgr_client.cpp @@ -367,22 +367,6 @@ bool PowerMgrClient::UnRegisterPowerModeCallback(const sptr& return ret; } -bool PowerMgrClient::RegisterRunningLockCallback(const sptr& callback) -{ - RETURN_IF_WITH_RET((callback == nullptr) || (Connect() != ERR_OK), false); - POWER_HILOGI(FEATURE_RUNNING_LOCK, "Register running lock Callback by client"); - bool ret = proxy_->RegisterRunningLockCallback(callback); - return ret; -} - -bool PowerMgrClient::UnRegisterRunningLockCallback(const sptr& callback) -{ - RETURN_IF_WITH_RET((callback == nullptr) || (Connect() != ERR_OK), false); - POWER_HILOGI(FEATURE_RUNNING_LOCK, "Unregister running lock Callback by client"); - bool ret = proxy_->UnRegisterRunningLockCallback(callback); - return ret; -} - bool PowerMgrClient::RegisterScreenStateCallback(int32_t remainTime, const sptr& callback) { RETURN_IF_WITH_RET((remainTime <= 0) || (callback == nullptr) || (Connect() != ERR_OK), false); @@ -399,6 +383,22 @@ bool PowerMgrClient::UnRegisterScreenStateCallback(const sptr& callback) +{ + RETURN_IF_WITH_RET((callback == nullptr) || (Connect() != ERR_OK), false); + POWER_HILOGI(FEATURE_RUNNING_LOCK, "Register running lock Callback by client"); + bool ret = proxy_->RegisterRunningLockCallback(callback); + return ret; +} + +bool PowerMgrClient::UnRegisterRunningLockCallback(const sptr& callback) +{ + RETURN_IF_WITH_RET((callback == nullptr) || (Connect() != ERR_OK), false); + POWER_HILOGI(FEATURE_RUNNING_LOCK, "Unregister running lock Callback by client"); + bool ret = proxy_->UnRegisterRunningLockCallback(callback); + return ret; +} + bool PowerMgrClient::SetDisplaySuspend(bool enable) { RETURN_IF_WITH_RET(Connect() != ERR_OK, false); diff --git a/interfaces/inner_api/native/include/power_mgr_client.h b/interfaces/inner_api/native/include/power_mgr_client.h index 9831a3f8..88ac1b35 100644 --- a/interfaces/inner_api/native/include/power_mgr_client.h +++ b/interfaces/inner_api/native/include/power_mgr_client.h @@ -17,6 +17,8 @@ #define POWERMGR_POWER_MGR_CLIENT_H #include +#include + #include "power_state_machine_info.h" #include "running_lock.h" @@ -168,11 +170,11 @@ public: bool UnRegisterSyncSleepCallback(const sptr& callback); bool RegisterPowerModeCallback(const sptr& callback); bool UnRegisterPowerModeCallback(const sptr& callback); + void RecoverRunningLocks(); bool RegisterScreenStateCallback(int32_t remainTime, const sptr& callback); bool UnRegisterScreenStateCallback(const sptr& callback); bool RegisterRunningLockCallback(const sptr& callback); bool UnRegisterRunningLockCallback(const sptr& callback); - void RecoverRunningLocks(); std::string Dump(const std::vector& args); PowerErrors GetError(); diff --git a/interfaces/inner_api/native/include/power_mgr_ipc_interface_code.h b/interfaces/inner_api/native/include/power_mgr_ipc_interface_code.h index 58bfff2b..174325a8 100644 --- a/interfaces/inner_api/native/include/power_mgr_ipc_interface_code.h +++ b/interfaces/inner_api/native/include/power_mgr_ipc_interface_code.h @@ -55,15 +55,15 @@ enum class PowerMgrInterfaceCode { UNREG_SYNC_SLEEP_CALLBACK, SET_FORCE_TIMING_OUT, LOCK_SCREEN_AFTER_TIMING_OUT, - REG_RUNNINGLOCK_CALLBACK, - UNREG_RUNNINGLOCK_CALLBACK, HIBERNATE, REG_SCREEN_OFF_PRE_CALLBACK, UNREG_SCREEN_OFF_PRE_CALLBACK, + REG_RUNNINGLOCK_CALLBACK, + UNREG_RUNNINGLOCK_CALLBACK, SET_SUSPEND_TAG, - UPDATE_WORK_SOURCE, REG_SYNC_HIBERNATE_CALLBACK, UNREG_SYNC_HIBERNATE_CALLBACK, + UPDATE_WORK_SOURCE }; } // space PowerMgr } // namespace OHOS diff --git a/power_dialog/entry/src/main/ets/UiExtensionAbility/PowerUiExtensionAbility.ts b/power_dialog/entry/src/main/ets/UiExtensionAbility/PowerUiExtensionAbility.ts index 86d95e58..f837f86e 100644 --- a/power_dialog/entry/src/main/ets/UiExtensionAbility/PowerUiExtensionAbility.ts +++ b/power_dialog/entry/src/main/ets/UiExtensionAbility/PowerUiExtensionAbility.ts @@ -22,9 +22,8 @@ export default class PowerUiExtensionAbility extends UIExtensionAbility { 'session': session }); - if('isInputDlg' in want.parameters) - { - if(want.parameters.isInputDlg === true){ + if ('isInputDlg' in want.parameters) { + if (want.parameters.isInputDlg === true) { session.loadContent('pages/inputDialog', storage); session.setWindowBackgroundColor('#00000000'); return; diff --git a/powermanager.yaml b/powermanager.yaml index 783ff20b..3c94ea2a 100644 --- a/powermanager.yaml +++ b/powermanager.yaml @@ -30,6 +30,10 @@ SCREEN: STATE: {type: INT32, desc: screen state} BRIGHTNESS: {type: INT32, desc: brightness level} +STATE: + __BASE: {type: STATISTIC, level: MINOR, tag: PowerStats, desc: power state} + STATE: {type: INT32, desc: power state} + SCREEN_ON_TIMEOUT: __BASE: {type: FAULT, level: CRITICAL, desc: timeout screen on information} PID: {type: INT32, desc: session pid} @@ -48,11 +52,6 @@ SCREEN_OFF_TIMEOUT: MSG: {type: STRING, desc: screen off timeout message} REASON: {type: STRING, desc: screen off reason} -STATE: - __BASE: {type: STATISTIC, level: MINOR, tag: PowerStats, desc: power state} - STATE: {type: INT32, desc: power state} - - STATE_CORRECTION: __BASE: {type: FAULT, level: CRITICAL, desc: the power state is inconsistent with the display state} ERROR_STATE: {type: INT32, desc: the state of the current error}