diff --git a/LICENSE b/LICENSE old mode 100644 new mode 100755 diff --git a/OAT.xml b/OAT.xml old mode 100644 new mode 100755 diff --git a/README.md b/README.md old mode 100644 new mode 100755 diff --git a/README_zh.md b/README_zh.md old mode 100644 new mode 100755 diff --git a/bundle.json b/bundle.json old mode 100644 new mode 100755 diff --git a/figures/power-management-subsystem-architecture.png b/figures/power-management-subsystem-architecture.png old mode 100644 new mode 100755 diff --git a/frameworks/include/power_manager_napi.h b/frameworks/include/power_manager_napi.h old mode 100644 new mode 100755 diff --git a/frameworks/include/power_napi_context.h b/frameworks/include/power_napi_context.h old mode 100644 new mode 100755 diff --git a/frameworks/include/running_lock_napi.h b/frameworks/include/running_lock_napi.h old mode 100644 new mode 100755 diff --git a/frameworks/napi/power/BUILD.gn b/frameworks/napi/power/BUILD.gn old mode 100644 new mode 100755 diff --git a/frameworks/napi/power/power.cpp b/frameworks/napi/power/power.cpp old mode 100644 new mode 100755 diff --git a/frameworks/napi/power_manager_napi.cpp b/frameworks/napi/power_manager_napi.cpp old mode 100644 new mode 100755 diff --git a/frameworks/napi/runninglock/BUILD.gn b/frameworks/napi/runninglock/BUILD.gn old mode 100644 new mode 100755 diff --git a/frameworks/napi/runninglock/runninglock.cpp b/frameworks/napi/runninglock/runninglock.cpp old mode 100644 new mode 100755 diff --git a/frameworks/napi/test/power_manager_unit.test.js b/frameworks/napi/test/power_manager_unit.test.js old mode 100644 new mode 100755 diff --git a/frameworks/native/power_mgr_client.cpp b/frameworks/native/power_mgr_client.cpp old mode 100644 new mode 100755 diff --git a/frameworks/native/running_lock.cpp b/frameworks/native/running_lock.cpp old mode 100644 new mode 100755 diff --git a/frameworks/native/running_lock_info.cpp b/frameworks/native/running_lock_info.cpp old mode 100644 new mode 100755 diff --git a/frameworks/native/running_lock_token_stub.cpp b/frameworks/native/running_lock_token_stub.cpp old mode 100644 new mode 100755 diff --git a/hdi/BUILD.gn b/hdi/BUILD.gn deleted file mode 100644 index d20b88e7536abcb9bb80cee3a78b4d2ace2485a4..0000000000000000000000000000000000000000 --- a/hdi/BUILD.gn +++ /dev/null @@ -1,21 +0,0 @@ -# Copyright (c) 2021 Huawei Device Co., Ltd. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import("//build/ohos.gni") - -group("hdi_group") { - deps = [ - "client:power_hdf_client", - "service:power_hdf_service", - ] -} diff --git a/hdi/api/include/ipower_hdf_callback.h b/hdi/api/include/ipower_hdf_callback.h deleted file mode 100644 index 2458fa5da068d634fc602b48fd97977c04c1310d..0000000000000000000000000000000000000000 --- a/hdi/api/include/ipower_hdf_callback.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef POWERMGR_IPOWER_HDF_SUSPEND_CALLBACK_H -#define POWERMGR_IPOWER_HDF_SUSPEND_CALLBACK_H - -#include "ipc_object_stub.h" -#include "power_hdf_info.h" - -namespace OHOS { -namespace PowerMgr { -class IPowerHdfCallback : public IPCObjectStub { -public: - explicit IPowerHdfCallback() : IPCObjectStub(u"ohos.powermgr.IPowerHdfCallback") {}; - virtual ~IPowerHdfCallback() = default; - int OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override; - virtual void OnSuspend() = 0; - virtual void OnWakeup() = 0; -}; -} // namespace PowerMgr -} // namespace OHOS -#endif // POWERMGR_IPOWER_HDF_SUSPEND_CALLBACK_H diff --git a/hdi/api/include/power_hdf_client.h b/hdi/api/include/power_hdf_client.h deleted file mode 100644 index f865f169ac07cc092dba79930efb874d5a9d9d43..0000000000000000000000000000000000000000 --- a/hdi/api/include/power_hdf_client.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef POWER_HDF_CLIENT_H -#define POWER_HDF_CLIENT_H - -#include -#include "ipower_hdf_callback.h" - -namespace OHOS { -namespace PowerMgr { -class PowerHdfClient { -public: - PowerHdfClient() = default; - ~PowerHdfClient() = default; - ErrCode RegisterCallback(const sptr& callback); - ErrCode StartSuspend(); - ErrCode StopSuspend(); - ErrCode ForceSuspend(); - ErrCode SuspendBlock(const std::string& name); - ErrCode SuspendUnblock(const std::string& name); - ErrCode Dump(std::string& info); -private: - ErrCode Dispatch(uint32_t cmd, MessageParcel &data, MessageParcel &reply); - sptr GetService(); -}; -} // namespace PowerMgr -} // namespace OHOS - -#endif // POWER_HDF_CLIENT_H \ No newline at end of file diff --git a/hdi/api/include/power_hdf_info.h b/hdi/api/include/power_hdf_info.h deleted file mode 100644 index 5f829bcfaf7dffa54ee2d53d7e95b2c10463ee3a..0000000000000000000000000000000000000000 --- a/hdi/api/include/power_hdf_info.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef POWER_HDF_INFO_H -#define POWER_HDF_INFO_H - -enum PowerHdfCmd { - CMD_REGISTER_CALLBCK = 0, - CMD_START_SUSPEND, - CMD_STOP_SUSPEND, - CMD_FORCE_SUSPEND, - CMD_SUSPEND_BLOCK, - CMD_SUSPEND_UNBLOCK, - CMD_DUMP, -}; - -enum PowerHdfCallbackCmd { - CMD_ON_SUSPEND = 0, - CMD_ON_WAKEUP, -}; - -enum PowerHdfState { - AWAKE = 0, - INACTIVE, - SLEEP, -}; - -#endif // POWER_HDF_INFO_H \ No newline at end of file diff --git a/hdi/client/BUILD.gn b/hdi/client/BUILD.gn deleted file mode 100644 index 8711bca1e2612aa3dce967723856eb88e773cc88..0000000000000000000000000000000000000000 --- a/hdi/client/BUILD.gn +++ /dev/null @@ -1,48 +0,0 @@ -# Copyright (c) 2021 Huawei Device Co., Ltd. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import("//base/powermgr/power_manager/powermgr.gni") -import("//build/ohos.gni") -import("//drivers/adapter/uhdf2/uhdf.gni") - -config("power_client_public_config") { - include_dirs = [ - "include", - "${powermgr_root_path}/hdi/api/include", - ] -} - -ohos_shared_library("power_hdf_client") { - sources = [ - "src/power_hdf_callback.cpp", - "src/power_hdf_client.cpp", - ] - - configs = [ "${powermgr_utils_path}:utils_config" ] - - public_configs = [ ":power_client_public_config" ] - - deps = [ - "${hdf_uhdf_path}/hdi:libhdi", - "${hdf_uhdf_path}/host:libhdf_host", - "${hdf_uhdf_path}/utils:libhdf_utils", - "//utils/native/base:utils", - ] - - external_deps = [ - "hiviewdfx_hilog_native:libhilog", - "ipc:ipc_core", - ] - - part_name = "power_manager_native" -} diff --git a/hdi/client/src/power_hdf_callback.cpp b/hdi/client/src/power_hdf_callback.cpp deleted file mode 100644 index 75972208a2b0111247b008ae958b44f0e52075e9..0000000000000000000000000000000000000000 --- a/hdi/client/src/power_hdf_callback.cpp +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "ipower_hdf_callback.h" - -namespace OHOS { -namespace PowerMgr { -int IPowerHdfCallback::OnRemoteRequest(uint32_t code, - MessageParcel &data, - MessageParcel &reply, - MessageOption &option) -{ - switch (code) { - case CMD_ON_SUSPEND: { - OnSuspend(); - return ERR_OK; - } - case CMD_ON_WAKEUP: { - OnWakeup(); - return ERR_OK; - } - default: { - return ERR_INVALID_OPERATION; - } - } -} -} // namespace PowerMgr -} // namespace OHOS \ No newline at end of file diff --git a/hdi/client/src/power_hdf_client.cpp b/hdi/client/src/power_hdf_client.cpp deleted file mode 100644 index a48f8cfe4cfe980a22d468ce62619e9037d89123..0000000000000000000000000000000000000000 --- a/hdi/client/src/power_hdf_client.cpp +++ /dev/null @@ -1,134 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "power_hdf_client.h" - -#include "iservmgr_hdi.h" -#include "power_common.h" - -namespace OHOS { -namespace PowerMgr { -namespace { -const std::string POWER_HDF_SERVICE = "power_hdf"; -} - -using OHOS::HDI::ServiceManager::V1_0::IServiceManager; - -ErrCode PowerHdfClient::RegisterCallback(const sptr& callback) -{ - POWER_HILOGW(MODULE_SERVICE, "PowerHdfClient::RegisterCallback: fun is start"); - MessageParcel data; - MessageParcel reply; - data.WriteRemoteObject(callback); - return Dispatch(CMD_REGISTER_CALLBCK, data, reply); -} - -ErrCode PowerHdfClient::StartSuspend() -{ - POWER_HILOGW(MODULE_SERVICE, "PowerHdfClient::StartSuspend: fun is start"); - MessageParcel data; - MessageParcel reply; - return Dispatch(CMD_START_SUSPEND, data, reply); -} - -ErrCode PowerHdfClient::StopSuspend() -{ - POWER_HILOGW(MODULE_SERVICE, "PowerHdfClient::StopSuspend: fun is start"); - MessageParcel data; - MessageParcel reply; - return Dispatch(CMD_STOP_SUSPEND, data, reply); -} - -ErrCode PowerHdfClient::ForceSuspend() -{ - POWER_HILOGW(MODULE_SERVICE, "PowerHdfClient::ForceSuspend: fun is start"); - MessageParcel data; - MessageParcel reply; - return Dispatch(CMD_FORCE_SUSPEND, data, reply); -} - -ErrCode PowerHdfClient::SuspendBlock(const std::string& name) -{ - POWER_HILOGW(MODULE_SERVICE, "PowerHdfClient::SuspendBlock: fun is start"); - MessageParcel data; - MessageParcel reply; - data.WriteString(name); - return Dispatch(CMD_SUSPEND_BLOCK, data, reply); -} - -ErrCode PowerHdfClient::SuspendUnblock(const std::string& name) -{ - POWER_HILOGW(MODULE_SERVICE, "PowerHdfClient::SuspendUnblock: fun is start"); - MessageParcel data; - MessageParcel reply; - data.WriteString(name); - return Dispatch(CMD_SUSPEND_UNBLOCK, data, reply); -} - -sptr PowerHdfClient::GetService() -{ - POWER_HILOGW(MODULE_SERVICE, "PowerHdfClient::GetService: fun is start"); - auto serviceManager = IServiceManager::Get(); - if (serviceManager == nullptr) { - POWER_HILOGW(MODULE_SERVICE, "service manager is nullptr"); - return nullptr; - } - auto service = serviceManager->GetService(POWER_HDF_SERVICE.c_str()); - if (service == nullptr) { - POWER_HILOGW(MODULE_SERVICE, "power_hdf service is nullptr"); - return nullptr; - } - return service; -} - -ErrCode PowerHdfClient::Dump(std::string& info) -{ - POWER_HILOGW(MODULE_SERVICE, "PowerHdfClient::Dump: fun is start"); - MessageParcel data; - MessageParcel reply; - ErrCode ret = Dispatch(CMD_DUMP, data, reply); - if (ret != ERR_OK) { - return ret; - } - info = reply.ReadString(); - return ERR_OK; -} - -ErrCode PowerHdfClient::Dispatch(uint32_t cmd, MessageParcel &data, MessageParcel &reply) -{ - POWER_HILOGD(MODULE_SERVICE, "Start to dispatch cmd: %{public}d", cmd); - auto service = GetService(); - POWER_HILOGD(MODULE_SERVICE, "PowerHdfClient::Dispatch: GetService"); - if (service == nullptr) { - POWER_HILOGD(MODULE_SERVICE, "PowerHdfClient::Dispatch: service nullptr)"); - return ERR_NO_INIT; - } - POWER_HILOGD(MODULE_SERVICE, "PowerHdfClient::Dispatch: service not nullptr)"); - - MessageOption option; - POWER_HILOGD(MODULE_SERVICE, "PowerHdfClient::Dispatch: option)"); - auto ret = service->SendRequest(cmd, data, reply, option); - POWER_HILOGD(MODULE_SERVICE, "PowerHdfClient::Dispatch: auto ret)"); - if (ret != ERR_OK) { - POWER_HILOGE(MODULE_SERVICE, "failed to send request, cmd: %{public}d, ret: %{public}d", cmd, ret); - return ret; - } else { - ret = reply.ReadInt32(); - } - - return ret; -} -} // namespace PowerMgr -} // namespace OHOS diff --git a/hdi/service/BUILD.gn b/hdi/service/BUILD.gn deleted file mode 100644 index a6eff7d3cce978789e885a579b996e130570b5aa..0000000000000000000000000000000000000000 --- a/hdi/service/BUILD.gn +++ /dev/null @@ -1,56 +0,0 @@ -# Copyright (c) 2021 Huawei Device Co., Ltd. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import("//base/powermgr/power_manager/powermgr.gni") -import("//build/ohos.gni") -import("//drivers/adapter/uhdf2/uhdf.gni") - -config("power_hdf_private_config") { - include_dirs = [ - "//drivers/ability/sbuf/include", - "//drivers/framework/include", - "//drivers/framework/include/core", - ] -} - -config("power_hdf_public_config") { - include_dirs = [ - "include", - "${powermgr_root_path}/hdi/api/include", - ] -} - -ohos_shared_library("power_hdf_service") { - sources = [ "src/power_hdf_service.cpp" ] - - configs = [ - "${powermgr_utils_path}:utils_config", - ":power_hdf_private_config", - ] - - public_configs = [ ":power_hdf_public_config" ] - - deps = [ - "${hdf_uhdf_path}/host:libhdf_host", - "${hdf_uhdf_path}/ipc:libhdf_ipc_adapter", - "${hdf_uhdf_path}/utils:libhdf_utils", - "//utils/native/base:utils", - ] - - external_deps = [ - "hiviewdfx_hilog_native:libhilog", - "ipc:ipc_core", - ] - - part_name = "power_manager_native" -} diff --git a/hdi/service/include/power_hdf_service.h b/hdi/service/include/power_hdf_service.h deleted file mode 100644 index 51c0fe1e63f9145358cbcc72f9f903f506d60c42..0000000000000000000000000000000000000000 --- a/hdi/service/include/power_hdf_service.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef POWER_HDF_SERVICE_H -#define POWER_HDF_SERVICE_H - -#include -#include -#include -#include -#include "errors.h" -#include "hdf_device_desc.h" -#include "hdf_remote_service.h" -#include "ipower_hdf_callback.h" -#include "unique_fd.h" - -namespace OHOS { -namespace PowerMgr { -class PowerHdfService { -public: - PowerHdfService() = default; - ~PowerHdfService() = default; - static int32_t Bind(struct HdfDeviceObject *device); - static int32_t Init(struct HdfDeviceObject *device); - static void Release(struct HdfDeviceObject *device); - - static int32_t Dispatch(struct HdfDeviceIoClient *client, - int cmdId, struct HdfSBuf *data, struct HdfSBuf *reply); - static int32_t RegisterCallback(struct HdfSBuf *data); - static int32_t StartSuspend(struct HdfSBuf *data); - static int32_t StopSuspend(struct HdfSBuf *data); - static int32_t ForceSuspend(struct HdfSBuf *data); - static int32_t SuspendBlock(struct HdfSBuf *data); - static int32_t SuspendUnblock(struct HdfSBuf *data); - static int32_t Dump(struct HdfSBuf *data); - - struct IDeviceIoService ioService; - struct HdfDeviceObject *device; -private: - static constexpr const char * const SUSPEND_STATE = "mem"; - static constexpr const char * const SUSPEND_STATE_PATH = "/sys/power/state"; - static constexpr const char * const LOCK_PATH = "/sys/power/wake_lock"; - static constexpr const char * const UNLOCK_PATH = "/sys/power/wake_unlock"; - static constexpr const char * const WAKEUP_COUNT_PATH = "/sys/power/wakeup_count"; - static std::chrono::milliseconds waitTime_; // {100ms}; - static std::mutex mutex_; - static std::unique_ptr daemon_; - static bool suspending_; - static struct HdfRemoteService *callback_; - static UniqueFd wakeupCountFd; - static void AutoSuspendLoop(); - static int32_t DoSuspend(); - static std::string ReadWakeCount(); - static bool WriteWakeCount(const std::string& count); - static void NotifyCallback(int code); -}; -} // namespace PowerMgr -} // namespace OHOS - -#endif // POWER_HDF_SERVICE_H \ No newline at end of file diff --git a/hdi/service/src/power_hdf_service.cpp b/hdi/service/src/power_hdf_service.cpp deleted file mode 100644 index 1106f2d08207ff9a0ce3d58a7879b3e1be842b9f..0000000000000000000000000000000000000000 --- a/hdi/service/src/power_hdf_service.cpp +++ /dev/null @@ -1,359 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "power_hdf_service.h" - -#include -#include -#include "errors.h" -#include "hdf_sbuf.h" -#include "power_hdf_info.h" -#include "pubdef.h" -#include "utils/hdf_log.h" - -namespace OHOS { -namespace PowerMgr { -std::mutex PowerHdfService::mutex_; -std::unique_ptr PowerHdfService::daemon_; -std::chrono::milliseconds PowerHdfService::waitTime_ = std::chrono::milliseconds(100); -bool PowerHdfService::suspending_ = false; -struct HdfRemoteService* PowerHdfService::callback_ = nullptr; -UniqueFd PowerHdfService::wakeupCountFd = UniqueFd(-1); - -int32_t PowerHdfService::Bind(struct HdfDeviceObject *device) -{ - HDF_LOGD("%{public}s enter", __func__); - if (device == NULL) { - HDF_LOGE("%{public}s device is NULL", __func__); - return HDF_ERR_INVALID_OBJECT; - } - PowerHdfService* service = new PowerHdfService(); - service->device = device; - service->ioService.Open = nullptr; - service->ioService.Dispatch = PowerHdfService::Dispatch; - service->ioService.Release = nullptr; - - device->service = &(service->ioService); - device->priv = reinterpret_cast(service); - - return HDF_SUCCESS; -} - -int32_t PowerHdfService::Init(struct HdfDeviceObject *device) -{ - HDF_LOGD("%{public}s enter", __func__); - if (device == NULL) { - HDF_LOGE("%{public}s device is NULL", __func__); - return HDF_ERR_INVALID_OBJECT; - } - - PowerHdfService* service = reinterpret_cast(device->priv); - if (service == NULL) { - return HDF_ERR_INVALID_OBJECT; - } - - return HDF_SUCCESS; -} - -void PowerHdfService::Release(struct HdfDeviceObject *device) -{ - HDF_LOGD("%{public}s enter", __func__); - if (device == NULL) { - return; - } - PowerHdfService* service = reinterpret_cast(device->priv); - if (service == NULL) { - return; - } - delete service; -} - -int32_t PowerHdfService::Dispatch(struct HdfDeviceIoClient *client, - int cmdId, struct HdfSBuf *data, struct HdfSBuf *reply) -{ - HDF_LOGD("%{public}s enter", __func__); - if (client == NULL || client->device == NULL) { - HDF_LOGE("%{public}s: client or client->device is NULL", __func__); - return HDF_ERR_INVALID_PARAM; - } - int ret = HDF_ERR_NOT_SUPPORT; - switch (cmdId) { - case CMD_REGISTER_CALLBCK: { - ret = PowerHdfService::RegisterCallback(data); - break; - } - case CMD_START_SUSPEND: { - ret = PowerHdfService::StartSuspend(data); - break; - } - case CMD_STOP_SUSPEND: { - ret = PowerHdfService::StopSuspend(data); - break; - } - case CMD_SUSPEND_BLOCK: { - ret = PowerHdfService::SuspendBlock(data); - break; - } - case CMD_SUSPEND_UNBLOCK: { - ret = PowerHdfService::SuspendUnblock(data); - break; - } - case CMD_DUMP: { - ret = PowerHdfService::Dump(reply); - break; - } - default: - break; - } - if (ret == HDF_SUCCESS) { - HdfSbufWriteInt32(reply, ERR_OK); - } else if (ret == HDF_FAILURE) { - HdfSbufWriteInt32(reply, ERR_INVALID_OPERATION); - } - return ret; -} - -int32_t PowerHdfService::RegisterCallback(struct HdfSBuf *data) -{ - HDF_LOGD("%{public}s enter", __func__); - std::lock_guard lock(mutex_); - struct HdfRemoteService *remoteService = HdfSBufReadRemoteService(data); - callback_ = remoteService; - return HDF_SUCCESS; -} - -int32_t PowerHdfService::StartSuspend(struct HdfSBuf *data) -{ - HDF_LOGD("%{public}s enter", __func__); - std::lock_guard lock(mutex_); - if (suspending_) { - return HDF_SUCCESS; - } - suspending_ = true; - daemon_ = std::make_unique(&AutoSuspendLoop); - daemon_->detach(); - return HDF_SUCCESS; -} - -void PowerHdfService::AutoSuspendLoop() -{ - HDF_LOGD("%{public}s enter", __func__); - while (suspending_) { - std::this_thread::sleep_for(waitTime_); - - const std::string wakeupCount = ReadWakeCount(); - if (wakeupCount.empty()) { - HDF_LOGD("Can't read wake count, continue"); - continue; - } - if (!WriteWakeCount(wakeupCount)) { - HDF_LOGD("Can't write wake count, continue"); - continue; - } - NotifyCallback(CMD_ON_SUSPEND); - bool success = DoSuspend(); - if (!success) { - HDF_LOGE("Do suspend failed!"); - } - NotifyCallback(CMD_ON_WAKEUP); - break; - } - suspending_ = false; -} - -int32_t PowerHdfService::DoSuspend() -{ - HDF_LOGD("%{public}s enter", __func__); - std::lock_guard lock(mutex_); - UniqueFd suspendStateFd(TEMP_FAILURE_RETRY(open(SUSPEND_STATE_PATH, O_RDWR | O_CLOEXEC))); - if (suspendStateFd < 0) { - HDF_LOGD("Failed to open the suspending state fd!"); - return HDF_FAILURE; - } - bool ret = SaveStringToFd(suspendStateFd, SUSPEND_STATE); - if (!ret) { - HDF_LOGE("Failed to write the suspend state!"); - return HDF_FAILURE; - } - return HDF_SUCCESS; -} - -void PowerHdfService::NotifyCallback(int code) -{ - HDF_LOGI("%{public}s enter", __func__); - if (callback_ == nullptr) { - HDF_LOGD("%{public}s: subscriber is nullptr", __func__); - return; - } - - struct HdfSBuf *data = HdfSBufTypedObtain(SBUF_IPC); - struct HdfSBuf *reply = HdfSBufTypedObtain(SBUF_IPC); - if (data == nullptr || reply == nullptr) { - HDF_LOGE("%{public}s: failed to obtain hdf sbuf", __func__); - return; - } - - int ret = callback_->dispatcher->Dispatch(callback_, code, data, reply); - if (ret != HDF_SUCCESS) { - HDF_LOGE("%{public}s: failed to notify subscriber, ret: %{public}d", __func__, ret); - } else { - HDF_LOGD("%{public}s: succeed to notify subscriber", __func__); - } - HdfSBufRecycle(data); - HdfSBufRecycle(reply); -} - -int32_t PowerHdfService::StopSuspend(struct HdfSBuf *data) -{ - HDF_LOGD("%{public}s enter", __func__); - if (suspending_) { - suspending_ = false; - daemon_->join(); - } - - return HDF_SUCCESS; -} - -int32_t PowerHdfService::ForceSuspend(struct HdfSBuf *data) -{ - HDF_LOGD("%{public}s enter", __func__); - if (suspending_) { - suspending_ = false; - daemon_->join(); - } - NotifyCallback(CMD_ON_SUSPEND); - bool success = DoSuspend(); - if (!success) { - HDF_LOGE("Do suspend failed!"); - } - NotifyCallback(CMD_ON_WAKEUP); - return HDF_SUCCESS; -} - -int32_t PowerHdfService::SuspendBlock(struct HdfSBuf *data) -{ - HDF_LOGD("%{public}s enter", __func__); - std::lock_guard lock(mutex_); - if (data == nullptr) { - return HDF_ERR_INVALID_PARAM; - } - const std::string name = HdfSbufReadString(data); - if (name.empty()) { - return HDF_ERR_INVALID_PARAM; - } - UniqueFd fd(TEMP_FAILURE_RETRY(open(LOCK_PATH, O_RDWR | O_CLOEXEC))); - bool ret = SaveStringToFd(fd, name); - if (!ret) { - HDF_LOGE("Failed to write the lock to kernel!"); - return HDF_FAILURE; - } - return HDF_SUCCESS; -} - -int32_t PowerHdfService::SuspendUnblock(struct HdfSBuf *data) -{ - HDF_LOGD("%{public}s enter", __func__); - std::lock_guard lock(mutex_); - if (data == nullptr) { - return HDF_ERR_INVALID_PARAM; - } - const std::string name = HdfSbufReadString(data); - if (name.empty()) { - return HDF_ERR_INVALID_PARAM; - } - UniqueFd fd(TEMP_FAILURE_RETRY(open(UNLOCK_PATH, O_RDWR | O_CLOEXEC))); - bool ret = SaveStringToFd(fd, name); - if (!ret) { - HDF_LOGE("Failed to write the lock to kernel!"); - return HDF_FAILURE; - } - return HDF_SUCCESS; -} - -std::string PowerHdfService::ReadWakeCount() -{ - if (wakeupCountFd < 0) { - wakeupCountFd = UniqueFd(TEMP_FAILURE_RETRY(open(WAKEUP_COUNT_PATH, O_RDWR | O_CLOEXEC))); - } - std::string wakeupCount; - bool ret = LoadStringFromFd(wakeupCountFd, wakeupCount); - if (!ret) { - HDF_LOGE("Read wakeup count failed!"); - return std::string(); - } - return wakeupCount; -} - -bool PowerHdfService::WriteWakeCount(const std::string& count) -{ - if (wakeupCountFd < 0) { - wakeupCountFd = UniqueFd(TEMP_FAILURE_RETRY(open(WAKEUP_COUNT_PATH, O_RDWR | O_CLOEXEC))); - } - bool ret = SaveStringToFd(wakeupCountFd, count.c_str()); - if (!ret) { - HDF_LOGE("Failed to write the wakeup count!"); - } - return ret; -} - -static void LoadSystemInfo(const std::string& path, std::string& info) -{ - UniqueFd fd(TEMP_FAILURE_RETRY(open(path.c_str(), O_RDWR | O_CLOEXEC))); - std::string str; - if (fd >= 0) { - bool ret = LoadStringFromFd(fd, str); - if (!ret) { - str = "# Failed to read"; - } - } else { - str = "# Failed to open"; - } - info.append(path); - info.append(": " + str + "\n"); -} - -int32_t PowerHdfService::Dump(struct HdfSBuf *reply) -{ - HDF_LOGD("%{public}s enter", __func__); - std::string dumpInfo(""); - LoadSystemInfo(SUSPEND_STATE_PATH, dumpInfo); - LoadSystemInfo(WAKEUP_COUNT_PATH, dumpInfo); - LoadSystemInfo(LOCK_PATH, dumpInfo); - LoadSystemInfo(UNLOCK_PATH, dumpInfo); - - HdfSbufWriteString(reply, dumpInfo.c_str()); - return HDF_SUCCESS; -} - -struct HdfDriverEntry g_powerHdfEntry = { - .moduleVersion = 1, - .moduleName = "power_hdf", - .Bind = PowerHdfService::Bind, - .Init = PowerHdfService::Init, - .Release = PowerHdfService::Release, -}; -} // namespace PowerMgr -} // namespace OHOS - -#ifndef __cplusplus -extern "C" { -#endif - -HDF_INIT(OHOS::PowerMgr::g_powerHdfEntry); - -#ifndef __cplusplus -} -#endif - diff --git a/interfaces/innerkits/BUILD.gn b/interfaces/innerkits/BUILD.gn old mode 100644 new mode 100755 diff --git a/interfaces/innerkits/native/include/ipower_mgr.h b/interfaces/innerkits/native/include/ipower_mgr.h old mode 100644 new mode 100755 diff --git a/interfaces/innerkits/native/include/ipower_mode_callback.h b/interfaces/innerkits/native/include/ipower_mode_callback.h old mode 100644 new mode 100755 diff --git a/interfaces/innerkits/native/include/ipower_state_callback.h b/interfaces/innerkits/native/include/ipower_state_callback.h old mode 100644 new mode 100755 diff --git a/interfaces/innerkits/native/include/ishutdown_callback.h b/interfaces/innerkits/native/include/ishutdown_callback.h old mode 100644 new mode 100755 diff --git a/interfaces/innerkits/native/include/power_mgr_client.h b/interfaces/innerkits/native/include/power_mgr_client.h old mode 100644 new mode 100755 diff --git a/interfaces/innerkits/native/include/power_state_machine_info.h b/interfaces/innerkits/native/include/power_state_machine_info.h old mode 100644 new mode 100755 diff --git a/interfaces/innerkits/native/include/running_lock.h b/interfaces/innerkits/native/include/running_lock.h old mode 100644 new mode 100755 diff --git a/interfaces/innerkits/native/include/running_lock_info.h b/interfaces/innerkits/native/include/running_lock_info.h old mode 100644 new mode 100755 diff --git a/interfaces/innerkits/native/include/running_lock_token_stub.h b/interfaces/innerkits/native/include/running_lock_token_stub.h old mode 100644 new mode 100755 diff --git a/interfaces/innerkits/native/include/work_trigger.h b/interfaces/innerkits/native/include/work_trigger.h old mode 100644 new mode 100755 diff --git a/interfaces/kits/js/@ohos.power.d.ts b/interfaces/kits/js/@ohos.power.d.ts old mode 100644 new mode 100755 diff --git a/interfaces/kits/js/@ohos.runninglock.d.ts b/interfaces/kits/js/@ohos.runninglock.d.ts old mode 100644 new mode 100755 diff --git a/ohos.build b/ohos.build old mode 100644 new mode 100755 index 20502dcc8c0f2eda221232eb7d540d5439d4e4db..79e589adb25a859ad9eaa3b374e17d9aa02c3dc3 --- a/ohos.build +++ b/ohos.build @@ -8,7 +8,6 @@ "//base/powermgr/power_manager/frameworks/napi/runninglock:runninglock", "//base/powermgr/power_manager/sa_profile:powermgr_sa_profile", "//base/powermgr/power_manager/services:powermgrservice", - "//base/powermgr/power_manager/hdi:hdi_group", "//base/powermgr/power_manager/services:power_service", "//base/powermgr/power_manager/utils:power-shell" ], diff --git a/powermgr.gni b/powermgr.gni old mode 100644 new mode 100755 index 6064d0282e382d72bd08fdf0bb317488ef98fc32..5236f4e3e3e9414dec3c212a8ab8b788244b9150 --- a/powermgr.gni +++ b/powermgr.gni @@ -21,8 +21,6 @@ powermgr_service_path = "${powermgr_root_path}/services" powermgr_framework_path = "${powermgr_root_path}/frameworks" -powermgr_hdi_path = "${powermgr_root_path}/hdi" - powermgr_interfaces_path = "${powermgr_root_path}/interfaces" powermgr_native_innerkits_path = "${powermgr_interfaces_path}/innerkits" diff --git a/sa_profile/3301.xml b/sa_profile/3301.xml old mode 100644 new mode 100755 diff --git a/sa_profile/BUILD.gn b/sa_profile/BUILD.gn old mode 100644 new mode 100755 diff --git a/services/BUILD.gn b/services/BUILD.gn old mode 100644 new mode 100755 index 5c6bfdb2af0ca2a227415753e2327e40d6b63458..004f515772b02aac3238f3360a3b5ae86cf3d98e --- a/services/BUILD.gn +++ b/services/BUILD.gn @@ -18,6 +18,7 @@ config("powermgr_private_config") { "//utils/system/safwk/native/include", "//base/sensors/sensor/interfaces/native/include", "//foundation/multimodalinput/input/interfaces/native/innerkits/proxy/include", + "//drivers/peripheral/power/interfaces/hdi_service/include", ] } @@ -61,6 +62,10 @@ ohos_shared_library("powermgrservice") { "${powermgr_utils_path}:powermgr_utils", "native/src/actions:powermgr_actions", "//drivers/peripheral/display/hal:hdi_display_device", + # "//drivers/peripheral/power/interfaces:power_entry", + "//drivers/peripheral/power/interfaces/hdi_callback:libpower_callback", + "//drivers/peripheral/power/interfaces/hdi/power/v1_0:libpower_proxy_1.0", + "//drivers/peripheral/power/interfaces/hdi_service:libpower_interface_service_1.0", "//utils/native/base:utils", ] diff --git a/services/native/include/actions/idevice_power_action.h b/services/native/include/actions/idevice_power_action.h old mode 100644 new mode 100755 diff --git a/services/native/include/actions/idevice_state_action.h b/services/native/include/actions/idevice_state_action.h old mode 100644 new mode 100755 index 8faf522c56e5b68503c06256cbe72eb0be2882fe..3024e9135d68928af8a93e64bf2777a1cf38c8cf --- a/services/native/include/actions/idevice_state_action.h +++ b/services/native/include/actions/idevice_state_action.h @@ -38,7 +38,8 @@ public: const std::string& pkgName) = 0; virtual void RefreshActivity(int64_t callTimeMs, UserActivityType type, uint32_t flags) = 0; virtual DisplayState GetDisplayState() = 0; - virtual uint32_t SetDisplayState(DisplayState state) = 0; + virtual uint32_t SetDisplayState(DisplayState state, + StateChangeReason reason = StateChangeReason::STATE_CHANGE_REASON_UNKNOWN) = 0; virtual uint32_t GoToSleep(const std::function onSuspend, const std::function onWakeup, bool force) = 0; }; diff --git a/services/native/include/actions/irunning_lock_action.h b/services/native/include/actions/irunning_lock_action.h old mode 100644 new mode 100755 diff --git a/services/native/include/power_mgr_dumper.h b/services/native/include/power_mgr_dumper.h old mode 100644 new mode 100755 diff --git a/services/native/include/power_mgr_monitor.h b/services/native/include/power_mgr_monitor.h old mode 100644 new mode 100755 diff --git a/services/native/include/power_mgr_notify.h b/services/native/include/power_mgr_notify.h old mode 100644 new mode 100755 diff --git a/services/native/include/power_mgr_service.h b/services/native/include/power_mgr_service.h old mode 100644 new mode 100755 index b665b2e4b8de997deeb86bb1106718d12b06a555..84d38cf1494b16314d574d3da28efc7e5fff96a0 --- a/services/native/include/power_mgr_service.h +++ b/services/native/include/power_mgr_service.h @@ -78,6 +78,8 @@ public: virtual void SetDeviceMode(const uint32_t& mode) override; virtual uint32_t GetDeviceMode() override; + void HandleKeyEvent(int32_t keyCode); + void HandlePointEvent(); std::shared_ptr GetHandler() const { return handler_; @@ -137,8 +139,6 @@ private: bool PowerStateMachineInit(); void KeyMonitorInit(); void HandlePowerKeyUp(); - void HandleKeyEvent(int32_t keyCode); - void HandlePointEvent(); void NotifyRunningLockChanged(bool isUnLock); void FillUserIPCInfo(UserIPCInfo &userIPCinfo); bool ready_ {false}; diff --git a/services/native/include/power_mode_module.h b/services/native/include/power_mode_module.h old mode 100644 new mode 100755 diff --git a/services/native/include/power_mode_policy.h b/services/native/include/power_mode_policy.h old mode 100644 new mode 100755 diff --git a/services/native/include/power_save_mode.h b/services/native/include/power_save_mode.h old mode 100644 new mode 100755 diff --git a/services/native/include/power_state_machine.h b/services/native/include/power_state_machine.h old mode 100644 new mode 100755 index 0dda9103acab1972d1f517531cfbea3d1fa2b09f..d38cf8e19de1543d5f76817f902d18f68d737d52 --- a/services/native/include/power_state_machine.h +++ b/services/native/include/power_state_machine.h @@ -123,7 +123,7 @@ private: class StateController { public: StateController(PowerState state, std::shared_ptr owner, - std::function action) + std::function action) : state_(state), owner_(owner), action_(action) {} ~StateController() = default; PowerState GetState() @@ -137,7 +137,7 @@ private: bool CheckState(); PowerState state_; std::weak_ptr owner_; - std::function action_; + std::function action_; }; struct classcomp { diff --git a/services/native/include/powerms_event_handler.h b/services/native/include/powerms_event_handler.h old mode 100644 new mode 100755 diff --git a/services/native/include/running_lock_inner.h b/services/native/include/running_lock_inner.h old mode 100644 new mode 100755 diff --git a/services/native/include/running_lock_mgr.h b/services/native/include/running_lock_mgr.h old mode 100644 new mode 100755 diff --git a/services/native/include/shutdown_service.h b/services/native/include/shutdown_service.h old mode 100644 new mode 100755 diff --git a/services/native/profile/BUILD.gn b/services/native/profile/BUILD.gn old mode 100644 new mode 100755 diff --git a/services/native/profile/power_mode_config.xml b/services/native/profile/power_mode_config.xml old mode 100644 new mode 100755 diff --git a/services/native/src/actions/BUILD.gn b/services/native/src/actions/BUILD.gn old mode 100644 new mode 100755 diff --git a/services/native/src/actions/actions.gni b/services/native/src/actions/actions.gni old mode 100644 new mode 100755 diff --git a/services/native/src/actions/default/BUILD.gn b/services/native/src/actions/default/BUILD.gn old mode 100644 new mode 100755 index fa5fe42cf317d861188fd944a14049f71f0d6121..4300832822aae6742470e0d7ba7524f1ee325760 --- a/services/native/src/actions/default/BUILD.gn +++ b/services/native/src/actions/default/BUILD.gn @@ -17,8 +17,9 @@ import("../actions.gni") config("powermgr_actions_impl_public_config") { include_dirs = [ ".", - "${powermgr_hdi_path}/api/include", "//base/startup/syspara_lite/adapter/native/syspara/include", + "//drivers/peripheral/power/interfaces/include/", + "//drivers/peripheral/power/interfaces" ] } @@ -35,8 +36,11 @@ ohos_source_set("${powermgr_actions_default_target}") { public_configs = [ ":powermgr_actions_impl_public_config" ] deps = [ - "${powermgr_hdi_path}/client:power_hdf_client", + "//drivers/peripheral/power/interfaces/hdi/power/v1_0:libpower_proxy_1.0", + "//drivers/peripheral/power/interfaces/hdi_callback:libpower_callback", "../:powermgr_actions_common", + "//foundation/windowmanager/utils:libwmutil", + "//foundation/windowmanager/wm:libwm", "//utils/native/base:utils", ] diff --git a/services/native/src/actions/default/device_power_action.cpp b/services/native/src/actions/default/device_power_action.cpp old mode 100644 new mode 100755 diff --git a/services/native/src/actions/default/device_power_action.h b/services/native/src/actions/default/device_power_action.h old mode 100644 new mode 100755 diff --git a/services/native/src/actions/default/device_state_action.cpp b/services/native/src/actions/default/device_state_action.cpp old mode 100644 new mode 100755 index d68564924e62cf335ce5a5c2f2b0eaaf0d8045c8..9c81aef236b4ab5010c34bac2f2e5626af73a9dc --- a/services/native/src/actions/default/device_state_action.cpp +++ b/services/native/src/actions/default/device_state_action.cpp @@ -15,20 +15,36 @@ #include "device_state_action.h" +#include "display_manager.h" #include "display_power_mgr_client.h" #include "system_suspend_controller.h" #include "power_state_machine_info.h" +#include "hilog_wrapper.h" using namespace std; namespace OHOS { namespace PowerMgr { using namespace DisplayPowerMgr; +using namespace Rosen; + +DeviceStateAction::DeviceStateAction() +{ + dispCallback_ = new DisplayPowerCallback(); + DisplayPowerMgrClient::GetInstance().RegisterCallback(dispCallback_); +} + +DeviceStateAction::~DeviceStateAction() +{ + DisplayPowerMgrClient::GetInstance().RegisterCallback(nullptr); + dispCallback_ = nullptr; +} void DeviceStateAction::Suspend(int64_t callTimeMs, SuspendDeviceType type, uint32_t flags) { // Display is controlled by PowerStateMachine // Don't suspend until GoToSleep is called + DisplayManager::GetInstance().SuspendBegin(PowerStateChangeReason::POWER_BUTTON); } void DeviceStateAction::ForceSuspend() @@ -39,6 +55,7 @@ void DeviceStateAction::ForceSuspend() void DeviceStateAction::Wakeup(int64_t callTimeMs, WakeupDeviceType type, const string& details, const string& pkgName) { + DisplayManager::GetInstance().WakeUpBegin(PowerStateChangeReason::POWER_BUTTON); SystemSuspendController::GetInstance().Wakeup(); } @@ -65,7 +82,7 @@ DisplayState DeviceStateAction::GetDisplayState() return ret; } -uint32_t DeviceStateAction::SetDisplayState(const DisplayState state) +uint32_t DeviceStateAction::SetDisplayState(const DisplayState state, StateChangeReason reason) { DisplayPowerMgr::DisplayState dispState = DisplayPowerMgr::DisplayState::DISPLAY_ON; switch (state) { @@ -85,7 +102,7 @@ uint32_t DeviceStateAction::SetDisplayState(const DisplayState state) break; } - bool ret = DisplayPowerMgrClient::GetInstance().SetDisplayState(dispState); + bool ret = DisplayPowerMgrClient::GetInstance().SetDisplayState(dispState, reason); return ret ? ActionResult::SUCCESS : ActionResult::FAILED; } @@ -95,5 +112,27 @@ uint32_t DeviceStateAction::GoToSleep(const std::function onSuspend, SystemSuspendController::GetInstance().Suspend(onSuspend, onWakeup, force); return ActionResult::SUCCESS; } + +void DeviceStateAction::DisplayPowerCallback::OnDisplayStateChanged(uint32_t displayId, + DisplayPowerMgr::DisplayState state) +{ + int32_t mainDisp = DisplayPowerMgrClient::GetInstance().GetMainDisplayId(); + if (mainDisp < 0 || static_cast(mainDisp) != displayId) { + POWER_HILOGI(MODULE_SERVICE, "It's not main display, skip!"); + return; + } + switch (state) + { + case DisplayPowerMgr::DisplayState::DISPLAY_ON: + DisplayManager::GetInstance().WakeUpEnd(); + break; + case DisplayPowerMgr::DisplayState::DISPLAY_OFF: + DisplayManager::GetInstance().SuspendEnd(); + break; + default: + break; + } + return; +} } // namespace PowerMgr } // namespace OHOS diff --git a/services/native/src/actions/default/device_state_action.h b/services/native/src/actions/default/device_state_action.h old mode 100644 new mode 100755 index 458d9a72992eddb9b33c032e42b5da92b94e0910..c2129e5fa288e0a77bc8ac8591f86f662b6c17f6 --- a/services/native/src/actions/default/device_state_action.h +++ b/services/native/src/actions/default/device_state_action.h @@ -17,11 +17,14 @@ #define POWERMGR_DEVICE_STATE_ACTION_H #include "actions/idevice_state_action.h" +#include "display_power_callback_stub.h" namespace OHOS { namespace PowerMgr { class DeviceStateAction : public IDeviceStateAction { public: + DeviceStateAction(); + ~DeviceStateAction(); void Suspend(int64_t callTimeMs, SuspendDeviceType type, uint32_t flags) override; void ForceSuspend() override; void Wakeup(int64_t callTimeMs, WakeupDeviceType type, const std::string& details, @@ -29,8 +32,16 @@ public: void RefreshActivity(const int64_t callTimeMs, UserActivityType type, const uint32_t flags) override {} DisplayState GetDisplayState() override; - uint32_t SetDisplayState(const DisplayState state) override; + uint32_t SetDisplayState(const DisplayState state, + StateChangeReason reason = StateChangeReason::STATE_CHANGE_REASON_UNKNOWN) override; uint32_t GoToSleep(std::function onSuspend, std::function onWakeup, bool force) override; + +private: + class DisplayPowerCallback : public DisplayPowerMgr::DisplayPowerCallbackStub { + public: + virtual void OnDisplayStateChanged(uint32_t displayId, DisplayPowerMgr::DisplayState state) override; + }; + sptr dispCallback_; }; } // namespace PowerMgr } // namespace OHOS diff --git a/services/native/src/actions/default/running_lock_action.cpp b/services/native/src/actions/default/running_lock_action.cpp old mode 100644 new mode 100755 diff --git a/services/native/src/actions/default/running_lock_action.h b/services/native/src/actions/default/running_lock_action.h old mode 100644 new mode 100755 diff --git a/services/native/src/actions/default/suspend/irunning_lock_hub.h b/services/native/src/actions/default/suspend/irunning_lock_hub.h old mode 100644 new mode 100755 diff --git a/services/native/src/actions/default/suspend/isuspend_controller.h b/services/native/src/actions/default/suspend/isuspend_controller.h old mode 100644 new mode 100755 diff --git a/services/native/src/actions/default/suspend/running_lock_hub.cpp b/services/native/src/actions/default/suspend/running_lock_hub.cpp old mode 100644 new mode 100755 diff --git a/services/native/src/actions/default/suspend/running_lock_hub.h b/services/native/src/actions/default/suspend/running_lock_hub.h old mode 100644 new mode 100755 diff --git a/services/native/src/actions/default/suspend/suspend_controller.cpp b/services/native/src/actions/default/suspend/suspend_controller.cpp old mode 100644 new mode 100755 diff --git a/services/native/src/actions/default/suspend/suspend_controller.h b/services/native/src/actions/default/suspend/suspend_controller.h old mode 100644 new mode 100755 diff --git a/services/native/src/actions/default/system_suspend_controller.cpp b/services/native/src/actions/default/system_suspend_controller.cpp old mode 100644 new mode 100755 index bf0f3c3f737712189aa816b040b1cfa2e5d7db1a..32ccc3b3af5939eb7ebba5d1fcef61d89432be21 --- a/services/native/src/actions/default/system_suspend_controller.cpp +++ b/services/native/src/actions/default/system_suspend_controller.cpp @@ -15,17 +15,22 @@ #include "system_suspend_controller.h" +#include "power_interface_proxy.h" + #include "suspend/running_lock_hub.h" #include "suspend/suspend_controller.h" +using namespace hdi::power::v1_0; + namespace OHOS { namespace PowerMgr { +sptr powerInterface = nullptr; SystemSuspendController::SystemSuspendController() { #ifndef POWER_SUSPEND_NO_HDI - callback_ = new PowerHdfCallback(); - client_ = std::make_unique(); - client_->RegisterCallback(callback_); + sptr g_callback = new PowerHdiCallbackService(); + powerInterface = IPowerInterface::Get(); + powerInterface->RegisterCallback(g_callback); #else sc_ = std::make_shared(); #endif @@ -38,9 +43,9 @@ void SystemSuspendController::Suspend(const std::function& onSuspend, { #ifndef POWER_SUSPEND_NO_HDI if (force) { - client_->ForceSuspend(); + powerInterface->ForceSuspend(); } else { - client_->StartSuspend(); + powerInterface->StartSuspend(); } #else sc_->Suspend(onSuspend, onWakeup, force); @@ -50,7 +55,7 @@ void SystemSuspendController::Suspend(const std::function& onSuspend, void SystemSuspendController::Wakeup() { #ifndef POWER_SUSPEND_NO_HDI - client_->StopSuspend(); + powerInterface->StopSuspend(); #else sc_->Wakeup(); #endif @@ -59,36 +64,38 @@ void SystemSuspendController::Wakeup() void SystemSuspendController::AcquireRunningLock(const std::string& name) { #ifndef POWER_SUSPEND_NO_HDI - client_->SuspendBlock(name); + powerInterface->SuspendBlock(name); #endif } void SystemSuspendController::ReleaseRunningLock(const std::string& name) { #ifndef POWER_SUSPEND_NO_HDI - client_->SuspendUnblock(name); + powerInterface->SuspendUnblock(name); #endif } void SystemSuspendController::Dump(std::string& info) { #ifndef POWER_SUSPEND_NO_HDI - client_->Dump(info); + powerInterface->PowerDump(info); #endif } -void SystemSuspendController::PowerHdfCallback::OnSuspend() +int32_t SystemSuspendController::PowerHdfCallback::OnSuspend() { if (onSuspend_ != nullptr) { onSuspend_(); } + return 0; } -void SystemSuspendController::PowerHdfCallback::OnWakeup() +int32_t SystemSuspendController::PowerHdfCallback::OnWakeup() { if (onWakeup_ != nullptr) { onWakeup_(); } + return 0; } void SystemSuspendController::PowerHdfCallback::SetListener( diff --git a/services/native/src/actions/default/system_suspend_controller.h b/services/native/src/actions/default/system_suspend_controller.h old mode 100644 new mode 100755 index 33a48a7204a82c5c1a55132cc903835b32b1421c..681ce483ad8d26e78ec7e1fc6a14dca768cb79e5 --- a/services/native/src/actions/default/system_suspend_controller.h +++ b/services/native/src/actions/default/system_suspend_controller.h @@ -21,8 +21,8 @@ #include -#include "power_hdf_client.h" #include "suspend/irunning_lock_hub.h" +#include "power_hdi_callback_service.h" #include "suspend/isuspend_controller.h" namespace OHOS { @@ -39,12 +39,12 @@ private: DECLARE_DELAYED_REF_SINGLETON(SystemSuspendController); inline static const std::string WAKEUP_HOLDER = "OHOSPowerMgr.WakeupHolder"; - class PowerHdfCallback : public IPowerHdfCallback { + class PowerHdfCallback : public hdi::power::v1_0::PowerHdiCallbackStub { public: PowerHdfCallback() = default; ~PowerHdfCallback() = default; - void OnSuspend() override; - void OnWakeup() override; + int32_t OnSuspend() override; + int32_t OnWakeup() override; void SetListener(std::function& suspend, std::function& wakeup); private: std::function onSuspend_; @@ -52,8 +52,6 @@ private: }; std::mutex mutex_; std::shared_ptr sc_; - std::unique_ptr client_; - sptr callback_; }; } // namespace PowerMgr } // namespace OHOS diff --git a/services/native/src/actions/irunning_lock_action.cpp b/services/native/src/actions/irunning_lock_action.cpp old mode 100644 new mode 100755 diff --git a/services/native/src/actions/standard/BUILD.gn b/services/native/src/actions/standard/BUILD.gn old mode 100644 new mode 100755 diff --git a/services/native/src/power_mgr_dumper.cpp b/services/native/src/power_mgr_dumper.cpp old mode 100644 new mode 100755 diff --git a/services/native/src/power_mgr_factory.cpp b/services/native/src/power_mgr_factory.cpp old mode 100644 new mode 100755 diff --git a/services/native/src/power_mgr_factory.h b/services/native/src/power_mgr_factory.h old mode 100644 new mode 100755 diff --git a/services/native/src/power_mgr_monitor.cpp b/services/native/src/power_mgr_monitor.cpp old mode 100644 new mode 100755 diff --git a/services/native/src/power_mgr_notify.cpp b/services/native/src/power_mgr_notify.cpp old mode 100644 new mode 100755 diff --git a/services/native/src/power_mgr_service.cpp b/services/native/src/power_mgr_service.cpp old mode 100644 new mode 100755 index 84037aef07118d641159a1f565296c7f148c44ab..e27d2ff5e28d3d1f5a0fa728aff49199a45e9509 --- a/services/native/src/power_mgr_service.cpp +++ b/services/native/src/power_mgr_service.cpp @@ -119,6 +119,38 @@ bool PowerMgrService::PowerStateMachineInit() return true; } +class InputCallback : public IInputEventConsumer { + virtual void OnInputEvent(std::shared_ptr keyEvent) const; + virtual void OnInputEvent(std::shared_ptr pointerEvent) const; + virtual void OnInputEvent(std::shared_ptr axisEvent) const; +}; + +void InputCallback::OnInputEvent(std::shared_ptr keyEvent) const +{ + POWER_HILOGE(MODULE_SERVICE, "OnInputEvent keyEvent"); + // Do noting. It's done by AddMonitor callback +} + +void InputCallback::OnInputEvent(std::shared_ptr pointerEvent) const +{ + POWER_HILOGE(MODULE_SERVICE, "OnInputEvent pointerEvent"); + auto pms = DelayedSpSingleton::GetInstance(); + if (pms == nullptr) { + return; + } + pms->HandlePointEvent(); +} + +void InputCallback::OnInputEvent(std::shared_ptr axisEvent) const +{ + POWER_HILOGE(MODULE_SERVICE, "OnInputEvent axisEvent"); + auto pms = DelayedSpSingleton::GetInstance(); + if (pms == nullptr) { + return; + } + pms->HandlePointEvent(); +} + void PowerMgrService::KeyMonitorInit() { std::shared_ptr keyOption = std::make_shared(); @@ -163,9 +195,8 @@ void PowerMgrService::KeyMonitorInit() this->HandleKeyEvent(event->GetKeyCode()); }); - InputManager::GetInstance()->AddMonitor([this](std::shared_ptr event) { - this->HandlePointEvent(); - }); + std::shared_ptr callback = std::make_shared(); + InputManager::GetInstance()->AddMonitor2(std::static_pointer_cast(callback)); } void PowerMgrService::HandlePowerKeyUp() diff --git a/services/native/src/power_mode_module.cpp b/services/native/src/power_mode_module.cpp old mode 100644 new mode 100755 diff --git a/services/native/src/power_mode_policy.cpp b/services/native/src/power_mode_policy.cpp old mode 100644 new mode 100755 diff --git a/services/native/src/power_save_mode.cpp b/services/native/src/power_save_mode.cpp old mode 100644 new mode 100755 diff --git a/services/native/src/power_state_machine.cpp b/services/native/src/power_state_machine.cpp old mode 100644 new mode 100755 index 152a307855df9f8d036f62268c0de2039233d61c..d45cf91c00430fcd239dbec5b0b5a073ac981502 --- a/services/native/src/power_state_machine.cpp +++ b/services/native/src/power_state_machine.cpp @@ -92,9 +92,10 @@ bool PowerStateMachine::Init() void PowerStateMachine::EmplaceAwake() { controllerMap_.emplace(PowerState::AWAKE, - std::make_shared(PowerState::AWAKE, shared_from_this(), [this] { + std::make_shared(PowerState::AWAKE, shared_from_this(), + [this](StateChangeReason reason) { mDeviceState_.screenState.lastOnTime = GetTickCount(); - uint32_t ret = this->stateAction_->SetDisplayState(DisplayState::DISPLAY_ON); + uint32_t ret = this->stateAction_->SetDisplayState(DisplayState::DISPLAY_ON, reason); if (ret != ActionResult::SUCCESS) { POWER_HILOGE(MODULE_SERVICE, "Failed to go to AWAKE, Display Err"); return TransitResult::HDI_ERR; @@ -107,7 +108,8 @@ void PowerStateMachine::EmplaceAwake() void PowerStateMachine::EmplaceInactive() { controllerMap_.emplace(PowerState::INACTIVE, - std::make_shared(PowerState::INACTIVE, shared_from_this(), [this] { + std::make_shared(PowerState::INACTIVE, shared_from_this(), + [this](StateChangeReason reason) { POWER_HILOGI(MODULE_SERVICE, "StateController_INACTIVE: func is Start."); mDeviceState_.screenState.lastOffTime = GetTickCount(); DisplayState state = DisplayState::DISPLAY_OFF; @@ -115,7 +117,7 @@ void PowerStateMachine::EmplaceInactive() POWER_HILOGI(MODULE_SERVICE, "display suspend enabled"); state = DisplayState::DISPLAY_SUSPEND; } - uint32_t ret = this->stateAction_->SetDisplayState(state); + uint32_t ret = this->stateAction_->SetDisplayState(state, reason); if (ret != ActionResult::SUCCESS) { POWER_HILOGE(MODULE_SERVICE, "Failed to go to INACTIVE, Display Err"); return TransitResult::HDI_ERR; @@ -128,13 +130,14 @@ void PowerStateMachine::EmplaceInactive() void PowerStateMachine::EmplaceSleep() { controllerMap_.emplace(PowerState::SLEEP, - std::make_shared(PowerState::SLEEP, shared_from_this(), [this] { + std::make_shared(PowerState::SLEEP, shared_from_this(), + [this](StateChangeReason reason) { DisplayState state = DisplayState::DISPLAY_OFF; if (enableDisplaySuspend_) { POWER_HILOGI(MODULE_SERVICE, "display suspend enabled"); state = DisplayState::DISPLAY_SUSPEND; } - uint32_t ret = this->stateAction_->SetDisplayState(state); + uint32_t ret = this->stateAction_->SetDisplayState(state, reason); if (ret != ActionResult::SUCCESS) { POWER_HILOGE(MODULE_SERVICE, "Failed to go to SLEEP, Display Err"); return TransitResult::HDI_ERR; @@ -248,7 +251,7 @@ void PowerStateMachine::RefreshActivityInner(pid_t pid, stateAction_->RefreshActivity(callTimeMs, type, needChangeBacklight ? REFRESH_ACTIVITY_NEED_CHANGE_LIGHTS : REFRESH_ACTIVITY_NO_CHANGE_LIGHTS); mDeviceState_.screenState.lastOnTime = GetTickCount(); - stateAction_->SetDisplayState(DisplayState::DISPLAY_ON); + stateAction_->SetDisplayState(DisplayState::DISPLAY_ON, GetReasonByUserActivity(type)); } // reset timer ResetInactiveTimer(); @@ -608,7 +611,8 @@ void PowerStateMachine::HandleActivityTimeout() return; } if (dispState == DisplayState::DISPLAY_ON) { - stateAction_->SetDisplayState(DisplayState::DISPLAY_DIM); + stateAction_->SetDisplayState(DisplayState::DISPLAY_DIM, + StateChangeReason::STATE_CHANGE_REASON_TIMEOUT); if (this->GetDisplayOffTime() < 0) { POWER_HILOGI(MODULE_SERVICE, "Display Auto OFF is disabled"); return; @@ -761,9 +765,11 @@ void PowerStateMachine::SetDisplaySuspend(bool enable) if (GetState() == PowerState::INACTIVE) { POWER_HILOGI(MODULE_SERVICE, "Change display state"); if (enable) { - stateAction_->SetDisplayState(DisplayState::DISPLAY_SUSPEND); + stateAction_->SetDisplayState(DisplayState::DISPLAY_SUSPEND, + StateChangeReason::STATE_CHANGE_REASON_APPLICATION); } else { - stateAction_->SetDisplayState(DisplayState::DISPLAY_OFF); + stateAction_->SetDisplayState(DisplayState::DISPLAY_OFF, + StateChangeReason::STATE_CHANGE_REASON_APPLICATION); } } } @@ -934,7 +940,7 @@ TransitResult PowerStateMachine::StateController::TransitTo( POWER_HILOGE(MODULE_SERVICE, "TransitTo: running lock block"); return TransitResult::LOCKING; } - ret = action_(); + ret = action_(reason); if (ret == TransitResult::SUCCESS) { lastReason_ = reason; lastTime_ = GetTickCount(); diff --git a/services/native/src/powerms_event_handler.cpp b/services/native/src/powerms_event_handler.cpp old mode 100644 new mode 100755 diff --git a/services/native/src/running_lock_inner.cpp b/services/native/src/running_lock_inner.cpp old mode 100644 new mode 100755 diff --git a/services/native/src/running_lock_mgr.cpp b/services/native/src/running_lock_mgr.cpp old mode 100644 new mode 100755 diff --git a/services/native/src/shutdown_service.cpp b/services/native/src/shutdown_service.cpp old mode 100644 new mode 100755 diff --git a/services/native/test/BUILD.gn b/services/native/test/BUILD.gn old mode 100644 new mode 100755 diff --git a/services/native/test/unittest/BUILD.gn b/services/native/test/unittest/BUILD.gn old mode 100644 new mode 100755 diff --git a/services/native/test/unittest/include/ces_system_test.h b/services/native/test/unittest/include/ces_system_test.h old mode 100644 new mode 100755 diff --git a/services/native/test/unittest/include/power_device_mode_test.h b/services/native/test/unittest/include/power_device_mode_test.h old mode 100644 new mode 100755 diff --git a/services/native/test/unittest/include/power_get_mode_test.h b/services/native/test/unittest/include/power_get_mode_test.h old mode 100644 new mode 100755 diff --git a/services/native/test/unittest/include/power_mgr_mock_test.h b/services/native/test/unittest/include/power_mgr_mock_test.h old mode 100644 new mode 100755 diff --git a/services/native/test/unittest/include/power_mgr_notify_test.h b/services/native/test/unittest/include/power_mgr_notify_test.h old mode 100644 new mode 100755 diff --git a/services/native/test/unittest/include/power_mgr_service_test.h b/services/native/test/unittest/include/power_mgr_service_test.h old mode 100644 new mode 100755 diff --git a/services/native/test/unittest/include/power_reboot_test.h b/services/native/test/unittest/include/power_reboot_test.h old mode 100644 new mode 100755 diff --git a/services/native/test/unittest/include/power_register_callback_mode_test.h b/services/native/test/unittest/include/power_register_callback_mode_test.h old mode 100644 new mode 100755 diff --git a/services/native/test/unittest/include/power_set_mode_test.h b/services/native/test/unittest/include/power_set_mode_test.h old mode 100644 new mode 100755 diff --git a/services/native/test/unittest/include/power_shutdown_callback_test.h b/services/native/test/unittest/include/power_shutdown_callback_test.h old mode 100644 new mode 100755 diff --git a/services/native/test/unittest/include/power_shutdown_test.h b/services/native/test/unittest/include/power_shutdown_test.h old mode 100644 new mode 100755 diff --git a/services/native/test/unittest/include/power_state_machine_test.h b/services/native/test/unittest/include/power_state_machine_test.h old mode 100644 new mode 100755 diff --git a/services/native/test/unittest/include/running_lock_test.h b/services/native/test/unittest/include/running_lock_test.h old mode 100644 new mode 100755 diff --git a/services/native/test/unittest/mock/mock_lock_action.h b/services/native/test/unittest/mock/mock_lock_action.h old mode 100644 new mode 100755 diff --git a/services/native/test/unittest/mock/mock_power_action.h b/services/native/test/unittest/mock/mock_power_action.h old mode 100644 new mode 100755 diff --git a/services/native/test/unittest/mock/mock_state_action.h b/services/native/test/unittest/mock/mock_state_action.h old mode 100644 new mode 100755 index a0040ed5b92102f6cf2b5b487170650a47103ec0..4fb9e84c860ab1f276fb844657a21edb4e95b65a --- a/services/native/test/unittest/mock/mock_state_action.h +++ b/services/native/test/unittest/mock/mock_state_action.h @@ -31,7 +31,7 @@ public: const std::string& details, const std::string& pkgName)); MOCK_METHOD3(RefreshActivity, void(int64_t callTimeMs, UserActivityType type, uint32_t flags)); MOCK_METHOD0(GetDisplayState, DisplayState()); - MOCK_METHOD1(SetDisplayState, uint32_t(DisplayState state)); + MOCK_METHOD2(SetDisplayState, uint32_t(DisplayState state, StateChangeReason reason)); MOCK_METHOD3(GoToSleep, uint32_t(std::function onSuspend, std::function onWakeup, bool force)); }; } // namespace PowerMgr diff --git a/services/native/test/unittest/src/ces_system_test.cpp b/services/native/test/unittest/src/ces_system_test.cpp old mode 100644 new mode 100755 diff --git a/services/native/test/unittest/src/power_device_mode_test.cpp b/services/native/test/unittest/src/power_device_mode_test.cpp old mode 100644 new mode 100755 diff --git a/services/native/test/unittest/src/power_get_mode_test.cpp b/services/native/test/unittest/src/power_get_mode_test.cpp old mode 100644 new mode 100755 diff --git a/services/native/test/unittest/src/power_mgr_mock_test.cpp b/services/native/test/unittest/src/power_mgr_mock_test.cpp old mode 100644 new mode 100755 index c8b4460964bbd7ee876304f085e7c67fc83d3409..fd3c7cf9d0e772b0a058029384ae626dbdde5d4c --- a/services/native/test/unittest/src/power_mgr_mock_test.cpp +++ b/services/native/test/unittest/src/power_mgr_mock_test.cpp @@ -129,7 +129,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest003, TestSize.Level2) } POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest003:Start mock."); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF, ::testing::_)) .Times(1) .WillOnce(::testing::Return(ActionResult::SUCCESS)); EXPECT_CALL(*g_stateAction, @@ -158,7 +158,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest004, TestSize.Level2) GTEST_LOG_(INFO) << "PowerMgrUnittest004: Failed to get PowerMgrService"; } - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF, ::testing::_)) .Times(1) .WillOnce(::testing::Return(ActionResult::SUCCESS)); EXPECT_CALL(*g_stateAction, @@ -186,7 +186,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest005, TestSize.Level2) GTEST_LOG_(INFO) << "PowerMgrUnittest005: Failed to get PowerMgrService"; } - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF, ::testing::_)) .Times(1) .WillOnce(::testing::Return(ActionResult::SUCCESS)); EXPECT_CALL(*g_stateAction, @@ -214,7 +214,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest006, TestSize.Level2) GTEST_LOG_(INFO) << "PowerMgrUnittest006: Failed to get PowerMgrService"; } - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF, ::testing::_)) .Times(1) .WillOnce(::testing::Return(ActionResult::SUCCESS)); EXPECT_CALL(*g_stateAction, @@ -242,7 +242,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest007, TestSize.Level2) GTEST_LOG_(INFO) << "PowerMgrUnittest007: Failed to get PowerMgrService"; } - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF, ::testing::_)) .Times(1) .WillOnce(::testing::Return(ActionResult::SUCCESS)); EXPECT_CALL(*g_stateAction, @@ -270,7 +270,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest008, TestSize.Level2) GTEST_LOG_(INFO) << "PowerMgrUnittest008: Failed to get PowerMgrService"; } - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF, ::testing::_)) .Times(1) .WillOnce(::testing::Return(ActionResult::SUCCESS)); EXPECT_CALL(*g_stateAction, @@ -298,7 +298,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest009, TestSize.Level2) GTEST_LOG_(INFO) << "PowerMgrUnittest009: Failed to get PowerMgrService"; } - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF, ::testing::_)) .Times(1) .WillOnce(::testing::Return(ActionResult::SUCCESS)); EXPECT_CALL(*g_stateAction, @@ -326,7 +326,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest010, TestSize.Level2) GTEST_LOG_(INFO) << "PowerMgrUnittest010: Failed to get PowerMgrService"; } - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF, ::testing::_)) .Times(1) .WillOnce(::testing::Return(ActionResult::SUCCESS)); EXPECT_CALL(*g_stateAction, @@ -354,7 +354,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest011, TestSize.Level2) GTEST_LOG_(INFO) << "PowerMgrUnittest011: Failed to get PowerMgrService"; } - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF, ::testing::_)) .Times(1) .WillOnce(::testing::Return(ActionResult::SUCCESS)); EXPECT_CALL(*g_stateAction, @@ -383,7 +383,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest012, TestSize.Level2) } pms->SuspendDevice(0, SuspendDeviceType::SUSPEND_DEVICE_REASON_APPLICATION, false); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_ON)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_ON, ::testing::_)) .Times(1) .WillOnce(::testing::Return(ActionResult::SUCCESS)); EXPECT_CALL(*g_stateAction, @@ -413,7 +413,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest013, TestSize.Level2) } pms->SuspendDevice(0, SuspendDeviceType::SUSPEND_DEVICE_REASON_APPLICATION, false); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_ON)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_ON, ::testing::_)) .Times(1) .WillOnce(::testing::Return(ActionResult::SUCCESS)); EXPECT_CALL(*g_stateAction, @@ -443,7 +443,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest014, TestSize.Level2) } pms->SuspendDevice(0, SuspendDeviceType::SUSPEND_DEVICE_REASON_APPLICATION, false); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_ON)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_ON, ::testing::_)) .Times(1) .WillOnce(::testing::Return(ActionResult::SUCCESS)); EXPECT_CALL(*g_stateAction, @@ -473,7 +473,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest015, TestSize.Level2) } pms->SuspendDevice(0, SuspendDeviceType::SUSPEND_DEVICE_REASON_APPLICATION, false); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_ON)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_ON, ::testing::_)) .Times(1) .WillOnce(::testing::Return(ActionResult::SUCCESS)); EXPECT_CALL(*g_stateAction, @@ -503,7 +503,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest016, TestSize.Level2) } pms->SuspendDevice(0, SuspendDeviceType::SUSPEND_DEVICE_REASON_APPLICATION, false); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_ON)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_ON, ::testing::_)) .Times(1) .WillOnce(::testing::Return(ActionResult::SUCCESS)); EXPECT_CALL(*g_stateAction, @@ -533,7 +533,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest017, TestSize.Level2) } pms->SuspendDevice(0, SuspendDeviceType::SUSPEND_DEVICE_REASON_APPLICATION, false); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_ON)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_ON, ::testing::_)) .Times(1) .WillOnce(::testing::Return(ActionResult::SUCCESS)); EXPECT_CALL(*g_stateAction, @@ -563,7 +563,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest018, TestSize.Level2) } pms->SuspendDevice(0, SuspendDeviceType::SUSPEND_DEVICE_REASON_APPLICATION, false); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_ON)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_ON, ::testing::_)) .Times(1) .WillOnce(::testing::Return(ActionResult::SUCCESS)); EXPECT_CALL(*g_stateAction, @@ -593,7 +593,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest019, TestSize.Level2) } pms->SuspendDevice(0, SuspendDeviceType::SUSPEND_DEVICE_REASON_APPLICATION, false); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_ON)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_ON, ::testing::_)) .Times(1) .WillOnce(::testing::Return(ActionResult::SUCCESS)); EXPECT_CALL(*g_stateAction, @@ -623,7 +623,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest020, TestSize.Level2) } pms->SuspendDevice(0, SuspendDeviceType::SUSPEND_DEVICE_REASON_APPLICATION, false); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_ON)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_ON, ::testing::_)) .Times(1) .WillOnce(::testing::Return(ActionResult::SUCCESS)); EXPECT_CALL(*g_stateAction, @@ -653,7 +653,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest021, TestSize.Level2) } pms->SuspendDevice(0, SuspendDeviceType::SUSPEND_DEVICE_REASON_APPLICATION, false); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_ON)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_ON, ::testing::_)) .Times(1) .WillOnce(::testing::Return(ActionResult::SUCCESS)); EXPECT_CALL(*g_stateAction, @@ -683,7 +683,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest022, TestSize.Level2) } pms->WakeupDevice(0, WakeupDeviceType::WAKEUP_DEVICE_UNKNOWN, std::string("test")); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF, ::testing::_)) .Times(::testing::AtLeast(1)) .WillOnce(::testing::Return(ActionResult::SUCCESS)); EXPECT_CALL(*g_stateAction, @@ -755,7 +755,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest024, TestSize.Level2) EXPECT_CALL(*g_stateAction, GetDisplayState()) .Times(::testing::AtLeast(1)) .WillOnce(::testing::Return(DisplayState::DISPLAY_DIM)); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_ON)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_ON, ::testing::_)) .Times(1) .WillOnce(::testing::Return(ActionResult::SUCCESS)); EXPECT_CALL(*g_stateAction, @@ -920,7 +920,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest030, TestSize.Level2) pms->Lock(token, info, 0); EXPECT_EQ(pms->IsUsed(token), true); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_DIM)).Times(0); + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_DIM, ::testing::_)).Times(0); sleep(SCREEN_DIM_WAIT_TIME_S + 1); pms->UnLock(token); @@ -984,7 +984,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest032, TestSize.Level2) GTEST_LOG_(INFO) << "PowerMgrUnittest032: Failed to get PowerMgrService"; } - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_DIM)).Times(0); + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_DIM, ::testing::_)).Times(0); sptr token = new RunningLockTokenStub(); RunningLockInfo info("test1", RunningLockType::RUNNINGLOCK_PROXIMITY_SCREEN_CONTROL); pms->CreateRunningLock(token, info); @@ -993,7 +993,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest032, TestSize.Level2) pms->Lock(token, info, 0); EXPECT_EQ(pms->IsUsed(token), true); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_DIM)).Times(0); + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_DIM, ::testing::_)).Times(0); sleep(SCREEN_DIM_WAIT_TIME_S + 1); EXPECT_CALL(*g_lockAction, Unlock(_, _)).Times(1); @@ -1054,7 +1054,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest034, TestSize.Level2) EXPECT_CALL(*g_stateAction, GetDisplayState()) .Times(::testing::AtLeast(1)) .WillOnce(::testing::Return(DisplayState::DISPLAY_DIM)); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_ON)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_ON, ::testing::_)) .Times(1) .WillOnce(::testing::Return(ActionResult::SUCCESS)); EXPECT_CALL(*g_stateAction, @@ -1086,7 +1086,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest035, TestSize.Level2) EXPECT_CALL(*g_stateAction, GetDisplayState()) .Times(::testing::AtLeast(1)) .WillOnce(::testing::Return(DisplayState::DISPLAY_DIM)); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_ON)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_ON, ::testing::_)) .Times(1) .WillOnce(::testing::Return(ActionResult::SUCCESS)); EXPECT_CALL(*g_stateAction, @@ -1118,7 +1118,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest036, TestSize.Level2) EXPECT_CALL(*g_stateAction, GetDisplayState()) .Times(::testing::AtLeast(1)) .WillOnce(::testing::Return(DisplayState::DISPLAY_DIM)); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_ON)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_ON, ::testing::_)) .Times(1) .WillOnce(::testing::Return(ActionResult::SUCCESS)); EXPECT_CALL(*g_stateAction, @@ -1150,7 +1150,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest037, TestSize.Level2) EXPECT_CALL(*g_stateAction, GetDisplayState()) .Times(::testing::AtLeast(1)) .WillOnce(::testing::Return(DisplayState::DISPLAY_DIM)); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_ON)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_ON, ::testing::_)) .Times(1) .WillOnce(::testing::Return(ActionResult::SUCCESS)); EXPECT_CALL(*g_stateAction, @@ -1182,7 +1182,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest038, TestSize.Level2) EXPECT_CALL(*g_stateAction, GetDisplayState()) .Times(::testing::AtLeast(1)) .WillOnce(::testing::Return(DisplayState::DISPLAY_DIM)); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_ON)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_ON, ::testing::_)) .Times(1) .WillOnce(::testing::Return(ActionResult::SUCCESS)); EXPECT_CALL(*g_stateAction, @@ -1252,7 +1252,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest040, TestSize.Level2) .WillByDefault(::testing::Return(DisplayState::DISPLAY_DIM)); EXPECT_CALL(*g_stateAction, RefreshActivity(0, _, _)).Times(0); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF, ::testing::_)) .Times(::testing::AtLeast(1)) .WillOnce(::testing::Return(ActionResult::SUCCESS)); pms->RefreshActivity(0, abnormaltype, true); @@ -1281,7 +1281,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest041, TestSize.Level2) } pms->SuspendDevice(0, SuspendDeviceType::SUSPEND_DEVICE_REASON_APPLICATION, false); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_ON)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_ON, ::testing::_)) .Times(0); EXPECT_CALL(*g_stateAction, Wakeup(0, _, @@ -1312,7 +1312,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest042, TestSize.Level2) } pms->SuspendDevice(0, SuspendDeviceType::SUSPEND_DEVICE_REASON_APPLICATION, false); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_ON)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_ON, ::testing::_)) .Times(0); EXPECT_CALL(*g_stateAction, Wakeup(0, _, @@ -1347,7 +1347,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest043, TestSize.Level2) sleep((SCREEN_OFF_WAIT_TIME_S*2/3) + 1); ON_CALL(*g_stateAction, GetDisplayState()) .WillByDefault(::testing::Return(DisplayState::DISPLAY_DIM)); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF, ::testing::_)) .Times(::testing::AtLeast(1)) .WillOnce(::testing::Return(ActionResult::SUCCESS)); sleep((SCREEN_OFF_WAIT_TIME_S*1/3) + 1); @@ -1375,7 +1375,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest044, TestSize.Level2) } pms->WakeupDevice(0, WakeupDeviceType::WAKEUP_DEVICE_UNKNOWN, std::string("test")); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_DIM)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_DIM, ::testing::_)) .Times(::testing::AtLeast(1)) .WillOnce(::testing::Return(ActionResult::SUCCESS)); ON_CALL(*g_stateAction, GetDisplayState()) @@ -1412,7 +1412,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest045, TestSize.Level2) sleep((SCREEN_OFF_WAIT_TIME_S*2/3) + 1); ON_CALL(*g_stateAction, GetDisplayState()) .WillByDefault(::testing::Return(DisplayState::DISPLAY_DIM)); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF, ::testing::_)) .Times(::testing::AtLeast(1)) .WillOnce(::testing::Return(ActionResult::SUCCESS)); sleep((SCREEN_OFF_WAIT_TIME_S*2/3) /2); @@ -1503,7 +1503,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest048, TestSize.Level2) } pms->WakeupDevice(0, WakeupDeviceType::WAKEUP_DEVICE_POWER_BUTTON, std::string("test")); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF, ::testing::_)) .Times(::testing::AtLeast(1)) .WillOnce(::testing::Return(ActionResult::SUCCESS)); EXPECT_CALL(*g_stateAction, @@ -1541,7 +1541,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest049, TestSize.Level2) pms->WakeupDevice(0, WakeupDeviceType::WAKEUP_DEVICE_POWER_BUTTON, std::string("test")); EXPECT_CALL(*g_stateAction, Suspend(0, _, false)).Times(0); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF)).Times(0); + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF, ::testing::_)).Times(0); pms->SuspendDevice(0, abnormaltype, false); EXPECT_EQ(PowerState::AWAKE, pms->GetState()); @@ -1570,7 +1570,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest050, TestSize.Level2) pms->WakeupDevice(0, WakeupDeviceType::WAKEUP_DEVICE_POWER_BUTTON, std::string("test")); EXPECT_CALL(*g_stateAction, Suspend(0, _, false)).Times(0); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF)).Times(0); + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF, ::testing::_)).Times(0); pms->SuspendDevice(0, abnormaltype, false); EXPECT_EQ(PowerState::AWAKE, pms->GetState()); @@ -1596,7 +1596,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest051, TestSize.Level2) } pms->SuspendDevice(0, SuspendDeviceType::SUSPEND_DEVICE_REASON_APPLICATION, false); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF, ::testing::_)) .Times(1) .WillOnce(::testing::Return(ActionResult::SUCCESS)); EXPECT_CALL(*g_stateAction, @@ -1718,13 +1718,13 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest055, TestSize.Level2) pms->WakeupDevice(0, WakeupDeviceType::WAKEUP_DEVICE_LID, std::string("test")); ON_CALL(*g_stateAction, GetDisplayState()) .WillByDefault(::testing::Return(DisplayState::DISPLAY_ON)); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_DIM)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_DIM, ::testing::_)) .Times(1) .WillOnce(::testing::Return(ActionResult::SUCCESS)); sleep((SCREEN_OFF_WAIT_TIME_S*2/3) + 1); ON_CALL(*g_stateAction, GetDisplayState()) .WillByDefault(::testing::Return(DisplayState::DISPLAY_DIM)); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF, ::testing::_)) .Times(1) .WillOnce(::testing::Return(ActionResult::SUCCESS)); sleep((SCREEN_OFF_WAIT_TIME_S*1/3) + 1); @@ -1750,7 +1750,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest056, TestSize.Level2) GTEST_LOG_(INFO) << "PowerMgrUnittest056: Failed to get PowerMgrService"; } - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_DIM)).Times(0); + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_DIM, ::testing::_)).Times(0); sptr token = new RunningLockTokenStub(); RunningLockInfo info("test1", RunningLockType::RUNNINGLOCK_SCREEN); pms->CreateRunningLock(token, info); @@ -1758,7 +1758,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest056, TestSize.Level2) pms->Lock(token, info, 0); EXPECT_EQ(pms->IsUsed(token), true); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_DIM)).Times(0); + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_DIM, ::testing::_)).Times(0); sleep((SCREEN_OFF_WAIT_TIME_S*2/3) + 1); ON_CALL(*g_stateAction, GetDisplayState()) .WillByDefault(::testing::Return(DisplayState::DISPLAY_ON)); @@ -1791,7 +1791,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest057, TestSize.Level2) sptr token = new RunningLockTokenStub(); RunningLockInfo info("test1", RunningLockType::RUNNINGLOCK_SCREEN); pms->CreateRunningLock(token, info); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_ON)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_ON, ::testing::_)) .Times(1) .WillOnce(::testing::Return(ActionResult::SUCCESS)); pms->Lock(token, info, 0); @@ -1822,10 +1822,10 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest058, TestSize.Level2) } ON_CALL(*g_stateAction, GetDisplayState()) .WillByDefault(::testing::Return(DisplayState::DISPLAY_ON)); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_DIM)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_DIM, ::testing::_)) .Times(1) .WillOnce(::testing::Return(ActionResult::SUCCESS)); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF, ::testing::_)) .Times(1) .WillOnce(::testing::Return(ActionResult::SUCCESS)); pms->SetDisplayOffTime(time); @@ -1860,7 +1860,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest059, TestSize.Level2) pms->Lock(token, info, 0); EXPECT_EQ(pms->IsUsed(token), true); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_DIM)).Times(0); + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_DIM, ::testing::_)).Times(0); sleep(SCREEN_DIM_WAIT_TIME_S + 1); pms->UnLock(token); @@ -1893,10 +1893,10 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest060, TestSize.Level2) pms->Lock(token, info, 0); EXPECT_EQ(pms->IsUsed(token), true); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF)).Times(0); + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF, ::testing::_)).Times(0); sleep(SLEEP_WAIT_TIME_S*10); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF)).Times(0); + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF, ::testing::_)).Times(0); EXPECT_EQ(PowerState::AWAKE, pms->GetState()); @@ -1929,7 +1929,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest061, TestSize.Level2) pms->Lock(token, info, 0); EXPECT_EQ(pms->IsUsed(token), true); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_DIM)).Times(0); + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_DIM, ::testing::_)).Times(0); sleep(SCREEN_OFF_WAIT_TIME_S + 1); pms->UnLock(token); @@ -1966,7 +1966,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest062, TestSize.Level2) pms->Lock(token, info, 0); EXPECT_EQ(pms->IsUsed(token), true); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF, ::testing::_)) .Times(::testing::AtLeast(1)) .WillOnce(::testing::Return(ActionResult::SUCCESS)); @@ -2169,7 +2169,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest067, TestSize.Level2) ON_CALL(*g_stateAction, GetDisplayState()) .WillByDefault(::testing::Return(DisplayState::DISPLAY_DIM)); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF, ::testing::_)) .Times(1) .WillOnce(::testing::Return(ActionResult::SUCCESS)); sleep((SCREEN_OFF_WAIT_TIME_S*1/3) + 1); @@ -2210,7 +2210,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest068, TestSize.Level2) ON_CALL(*g_stateAction, GetDisplayState()) .WillByDefault(::testing::Return(DisplayState::DISPLAY_DIM)); pms->CreateRunningLock(token, info); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF, ::testing::_)) .Times(1) .WillOnce(::testing::Return(ActionResult::SUCCESS)); EXPECT_CALL(*g_stateAction, GoToSleep(_, _, _)).Times(0); @@ -2261,12 +2261,12 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest069, TestSize.Level2) pms->Lock(token, info, 0); EXPECT_EQ(pms->IsUsed(token), true); sleep(SLEEP_WAIT_TIME_S + 1); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_ON)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_ON, ::testing::_)) .Times(1) .WillOnce(::testing::Return(ActionResult::SUCCESS)); pms->WakeupDevice(0, WakeupDeviceType::WAKEUP_DEVICE_UNKNOWN, std::string("test")); sleep(SLEEP_WAIT_TIME_S + 1); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF)).Times(0); + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF, ::testing::_)).Times(0); EXPECT_CALL(*g_lockAction, Unlock(_, _)).Times(1); pms->UnLock(token); EXPECT_EQ(pms->IsUsed(token), false); @@ -2335,12 +2335,12 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest071, TestSize.Level2) sptr token = new RunningLockTokenStub(); RunningLockInfo info("test1", RunningLockType::RUNNINGLOCK_PROXIMITY_SCREEN_CONTROL); pms->CreateRunningLock(token, info); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF, ::testing::_)) .Times(::testing::AtLeast(1)) .WillOnce(::testing::Return(ActionResult::SUCCESS)); pms->SuspendDevice(0, SuspendDeviceType::SUSPEND_DEVICE_REASON_APPLICATION, false); EXPECT_EQ(PowerState::INACTIVE, pms->GetState()); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_ON)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_ON, ::testing::_)) .Times(1) .WillOnce(::testing::Return(ActionResult::SUCCESS)); sleep(SCREEN_OFF_WAIT_TIME_S + 1); @@ -2379,7 +2379,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest072, TestSize.Level2) .Times(1) .WillOnce(::testing::Return(ActionResult::SUCCESS)); EXPECT_EQ(pms->ForceSuspendDevice(0), true); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_ON)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_ON, ::testing::_)) .Times(1) .WillOnce(::testing::Return(ActionResult::SUCCESS)); sleep(SCREEN_OFF_WAIT_TIME_S + 1); @@ -2424,7 +2424,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest073, TestSize.Level2) sleep((SCREEN_OFF_WAIT_TIME_S*2/3) + 1); ON_CALL(*g_stateAction, GetDisplayState()) .WillByDefault(::testing::Return(DisplayState::DISPLAY_DIM)); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF, ::testing::_)) .Times(::testing::AtLeast(1)) .WillOnce(::testing::Return(ActionResult::SUCCESS)); sleep((SCREEN_OFF_WAIT_TIME_S*1/3) + 1); @@ -2466,7 +2466,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest074, TestSize.Level2) EXPECT_EQ(pms->IsUsed(token), true); sleep(SCREEN_OFF_WAIT_TIME_S+1); EXPECT_EQ(PowerState::AWAKE, pms->GetState()); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF, ::testing::_)) .Times(1) .WillOnce(::testing::Return(ActionResult::SUCCESS)); EXPECT_CALL(*g_stateAction, GoToSleep(_, _, _)).Times(0); @@ -2501,7 +2501,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest075, TestSize.Level2) sleep(SLEEP_WAIT_TIME_S*10); EXPECT_EQ(PowerState::AWAKE, pms->GetState()); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF, ::testing::_)) .Times(1) .WillOnce(::testing::Return(ActionResult::SUCCESS)); EXPECT_CALL(*g_stateAction, GoToSleep(_, _, _)).Times(0); @@ -2543,7 +2543,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest076, TestSize.Level2) } pms->Lock(token, info, 0); EXPECT_EQ(pms->IsUsed(token), true); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF, ::testing::_)) .Times(1) .WillOnce(::testing::Return(ActionResult::SUCCESS)); EXPECT_CALL(*g_stateAction, GoToSleep(_, _, _)).Times(0); @@ -2577,7 +2577,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest077, TestSize.Level2) EXPECT_CALL(*g_lockAction, Lock(_, _)).Times(1); pms->Lock(token, info, 0); EXPECT_EQ(pms->IsUsed(token), true); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF, ::testing::_)) .Times(::testing::AtLeast(1)) .WillOnce(::testing::Return(ActionResult::SUCCESS)); EXPECT_CALL(*g_stateAction, GoToSleep(_, _, false)) @@ -2690,7 +2690,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest080, TestSize.Level2) sleep(((time/1000)*2/3)+1); ON_CALL(*g_stateAction, GetDisplayState()) .WillByDefault(::testing::Return(DisplayState::DISPLAY_DIM)); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF, ::testing::_)) .Times(::testing::AtLeast(1)) .WillOnce(::testing::Return(ActionResult::SUCCESS)); sleep(time/1000*1/3+1); @@ -2730,7 +2730,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest081, TestSize.Level2) sleep(((time/1000)*2/3)+1); ON_CALL(*g_stateAction, GetDisplayState()) .WillByDefault(::testing::Return(DisplayState::DISPLAY_DIM)); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF, ::testing::_)) .Times(::testing::AtLeast(1)) .WillOnce(::testing::Return(ActionResult::SUCCESS)); sleep(((time/1000)*1/3)+1); @@ -2769,7 +2769,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest082, TestSize.Level2) sleep(((time/1000)*2/3)+1); ON_CALL(*g_stateAction, GetDisplayState()) .WillByDefault(::testing::Return(DisplayState::DISPLAY_DIM)); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF, ::testing::_)) .Times(::testing::AtLeast(1)) .WillOnce(::testing::Return(ActionResult::SUCCESS)); sleep(time/1000*1/3+1); @@ -2807,7 +2807,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest083, TestSize.Level2) sleep(((time/1000)*2/3)+1); ON_CALL(*g_stateAction, GetDisplayState()) .WillByDefault(::testing::Return(DisplayState::DISPLAY_DIM)); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF, ::testing::_)) .Times(::testing::AtLeast(1)) .WillOnce(::testing::Return(ActionResult::SUCCESS)); sleep(time/1000*1/3+1); @@ -2845,7 +2845,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest084, TestSize.Level2) sleep(((time/1000)*2/3)+1); ON_CALL(*g_stateAction, GetDisplayState()) .WillByDefault(::testing::Return(DisplayState::DISPLAY_DIM)); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF, ::testing::_)) .Times(::testing::AtLeast(1)) .WillOnce(::testing::Return(ActionResult::SUCCESS)); sleep(time/1000*1/3+1); @@ -2883,7 +2883,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest085, TestSize.Level2) sleep(((time/1000)*2/3)+1); ON_CALL(*g_stateAction, GetDisplayState()) .WillByDefault(::testing::Return(DisplayState::DISPLAY_DIM)); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF, ::testing::_)) .Times(::testing::AtLeast(1)) .WillOnce(::testing::Return(ActionResult::SUCCESS)); sleep(time/1000*1/3+1); @@ -2920,10 +2920,10 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest086, TestSize.Level2) POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest086:DeviceStateAction::SetDisplayState."); ON_CALL(*g_stateAction, GetDisplayState()) .WillByDefault(::testing::Return(DisplayState::DISPLAY_ON)); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_DIM)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_DIM, ::testing::_)) .Times(1) .WillOnce(::testing::Return(ActionResult::SUCCESS)); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF, ::testing::_)) .Times(1) .WillOnce(::testing::Return(ActionResult::SUCCESS)); POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest086:Start sleep."); @@ -2957,10 +2957,10 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest087, TestSize.Level2) } ON_CALL(*g_stateAction, GetDisplayState()) .WillByDefault(::testing::Return(DisplayState::DISPLAY_ON)); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_DIM)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_DIM, ::testing::_)) .Times(1) .WillOnce(::testing::Return(ActionResult::SUCCESS)); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF, ::testing::_)) .Times(1) .WillOnce(::testing::Return(ActionResult::SUCCESS)); pms->SetDisplayOffTime(time); @@ -2992,10 +2992,10 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest088, TestSize.Level2) } ON_CALL(*g_stateAction, GetDisplayState()) .WillByDefault(::testing::Return(DisplayState::DISPLAY_ON)); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_DIM)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_DIM, ::testing::_)) .Times(1) .WillOnce(::testing::Return(ActionResult::SUCCESS)); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF, ::testing::_)) .Times(1) .WillOnce(::testing::Return(ActionResult::SUCCESS)); pms->SetDisplayOffTime(time); @@ -3026,10 +3026,10 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest089, TestSize.Level2) } ON_CALL(*g_stateAction, GetDisplayState()) .WillByDefault(::testing::Return(DisplayState::DISPLAY_ON)); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_DIM)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_DIM, ::testing::_)) .Times(1) .WillOnce(::testing::Return(ActionResult::SUCCESS)); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF, ::testing::_)) .Times(1) .WillOnce(::testing::Return(ActionResult::SUCCESS)); pms->SetDisplayOffTime(time); @@ -3060,10 +3060,10 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest090, TestSize.Level2) } ON_CALL(*g_stateAction, GetDisplayState()) .WillByDefault(::testing::Return(DisplayState::DISPLAY_ON)); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_DIM)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_DIM, ::testing::_)) .Times(1) .WillOnce(::testing::Return(ActionResult::SUCCESS)); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF, ::testing::_)) .Times(1) .WillOnce(::testing::Return(ActionResult::SUCCESS)); pms->SetDisplayOffTime(time); @@ -3106,7 +3106,7 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest091, TestSize.Level2) sleep((SCREEN_OFF_WAIT_TIME_S*2/3)+1); ON_CALL(*g_stateAction, GetDisplayState()) .WillByDefault(::testing::Return(DisplayState::DISPLAY_DIM)); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF, ::testing::_)) .Times(::testing::AtLeast(1)) .WillOnce(::testing::Return(ActionResult::SUCCESS)); sleep((SCREEN_OFF_WAIT_TIME_S*1/3) + 1); @@ -3116,4 +3116,4 @@ HWTEST_F (PowerMgrMockTest, PowerMgrUnittest091, TestSize.Level2) POWER_HILOGD(MODULE_SERVICE, "PowerMgrUnittest091:End."); GTEST_LOG_(INFO) << "PowerMgrUnittest091: end."; } -} \ No newline at end of file +} diff --git a/services/native/test/unittest/src/power_mgr_notify_test.cpp b/services/native/test/unittest/src/power_mgr_notify_test.cpp old mode 100644 new mode 100755 diff --git a/services/native/test/unittest/src/power_mgr_service_test.cpp b/services/native/test/unittest/src/power_mgr_service_test.cpp old mode 100644 new mode 100755 diff --git a/services/native/test/unittest/src/power_register_callback_mode_test.cpp b/services/native/test/unittest/src/power_register_callback_mode_test.cpp old mode 100644 new mode 100755 diff --git a/services/native/test/unittest/src/power_set_mode_test.cpp b/services/native/test/unittest/src/power_set_mode_test.cpp old mode 100644 new mode 100755 diff --git a/services/native/test/unittest/src/power_shutdown_callback_test.cpp b/services/native/test/unittest/src/power_shutdown_callback_test.cpp old mode 100644 new mode 100755 diff --git a/services/native/test/unittest/src/power_shutdown_test.cpp b/services/native/test/unittest/src/power_shutdown_test.cpp old mode 100644 new mode 100755 diff --git a/services/native/test/unittest/src/power_state_machine_test.cpp b/services/native/test/unittest/src/power_state_machine_test.cpp old mode 100644 new mode 100755 diff --git a/services/native/test/unittest/src/reboot_test.cpp b/services/native/test/unittest/src/reboot_test.cpp old mode 100644 new mode 100755 diff --git a/services/native/test/unittest/src/running_lock_test.cpp b/services/native/test/unittest/src/running_lock_test.cpp old mode 100644 new mode 100755 diff --git a/services/native/test/unittest/src/shutdown_test.cpp b/services/native/test/unittest/src/shutdown_test.cpp old mode 100644 new mode 100755 diff --git a/services/zidl/include/power_mgr_proxy.h b/services/zidl/include/power_mgr_proxy.h old mode 100644 new mode 100755 diff --git a/services/zidl/include/power_mgr_stub.h b/services/zidl/include/power_mgr_stub.h old mode 100644 new mode 100755 diff --git a/services/zidl/include/power_mode_callback_proxy.h b/services/zidl/include/power_mode_callback_proxy.h old mode 100644 new mode 100755 diff --git a/services/zidl/include/power_mode_callback_stub.h b/services/zidl/include/power_mode_callback_stub.h old mode 100644 new mode 100755 diff --git a/services/zidl/include/power_shutdown_callback_proxy.h b/services/zidl/include/power_shutdown_callback_proxy.h old mode 100644 new mode 100755 diff --git a/services/zidl/include/power_shutdown_callback_stub.h b/services/zidl/include/power_shutdown_callback_stub.h old mode 100644 new mode 100755 diff --git a/services/zidl/include/power_state_callback_proxy.h b/services/zidl/include/power_state_callback_proxy.h old mode 100644 new mode 100755 diff --git a/services/zidl/include/power_state_callback_stub.h b/services/zidl/include/power_state_callback_stub.h old mode 100644 new mode 100755 diff --git a/services/zidl/src/power_mgr_proxy.cpp b/services/zidl/src/power_mgr_proxy.cpp old mode 100644 new mode 100755 diff --git a/services/zidl/src/power_mgr_stub.cpp b/services/zidl/src/power_mgr_stub.cpp old mode 100644 new mode 100755 diff --git a/services/zidl/src/power_mode_callback_proxy.cpp b/services/zidl/src/power_mode_callback_proxy.cpp old mode 100644 new mode 100755 diff --git a/services/zidl/src/power_mode_callback_stub.cpp b/services/zidl/src/power_mode_callback_stub.cpp old mode 100644 new mode 100755 diff --git a/services/zidl/src/power_shutdown_callback_proxy.cpp b/services/zidl/src/power_shutdown_callback_proxy.cpp old mode 100644 new mode 100755 diff --git a/services/zidl/src/power_shutdown_callback_stub.cpp b/services/zidl/src/power_shutdown_callback_stub.cpp old mode 100644 new mode 100755 diff --git a/services/zidl/src/power_state_callback_proxy.cpp b/services/zidl/src/power_state_callback_proxy.cpp old mode 100644 new mode 100755 diff --git a/services/zidl/src/power_state_callback_stub.cpp b/services/zidl/src/power_state_callback_stub.cpp old mode 100644 new mode 100755 diff --git a/test/BUILD.gn b/test/BUILD.gn old mode 100644 new mode 100755 diff --git a/test/systemtest/BUILD.gn b/test/systemtest/BUILD.gn old mode 100644 new mode 100755 diff --git a/test/systemtest/include/power_mgr_mock_system_test.h b/test/systemtest/include/power_mgr_mock_system_test.h old mode 100644 new mode 100755 diff --git a/test/systemtest/include/power_mgr_powersavemode_test.h b/test/systemtest/include/power_mgr_powersavemode_test.h old mode 100644 new mode 100755 diff --git a/test/systemtest/include/power_mgr_st_mock_test.h b/test/systemtest/include/power_mgr_st_mock_test.h old mode 100644 new mode 100755 diff --git a/test/systemtest/mock/mock_lock_action.h b/test/systemtest/mock/mock_lock_action.h old mode 100644 new mode 100755 diff --git a/test/systemtest/mock/mock_power_action.h b/test/systemtest/mock/mock_power_action.h old mode 100644 new mode 100755 diff --git a/test/systemtest/mock/mock_state_action.h b/test/systemtest/mock/mock_state_action.h old mode 100644 new mode 100755 index a0040ed5b92102f6cf2b5b487170650a47103ec0..4fb9e84c860ab1f276fb844657a21edb4e95b65a --- a/test/systemtest/mock/mock_state_action.h +++ b/test/systemtest/mock/mock_state_action.h @@ -31,7 +31,7 @@ public: const std::string& details, const std::string& pkgName)); MOCK_METHOD3(RefreshActivity, void(int64_t callTimeMs, UserActivityType type, uint32_t flags)); MOCK_METHOD0(GetDisplayState, DisplayState()); - MOCK_METHOD1(SetDisplayState, uint32_t(DisplayState state)); + MOCK_METHOD2(SetDisplayState, uint32_t(DisplayState state, StateChangeReason reason)); MOCK_METHOD3(GoToSleep, uint32_t(std::function onSuspend, std::function onWakeup, bool force)); }; } // namespace PowerMgr diff --git a/test/systemtest/src/power_mgr_mock_system_test.cpp b/test/systemtest/src/power_mgr_mock_system_test.cpp old mode 100644 new mode 100755 index 00b30e395a53de570913e7643e8fc65fefea484f..d620b48b4d49f59c28739d1d7b9963bf8ca976b9 --- a/test/systemtest/src/power_mgr_mock_system_test.cpp +++ b/test/systemtest/src/power_mgr_mock_system_test.cpp @@ -78,7 +78,7 @@ HWTEST_F (PowerMgrMockSystemTest, PowerMgrMock102, TestSize.Level2) } POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock102:Start mock."); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_SUSPEND)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_SUSPEND, testing::_)) .Times(1) .WillOnce(::testing::Return(ActionResult::SUCCESS)); EXPECT_CALL(*g_stateAction, @@ -109,7 +109,7 @@ HWTEST_F (PowerMgrMockSystemTest, PowerMgrMock103, TestSize.Level2) } pms->WakeupDevice(0, WakeupDeviceType::WAKEUP_DEVICE_UNKNOWN, std::string("test")); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_SUSPEND)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_SUSPEND, testing::_)) .Times(::testing::AtLeast(1)) .WillOnce(::testing::Return(ActionResult::SUCCESS)); EXPECT_CALL(*g_stateAction, @@ -146,7 +146,7 @@ HWTEST_F (PowerMgrMockSystemTest, PowerMgrMock104, TestSize.Level2) sleep((SCREEN_OFF_WAIT_TIME_S*2/3) + 1); ON_CALL(*g_stateAction, GetDisplayState()) .WillByDefault(::testing::Return(DisplayState::DISPLAY_DIM)); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_SUSPEND)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_SUSPEND, testing::_)) .Times(::testing::AtLeast(1)) .WillOnce(::testing::Return(ActionResult::SUCCESS)); sleep((SCREEN_OFF_WAIT_TIME_S*1/3) + 1); @@ -180,7 +180,7 @@ HWTEST_F (PowerMgrMockSystemTest, PowerMgrMock105, TestSize.Level2) sleep(((time/1000)*2/3)+1); ON_CALL(*g_stateAction, GetDisplayState()) .WillByDefault(::testing::Return(DisplayState::DISPLAY_DIM)); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_SUSPEND)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_SUSPEND, testing::_)) .Times(::testing::AtLeast(1)) .WillOnce(::testing::Return(ActionResult::SUCCESS)); sleep(((time/1000)*1/3)+1); @@ -216,7 +216,7 @@ HWTEST_F (PowerMgrMockSystemTest, PowerMgrMock106, TestSize.Level2) EXPECT_EQ(pms->IsUsed(token), true); sleep(SLEEP_WAIT_TIME_S*10); EXPECT_EQ(PowerState::AWAKE, pms->GetState()); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_SUSPEND)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_SUSPEND, testing::_)) .Times(1) .WillOnce(::testing::Return(ActionResult::SUCCESS)); EXPECT_CALL(*g_stateAction, GoToSleep(_, _, _)).Times(0); @@ -253,7 +253,7 @@ HWTEST_F (PowerMgrMockSystemTest, PowerMgrMock107, TestSize.Level2) .WillByDefault(::testing::Return(DisplayState::DISPLAY_DIM)); pms->SetDisplaySuspend(true); pms->CreateRunningLock(token, info); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_SUSPEND)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_SUSPEND, testing::_)) .Times(1) .WillOnce(::testing::Return(ActionResult::SUCCESS)); EXPECT_CALL(*g_stateAction, GoToSleep(_, _, _)).Times(0); diff --git a/test/systemtest/src/power_mgr_powersavemode_test.cpp b/test/systemtest/src/power_mgr_powersavemode_test.cpp old mode 100644 new mode 100755 index f3db086ae0acd224a1597b9c7389e269a78f1411..2c703418d17263b81e716e724b06f47e38caa85c --- a/test/systemtest/src/power_mgr_powersavemode_test.cpp +++ b/test/systemtest/src/power_mgr_powersavemode_test.cpp @@ -26,7 +26,6 @@ #include "power_state_machine.h" #include "sys_param.h" #include "power_state_machine_info.h" -#include "display_info.h" #include "running_lock_info.h" #include "running_lock.h" #include "ipower_mode_callback.h" diff --git a/test/systemtest/src/power_mgr_st_mock_test.cpp b/test/systemtest/src/power_mgr_st_mock_test.cpp old mode 100644 new mode 100755 index 3b6c3e4ea58f6e1ddcfce9e8af05dddf756c7832..02985d0dca15213ebf9b0dc30e467f8b8af5eaa2 --- a/test/systemtest/src/power_mgr_st_mock_test.cpp +++ b/test/systemtest/src/power_mgr_st_mock_test.cpp @@ -129,7 +129,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock003, TestSize.Level2) } POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock003:Start mock."); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF, ::testing::_)) .Times(1) .WillOnce(::testing::Return(ActionResult::SUCCESS)); EXPECT_CALL(*g_stateAction, @@ -158,7 +158,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock004, TestSize.Level2) GTEST_LOG_(INFO) << "PowerMgrMock004: Failed to get PowerMgrService"; } - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF, ::testing::_)) .Times(1) .WillOnce(::testing::Return(ActionResult::SUCCESS)); EXPECT_CALL(*g_stateAction, @@ -186,7 +186,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock005, TestSize.Level2) GTEST_LOG_(INFO) << "PowerMgrMock005: Failed to get PowerMgrService"; } - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF, ::testing::_)) .Times(1) .WillOnce(::testing::Return(ActionResult::SUCCESS)); EXPECT_CALL(*g_stateAction, @@ -214,7 +214,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock006, TestSize.Level2) GTEST_LOG_(INFO) << "PowerMgrMock006: Failed to get PowerMgrService"; } - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF, ::testing::_)) .Times(1) .WillOnce(::testing::Return(ActionResult::SUCCESS)); EXPECT_CALL(*g_stateAction, @@ -242,7 +242,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock007, TestSize.Level2) GTEST_LOG_(INFO) << "PowerMgrMock007: Failed to get PowerMgrService"; } - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF, ::testing::_)) .Times(1) .WillOnce(::testing::Return(ActionResult::SUCCESS)); EXPECT_CALL(*g_stateAction, @@ -270,7 +270,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock008, TestSize.Level2) GTEST_LOG_(INFO) << "PowerMgrMock008: Failed to get PowerMgrService"; } - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF, ::testing::_)) .Times(1) .WillOnce(::testing::Return(ActionResult::SUCCESS)); EXPECT_CALL(*g_stateAction, @@ -298,7 +298,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock009, TestSize.Level2) GTEST_LOG_(INFO) << "PowerMgrMock009: Failed to get PowerMgrService"; } - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF, ::testing::_)) .Times(1) .WillOnce(::testing::Return(ActionResult::SUCCESS)); EXPECT_CALL(*g_stateAction, @@ -326,7 +326,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock010, TestSize.Level2) GTEST_LOG_(INFO) << "PowerMgrMock010: Failed to get PowerMgrService"; } - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF, ::testing::_)) .Times(1) .WillOnce(::testing::Return(ActionResult::SUCCESS)); EXPECT_CALL(*g_stateAction, @@ -354,7 +354,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock011, TestSize.Level2) GTEST_LOG_(INFO) << "PowerMgrMock011: Failed to get PowerMgrService"; } - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF, ::testing::_)) .Times(1) .WillOnce(::testing::Return(ActionResult::SUCCESS)); EXPECT_CALL(*g_stateAction, @@ -383,7 +383,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock012, TestSize.Level2) } pms->SuspendDevice(0, SuspendDeviceType::SUSPEND_DEVICE_REASON_APPLICATION, false); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_ON)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_ON, ::testing::_)) .Times(1) .WillOnce(::testing::Return(ActionResult::SUCCESS)); EXPECT_CALL(*g_stateAction, @@ -413,7 +413,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock013, TestSize.Level2) } pms->SuspendDevice(0, SuspendDeviceType::SUSPEND_DEVICE_REASON_APPLICATION, false); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_ON)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_ON, ::testing::_)) .Times(1) .WillOnce(::testing::Return(ActionResult::SUCCESS)); EXPECT_CALL(*g_stateAction, @@ -443,7 +443,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock014, TestSize.Level2) } pms->SuspendDevice(0, SuspendDeviceType::SUSPEND_DEVICE_REASON_APPLICATION, false); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_ON)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_ON, ::testing::_)) .Times(1) .WillOnce(::testing::Return(ActionResult::SUCCESS)); EXPECT_CALL(*g_stateAction, @@ -473,7 +473,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock015, TestSize.Level2) } pms->SuspendDevice(0, SuspendDeviceType::SUSPEND_DEVICE_REASON_APPLICATION, false); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_ON)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_ON, ::testing::_)) .Times(1) .WillOnce(::testing::Return(ActionResult::SUCCESS)); EXPECT_CALL(*g_stateAction, @@ -503,7 +503,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock016, TestSize.Level2) } pms->SuspendDevice(0, SuspendDeviceType::SUSPEND_DEVICE_REASON_APPLICATION, false); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_ON)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_ON, ::testing::_)) .Times(1) .WillOnce(::testing::Return(ActionResult::SUCCESS)); EXPECT_CALL(*g_stateAction, @@ -533,7 +533,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock017, TestSize.Level2) } pms->SuspendDevice(0, SuspendDeviceType::SUSPEND_DEVICE_REASON_APPLICATION, false); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_ON)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_ON, ::testing::_)) .Times(1) .WillOnce(::testing::Return(ActionResult::SUCCESS)); EXPECT_CALL(*g_stateAction, @@ -563,7 +563,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock018, TestSize.Level2) } pms->SuspendDevice(0, SuspendDeviceType::SUSPEND_DEVICE_REASON_APPLICATION, false); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_ON)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_ON, ::testing::_)) .Times(1) .WillOnce(::testing::Return(ActionResult::SUCCESS)); EXPECT_CALL(*g_stateAction, @@ -593,7 +593,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock019, TestSize.Level2) } pms->SuspendDevice(0, SuspendDeviceType::SUSPEND_DEVICE_REASON_APPLICATION, false); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_ON)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_ON, ::testing::_)) .Times(1) .WillOnce(::testing::Return(ActionResult::SUCCESS)); EXPECT_CALL(*g_stateAction, @@ -623,7 +623,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock020, TestSize.Level2) } pms->SuspendDevice(0, SuspendDeviceType::SUSPEND_DEVICE_REASON_APPLICATION, false); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_ON)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_ON, ::testing::_)) .Times(1) .WillOnce(::testing::Return(ActionResult::SUCCESS)); EXPECT_CALL(*g_stateAction, @@ -653,7 +653,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock021, TestSize.Level2) } pms->SuspendDevice(0, SuspendDeviceType::SUSPEND_DEVICE_REASON_APPLICATION, false); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_ON)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_ON, ::testing::_)) .Times(1) .WillOnce(::testing::Return(ActionResult::SUCCESS)); EXPECT_CALL(*g_stateAction, @@ -683,7 +683,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock022, TestSize.Level2) } pms->WakeupDevice(0, WakeupDeviceType::WAKEUP_DEVICE_UNKNOWN, std::string("test")); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF, ::testing::_)) .Times(::testing::AtLeast(1)) .WillOnce(::testing::Return(ActionResult::SUCCESS)); EXPECT_CALL(*g_stateAction, @@ -755,7 +755,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock024, TestSize.Level2) EXPECT_CALL(*g_stateAction, GetDisplayState()) .Times(::testing::AtLeast(1)) .WillOnce(::testing::Return(DisplayState::DISPLAY_DIM)); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_ON)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_ON, ::testing::_)) .Times(1) .WillOnce(::testing::Return(ActionResult::SUCCESS)); EXPECT_CALL(*g_stateAction, @@ -920,7 +920,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock030, TestSize.Level2) pms->Lock(token, info, 0); EXPECT_EQ(pms->IsUsed(token), true); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_DIM)).Times(0); + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_DIM, ::testing::_)).Times(0); sleep(SCREEN_DIM_WAIT_TIME_S + 1); pms->UnLock(token); @@ -984,7 +984,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock032, TestSize.Level2) GTEST_LOG_(INFO) << "PowerMgrMock032: Failed to get PowerMgrService"; } - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_DIM)).Times(0); + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_DIM, ::testing::_)).Times(0); sptr token = new RunningLockTokenStub(); RunningLockInfo info("test1", RunningLockType::RUNNINGLOCK_PROXIMITY_SCREEN_CONTROL); pms->CreateRunningLock(token, info); @@ -993,7 +993,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock032, TestSize.Level2) pms->Lock(token, info, 0); EXPECT_EQ(pms->IsUsed(token), true); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_DIM)).Times(0); + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_DIM, ::testing::_)).Times(0); sleep(SCREEN_DIM_WAIT_TIME_S + 1); EXPECT_CALL(*g_lockAction, Unlock(_, _)).Times(1); @@ -1054,7 +1054,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock034, TestSize.Level2) EXPECT_CALL(*g_stateAction, GetDisplayState()) .Times(::testing::AtLeast(1)) .WillOnce(::testing::Return(DisplayState::DISPLAY_DIM)); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_ON)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_ON, ::testing::_)) .Times(1) .WillOnce(::testing::Return(ActionResult::SUCCESS)); EXPECT_CALL(*g_stateAction, @@ -1086,7 +1086,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock035, TestSize.Level2) EXPECT_CALL(*g_stateAction, GetDisplayState()) .Times(::testing::AtLeast(1)) .WillOnce(::testing::Return(DisplayState::DISPLAY_DIM)); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_ON)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_ON, ::testing::_)) .Times(1) .WillOnce(::testing::Return(ActionResult::SUCCESS)); EXPECT_CALL(*g_stateAction, @@ -1118,7 +1118,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock036, TestSize.Level2) EXPECT_CALL(*g_stateAction, GetDisplayState()) .Times(::testing::AtLeast(1)) .WillOnce(::testing::Return(DisplayState::DISPLAY_DIM)); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_ON)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_ON, ::testing::_)) .Times(1) .WillOnce(::testing::Return(ActionResult::SUCCESS)); EXPECT_CALL(*g_stateAction, @@ -1150,7 +1150,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock037, TestSize.Level2) EXPECT_CALL(*g_stateAction, GetDisplayState()) .Times(::testing::AtLeast(1)) .WillOnce(::testing::Return(DisplayState::DISPLAY_DIM)); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_ON)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_ON, ::testing::_)) .Times(1) .WillOnce(::testing::Return(ActionResult::SUCCESS)); EXPECT_CALL(*g_stateAction, @@ -1182,7 +1182,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock038, TestSize.Level2) EXPECT_CALL(*g_stateAction, GetDisplayState()) .Times(::testing::AtLeast(1)) .WillOnce(::testing::Return(DisplayState::DISPLAY_DIM)); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_ON)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_ON, ::testing::_)) .Times(1) .WillOnce(::testing::Return(ActionResult::SUCCESS)); EXPECT_CALL(*g_stateAction, @@ -1251,7 +1251,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock040, TestSize.Level2) .WillByDefault(::testing::Return(DisplayState::DISPLAY_DIM)); EXPECT_CALL(*g_stateAction, RefreshActivity(0, _, _)).Times(0); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF, ::testing::_)) .Times(::testing::AtLeast(1)) .WillOnce(::testing::Return(ActionResult::SUCCESS)); pms->RefreshActivity(0, abnormaltype, true); @@ -1280,7 +1280,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock041, TestSize.Level2) } pms->SuspendDevice(0, SuspendDeviceType::SUSPEND_DEVICE_REASON_APPLICATION, false); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_ON)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_ON, ::testing::_)) .Times(0); EXPECT_CALL(*g_stateAction, Wakeup(0, _, @@ -1311,7 +1311,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock042, TestSize.Level2) } pms->SuspendDevice(0, SuspendDeviceType::SUSPEND_DEVICE_REASON_APPLICATION, false); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_ON)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_ON, ::testing::_)) .Times(0); EXPECT_CALL(*g_stateAction, Wakeup(0, _, @@ -1346,7 +1346,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock043, TestSize.Level2) sleep((SCREEN_OFF_WAIT_TIME_S*2/3) + 1); ON_CALL(*g_stateAction, GetDisplayState()) .WillByDefault(::testing::Return(DisplayState::DISPLAY_DIM)); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF, ::testing::_)) .Times(::testing::AtLeast(1)) .WillOnce(::testing::Return(ActionResult::SUCCESS)); sleep((SCREEN_OFF_WAIT_TIME_S*1/3) + 1); @@ -1374,7 +1374,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock044, TestSize.Level2) } pms->WakeupDevice(0, WakeupDeviceType::WAKEUP_DEVICE_UNKNOWN, std::string("test")); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_DIM)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_DIM, ::testing::_)) .Times(::testing::AtLeast(1)) .WillOnce(::testing::Return(ActionResult::SUCCESS)); ON_CALL(*g_stateAction, GetDisplayState()) @@ -1411,7 +1411,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock045, TestSize.Level2) sleep((SCREEN_OFF_WAIT_TIME_S*2/3) + 1); ON_CALL(*g_stateAction, GetDisplayState()) .WillByDefault(::testing::Return(DisplayState::DISPLAY_DIM)); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF, ::testing::_)) .Times(::testing::AtLeast(1)) .WillOnce(::testing::Return(ActionResult::SUCCESS)); sleep((SCREEN_OFF_WAIT_TIME_S*2/3) /2); @@ -1502,7 +1502,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock048, TestSize.Level2) } pms->WakeupDevice(0, WakeupDeviceType::WAKEUP_DEVICE_POWER_BUTTON, std::string("test")); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF, ::testing::_)) .Times(::testing::AtLeast(1)) .WillOnce(::testing::Return(ActionResult::SUCCESS)); EXPECT_CALL(*g_stateAction, @@ -1540,7 +1540,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock049, TestSize.Level2) pms->WakeupDevice(0, WakeupDeviceType::WAKEUP_DEVICE_POWER_BUTTON, std::string("test")); EXPECT_CALL(*g_stateAction, Suspend(0, _, false)).Times(0); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF)).Times(0); + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF, ::testing::_)).Times(0); pms->SuspendDevice(0, abnormaltype, false); EXPECT_EQ(PowerState::AWAKE, pms->GetState()); @@ -1569,7 +1569,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock050, TestSize.Level2) pms->WakeupDevice(0, WakeupDeviceType::WAKEUP_DEVICE_POWER_BUTTON, std::string("test")); EXPECT_CALL(*g_stateAction, Suspend(0, _, false)).Times(0); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF)).Times(0); + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF, ::testing::_)).Times(0); pms->SuspendDevice(0, abnormaltype, false); EXPECT_EQ(PowerState::AWAKE, pms->GetState()); @@ -1595,7 +1595,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock051, TestSize.Level2) } pms->SuspendDevice(0, SuspendDeviceType::SUSPEND_DEVICE_REASON_APPLICATION, false); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF, ::testing::_)) .Times(1) .WillOnce(::testing::Return(ActionResult::SUCCESS)); EXPECT_CALL(*g_stateAction, @@ -1717,13 +1717,13 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock055, TestSize.Level2) pms->WakeupDevice(0, WakeupDeviceType::WAKEUP_DEVICE_LID, std::string("test")); ON_CALL(*g_stateAction, GetDisplayState()) .WillByDefault(::testing::Return(DisplayState::DISPLAY_ON)); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_DIM)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_DIM, ::testing::_)) .Times(1) .WillOnce(::testing::Return(ActionResult::SUCCESS)); sleep((SCREEN_OFF_WAIT_TIME_S*2/3) + 1); ON_CALL(*g_stateAction, GetDisplayState()) .WillByDefault(::testing::Return(DisplayState::DISPLAY_DIM)); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF, ::testing::_)) .Times(1) .WillOnce(::testing::Return(ActionResult::SUCCESS)); sleep((SCREEN_OFF_WAIT_TIME_S*1/3) + 1); @@ -1749,7 +1749,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock056, TestSize.Level2) GTEST_LOG_(INFO) << "PowerMgrMock056: Failed to get PowerMgrService"; } - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_DIM)).Times(0); + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_DIM, ::testing::_)).Times(0); sptr token = new RunningLockTokenStub(); RunningLockInfo info("test1", RunningLockType::RUNNINGLOCK_SCREEN); pms->CreateRunningLock(token, info); @@ -1757,7 +1757,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock056, TestSize.Level2) pms->Lock(token, info, 0); EXPECT_EQ(pms->IsUsed(token), true); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_DIM)).Times(0); + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_DIM, ::testing::_)).Times(0); sleep((SCREEN_OFF_WAIT_TIME_S*2/3) + 1); ON_CALL(*g_stateAction, GetDisplayState()) .WillByDefault(::testing::Return(DisplayState::DISPLAY_ON)); @@ -1790,7 +1790,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock057, TestSize.Level2) sptr token = new RunningLockTokenStub(); RunningLockInfo info("test1", RunningLockType::RUNNINGLOCK_SCREEN); pms->CreateRunningLock(token, info); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_ON)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_ON, ::testing::_)) .Times(1) .WillOnce(::testing::Return(ActionResult::SUCCESS)); pms->Lock(token, info, 0); @@ -1821,10 +1821,10 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock058, TestSize.Level2) } ON_CALL(*g_stateAction, GetDisplayState()) .WillByDefault(::testing::Return(DisplayState::DISPLAY_ON)); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_DIM)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_DIM, ::testing::_)) .Times(1) .WillOnce(::testing::Return(ActionResult::SUCCESS)); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF, ::testing::_)) .Times(1) .WillOnce(::testing::Return(ActionResult::SUCCESS)); pms->SetDisplayOffTime(time); @@ -1859,7 +1859,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock059, TestSize.Level2) pms->Lock(token, info, 0); EXPECT_EQ(pms->IsUsed(token), true); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_DIM)).Times(0); + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_DIM, ::testing::_)).Times(0); sleep(SCREEN_DIM_WAIT_TIME_S + 1); pms->UnLock(token); @@ -1891,9 +1891,9 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock060, TestSize.Level2) pms->Lock(token, info, 0); EXPECT_EQ(pms->IsUsed(token), true); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF)).Times(0); + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF, ::testing::_)).Times(0); sleep(SLEEP_WAIT_TIME_S*10); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF)).Times(0); + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF, ::testing::_)).Times(0); EXPECT_EQ(PowerState::AWAKE, pms->GetState()); ResetMockAction(); @@ -1924,7 +1924,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock061, TestSize.Level2) for (i=0; i<10; i++) { pms->Lock(token, info, 0); EXPECT_EQ(pms->IsUsed(token), true); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_DIM)).Times(0); + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_DIM, ::testing::_)).Times(0); sleep(SCREEN_OFF_WAIT_TIME_S + 1); pms->UnLock(token); EXPECT_EQ(pms->IsUsed(token), false); @@ -1960,7 +1960,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock062, TestSize.Level2) pms->Lock(token, info, 0); EXPECT_EQ(pms->IsUsed(token), true); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF, ::testing::_)) .Times(::testing::AtLeast(1)) .WillOnce(::testing::Return(ActionResult::SUCCESS)); @@ -2161,7 +2161,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock067, TestSize.Level2) sleep((SCREEN_OFF_WAIT_TIME_S*2/3) + 1); ON_CALL(*g_stateAction, GetDisplayState()) .WillByDefault(::testing::Return(DisplayState::DISPLAY_DIM)); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF, ::testing::_)) .Times(1) .WillOnce(::testing::Return(ActionResult::SUCCESS)); sleep((SCREEN_OFF_WAIT_TIME_S*1/3) + 1); @@ -2200,7 +2200,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock068, TestSize.Level2) ON_CALL(*g_stateAction, GetDisplayState()) .WillByDefault(::testing::Return(DisplayState::DISPLAY_DIM)); pms->CreateRunningLock(token, info); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF, ::testing::_)) .Times(1) .WillOnce(::testing::Return(ActionResult::SUCCESS)); EXPECT_CALL(*g_stateAction, GoToSleep(_, _, _)).Times(0); @@ -2251,12 +2251,12 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock069, TestSize.Level2) pms->Lock(token, info, 0); EXPECT_EQ(pms->IsUsed(token), true); sleep(SLEEP_WAIT_TIME_S + 1); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_ON)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_ON, ::testing::_)) .Times(1) .WillOnce(::testing::Return(ActionResult::SUCCESS)); pms->WakeupDevice(0, WakeupDeviceType::WAKEUP_DEVICE_UNKNOWN, std::string("test")); sleep(SLEEP_WAIT_TIME_S + 1); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF)).Times(0); + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF, ::testing::_)).Times(0); EXPECT_CALL(*g_lockAction, Unlock(_, _)).Times(1); pms->UnLock(token); @@ -2328,12 +2328,12 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock071, TestSize.Level2) sptr token = new RunningLockTokenStub(); RunningLockInfo info("test1", RunningLockType::RUNNINGLOCK_PROXIMITY_SCREEN_CONTROL); pms->CreateRunningLock(token, info); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF, ::testing::_)) .Times(::testing::AtLeast(1)) .WillOnce(::testing::Return(ActionResult::SUCCESS)); pms->SuspendDevice(0, SuspendDeviceType::SUSPEND_DEVICE_REASON_APPLICATION, false); EXPECT_EQ(PowerState::INACTIVE, pms->GetState()); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_ON)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_ON, ::testing::_)) .Times(1) .WillOnce(::testing::Return(ActionResult::SUCCESS)); sleep(SCREEN_OFF_WAIT_TIME_S + 1); @@ -2373,7 +2373,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock072, TestSize.Level2) .Times(1) .WillOnce(::testing::Return(ActionResult::SUCCESS)); EXPECT_EQ(pms->ForceSuspendDevice(0), true); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_ON)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_ON, ::testing::_)) .Times(1) .WillOnce(::testing::Return(ActionResult::SUCCESS)); sleep(SCREEN_OFF_WAIT_TIME_S + 1); @@ -2419,7 +2419,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock073, TestSize.Level2) sleep((SCREEN_OFF_WAIT_TIME_S*2/3) + 1); ON_CALL(*g_stateAction, GetDisplayState()) .WillByDefault(::testing::Return(DisplayState::DISPLAY_DIM)); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF, ::testing::_)) .Times(::testing::AtLeast(1)) .WillOnce(::testing::Return(ActionResult::SUCCESS)); sleep((SCREEN_OFF_WAIT_TIME_S*1/3) + 1); @@ -2462,7 +2462,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock074, TestSize.Level2) EXPECT_EQ(pms->IsUsed(token), true); sleep(SCREEN_OFF_WAIT_TIME_S+1); EXPECT_EQ(PowerState::AWAKE, pms->GetState()); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF, ::testing::_)) .Times(1) .WillOnce(::testing::Return(ActionResult::SUCCESS)); EXPECT_CALL(*g_stateAction, GoToSleep(_, _, _)).Times(0); @@ -2496,7 +2496,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock075, TestSize.Level2) EXPECT_EQ(pms->IsUsed(token), true); sleep(SLEEP_WAIT_TIME_S*10); EXPECT_EQ(PowerState::AWAKE, pms->GetState()); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF, ::testing::_)) .Times(1) .WillOnce(::testing::Return(ActionResult::SUCCESS)); EXPECT_CALL(*g_stateAction, GoToSleep(_, _, _)).Times(0); @@ -2538,7 +2538,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock076, TestSize.Level2) } pms->Lock(token, info, 0); EXPECT_EQ(pms->IsUsed(token), true); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF, ::testing::_)) .Times(1) .WillOnce(::testing::Return(ActionResult::SUCCESS)); EXPECT_CALL(*g_stateAction, GoToSleep(_, _, _)).Times(0); @@ -2572,7 +2572,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock077, TestSize.Level2) EXPECT_CALL(*g_lockAction, Lock(_, _)).Times(1); pms->Lock(token, info, 0); EXPECT_EQ(pms->IsUsed(token), true); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF, ::testing::_)) .Times(::testing::AtLeast(1)) .WillOnce(::testing::Return(ActionResult::SUCCESS)); EXPECT_CALL(*g_stateAction, GoToSleep(_, _, false)) @@ -2689,7 +2689,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock080, TestSize.Level2) sleep(((time/1000)*2/3)+1); ON_CALL(*g_stateAction, GetDisplayState()) .WillByDefault(::testing::Return(DisplayState::DISPLAY_DIM)); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF, ::testing::_)) .Times(::testing::AtLeast(1)) .WillOnce(::testing::Return(ActionResult::SUCCESS)); sleep(time/1000*1/3+1); @@ -2729,7 +2729,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock081, TestSize.Level2) sleep(((time/1000)*2/3)+1); ON_CALL(*g_stateAction, GetDisplayState()) .WillByDefault(::testing::Return(DisplayState::DISPLAY_DIM)); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF, ::testing::_)) .Times(::testing::AtLeast(1)) .WillOnce(::testing::Return(ActionResult::SUCCESS)); sleep(((time/1000)*1/3)+1); @@ -2768,7 +2768,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock082, TestSize.Level2) sleep(((time/1000)*2/3)+1); ON_CALL(*g_stateAction, GetDisplayState()) .WillByDefault(::testing::Return(DisplayState::DISPLAY_DIM)); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF, ::testing::_)) .Times(::testing::AtLeast(1)) .WillOnce(::testing::Return(ActionResult::SUCCESS)); sleep(time/1000*1/3+1); @@ -2806,7 +2806,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock083, TestSize.Level2) sleep(((time/1000)*2/3)+1); ON_CALL(*g_stateAction, GetDisplayState()) .WillByDefault(::testing::Return(DisplayState::DISPLAY_DIM)); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF, ::testing::_)) .Times(::testing::AtLeast(1)) .WillOnce(::testing::Return(ActionResult::SUCCESS)); sleep(time/1000*1/3+1); @@ -2844,7 +2844,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock084, TestSize.Level2) sleep(((time/1000)*2/3)+1); ON_CALL(*g_stateAction, GetDisplayState()) .WillByDefault(::testing::Return(DisplayState::DISPLAY_DIM)); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF, ::testing::_)) .Times(::testing::AtLeast(1)) .WillOnce(::testing::Return(ActionResult::SUCCESS)); sleep(time/1000*1/3+1); @@ -2882,7 +2882,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock085, TestSize.Level2) sleep(((time/1000)*2/3)+1); ON_CALL(*g_stateAction, GetDisplayState()) .WillByDefault(::testing::Return(DisplayState::DISPLAY_DIM)); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF, ::testing::_)) .Times(::testing::AtLeast(1)) .WillOnce(::testing::Return(ActionResult::SUCCESS)); sleep(time/1000*1/3+1); @@ -2919,10 +2919,10 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock086, TestSize.Level2) POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock086:DeviceStateAction::SetDisplayState."); ON_CALL(*g_stateAction, GetDisplayState()) .WillByDefault(::testing::Return(DisplayState::DISPLAY_ON)); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_DIM)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_DIM, ::testing::_)) .Times(1) .WillOnce(::testing::Return(ActionResult::SUCCESS)); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF, ::testing::_)) .Times(1) .WillOnce(::testing::Return(ActionResult::SUCCESS)); POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock086:Start sleep."); @@ -2956,10 +2956,10 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock087, TestSize.Level2) } ON_CALL(*g_stateAction, GetDisplayState()) .WillByDefault(::testing::Return(DisplayState::DISPLAY_ON)); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_DIM)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_DIM, ::testing::_)) .Times(1) .WillOnce(::testing::Return(ActionResult::SUCCESS)); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF, ::testing::_)) .Times(1) .WillOnce(::testing::Return(ActionResult::SUCCESS)); pms->SetDisplayOffTime(time); @@ -2991,10 +2991,10 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock088, TestSize.Level2) } ON_CALL(*g_stateAction, GetDisplayState()) .WillByDefault(::testing::Return(DisplayState::DISPLAY_ON)); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_DIM)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_DIM, ::testing::_)) .Times(1) .WillOnce(::testing::Return(ActionResult::SUCCESS)); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF, ::testing::_)) .Times(1) .WillOnce(::testing::Return(ActionResult::SUCCESS)); pms->SetDisplayOffTime(time); @@ -3025,10 +3025,10 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock089, TestSize.Level2) } ON_CALL(*g_stateAction, GetDisplayState()) .WillByDefault(::testing::Return(DisplayState::DISPLAY_ON)); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_DIM)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_DIM, ::testing::_)) .Times(1) .WillOnce(::testing::Return(ActionResult::SUCCESS)); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF, ::testing::_)) .Times(1) .WillOnce(::testing::Return(ActionResult::SUCCESS)); pms->SetDisplayOffTime(time); @@ -3059,10 +3059,10 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock090, TestSize.Level2) } ON_CALL(*g_stateAction, GetDisplayState()) .WillByDefault(::testing::Return(DisplayState::DISPLAY_ON)); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_DIM)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_DIM, ::testing::_)) .Times(1) .WillOnce(::testing::Return(ActionResult::SUCCESS)); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF, ::testing::_)) .Times(1) .WillOnce(::testing::Return(ActionResult::SUCCESS)); pms->SetDisplayOffTime(time); @@ -3105,7 +3105,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock091, TestSize.Level2) sleep((SCREEN_OFF_WAIT_TIME_S*2/3)+1); ON_CALL(*g_stateAction, GetDisplayState()) .WillByDefault(::testing::Return(DisplayState::DISPLAY_DIM)); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_OFF, ::testing::_)) .Times(::testing::AtLeast(1)) .WillOnce(::testing::Return(ActionResult::SUCCESS)); sleep((SCREEN_OFF_WAIT_TIME_S*1/3) + 1); @@ -3134,7 +3134,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock092, TestSize.Level2) ON_CALL(*g_stateAction, GetDisplayState()) .WillByDefault(::testing::Return(DisplayState::DISPLAY_ON)); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_DIM)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_DIM, ::testing::_)) .Times(1) .WillOnce(::testing::Return(ActionResult::SUCCESS)); sleep((SCREEN_OFF_WAIT_TIME_S*2/3) + 1); @@ -3168,7 +3168,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock093, TestSize.Level2) ON_CALL(*g_stateAction, GetDisplayState()) .WillByDefault(::testing::Return(DisplayState::DISPLAY_ON)); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_DIM)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_DIM, ::testing::_)) .Times(1) .WillOnce(::testing::Return(ActionResult::SUCCESS)); sleep((SCREEN_OFF_WAIT_TIME_S*2/3) + 1); @@ -3202,7 +3202,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock094, TestSize.Level2) ON_CALL(*g_stateAction, GetDisplayState()) .WillByDefault(::testing::Return(DisplayState::DISPLAY_ON)); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_DIM)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_DIM, ::testing::_)) .Times(1) .WillOnce(::testing::Return(ActionResult::SUCCESS)); sleep((SCREEN_OFF_WAIT_TIME_S*2/3) + 1); @@ -3236,7 +3236,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock095, TestSize.Level2) ON_CALL(*g_stateAction, GetDisplayState()) .WillByDefault(::testing::Return(DisplayState::DISPLAY_ON)); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_DIM)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_DIM, ::testing::_)) .Times(1) .WillOnce(::testing::Return(ActionResult::SUCCESS)); sleep((SCREEN_OFF_WAIT_TIME_S*2/3) + 1); @@ -3270,7 +3270,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock096, TestSize.Level2) ON_CALL(*g_stateAction, GetDisplayState()) .WillByDefault(::testing::Return(DisplayState::DISPLAY_ON)); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_DIM)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_DIM, ::testing::_)) .Times(1) .WillOnce(::testing::Return(ActionResult::SUCCESS)); sleep((SCREEN_OFF_WAIT_TIME_S*2/3) + 1); @@ -3304,7 +3304,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock097, TestSize.Level2) ON_CALL(*g_stateAction, GetDisplayState()) .WillByDefault(::testing::Return(DisplayState::DISPLAY_ON)); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_DIM)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_DIM, ::testing::_)) .Times(1) .WillOnce(::testing::Return(ActionResult::SUCCESS)); sleep((SCREEN_OFF_WAIT_TIME_S*2/3) + 1); @@ -3338,7 +3338,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock098, TestSize.Level2) ON_CALL(*g_stateAction, GetDisplayState()) .WillByDefault(::testing::Return(DisplayState::DISPLAY_ON)); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_DIM)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_DIM, ::testing::_)) .Times(1) .WillOnce(::testing::Return(ActionResult::SUCCESS)); sleep((SCREEN_OFF_WAIT_TIME_S*2/3) + 1); @@ -3372,7 +3372,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock099, TestSize.Level2) ON_CALL(*g_stateAction, GetDisplayState()) .WillByDefault(::testing::Return(DisplayState::DISPLAY_ON)); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_DIM)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_DIM, ::testing::_)) .Times(1) .WillOnce(::testing::Return(ActionResult::SUCCESS)); sleep((SCREEN_OFF_WAIT_TIME_S*2/3) + 1); @@ -3406,7 +3406,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock100, TestSize.Level2) ON_CALL(*g_stateAction, GetDisplayState()) .WillByDefault(::testing::Return(DisplayState::DISPLAY_ON)); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_DIM)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_DIM, ::testing::_)) .Times(1) .WillOnce(::testing::Return(ActionResult::SUCCESS)); sleep((SCREEN_OFF_WAIT_TIME_S*2/3) + 1); @@ -3440,7 +3440,7 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock101, TestSize.Level2) ON_CALL(*g_stateAction, GetDisplayState()) .WillByDefault(::testing::Return(DisplayState::DISPLAY_ON)); - EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_DIM)) + EXPECT_CALL(*g_stateAction, SetDisplayState(DisplayState::DISPLAY_DIM, ::testing::_)) .Times(1) .WillOnce(::testing::Return(ActionResult::SUCCESS)); sleep((SCREEN_OFF_WAIT_TIME_S*2/3) + 1); @@ -3455,4 +3455,4 @@ HWTEST_F (PowerMgrSTMockTest, PowerMgrMock101, TestSize.Level2) POWER_HILOGD(MODULE_SERVICE, "PowerMgrMock101:End."); GTEST_LOG_(INFO) << "PowerMgrMock101: end."; } -} \ No newline at end of file +} diff --git a/utils/BUILD.gn b/utils/BUILD.gn old mode 100644 new mode 100755 diff --git a/utils/native/include/hilog_wrapper.h b/utils/native/include/hilog_wrapper.h old mode 100644 new mode 100755 diff --git a/utils/native/include/permission.h b/utils/native/include/permission.h old mode 100644 new mode 100755 diff --git a/utils/native/include/power_common.h b/utils/native/include/power_common.h old mode 100644 new mode 100755 diff --git a/utils/native/include/power_mgr_errors.h b/utils/native/include/power_mgr_errors.h old mode 100644 new mode 100755 diff --git a/utils/native/include/sp_singleton.h b/utils/native/include/sp_singleton.h old mode 100644 new mode 100755 diff --git a/utils/native/src/permission.cpp b/utils/native/src/permission.cpp old mode 100644 new mode 100755 diff --git a/utils/native/src/sys_param.cpp b/utils/native/src/sys_param.cpp old mode 100644 new mode 100755 diff --git a/utils/shell/include/power_shell_command.h b/utils/shell/include/power_shell_command.h old mode 100644 new mode 100755 diff --git a/utils/shell/src/main.cpp b/utils/shell/src/main.cpp old mode 100644 new mode 100755 diff --git a/utils/shell/src/power_shell_command.cpp b/utils/shell/src/power_shell_command.cpp old mode 100644 new mode 100755