1/* 2 * Copyright (c) 2024 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16/** 17 * @addtogroup power 18 * @{ 19 * 20 * @brief Provides APIs for performing hibernation/wakeup operations, subscribing to the hibernation/wakeup status, 21 * and managing running locks. 22 * 23 * After obtaining an object or proxy of this module, the power service can invoke related APIs to perform 24 * hibernation/wakeup operations, subscribe to the hibernation/wakeup status, and manage running locks. 25 * 26 * @since 3.1 27 * @version 1.0 28 */ 29 30/** 31 * @file RunningLockTypes.idl 32 * 33 * @brief Enumerates data types related to running lock management. 34 * 35 * Such data types include running lock types and running lock information. 36 * 37 * @since 4.0 38 * @version 1.1 39 */ 40 41package ohos.hdi.power.v1_2; 42 43/** 44 * @brief Enumerates base running lock types. 45 * 46 * @since 4.0 47 */ 48enum BaseRunningLockType { 49 /** 50 * Running lock for keeping screen on. 51 */ 52 RUNNINGLOCK_SCREEN = 0, 53 /** 54 * Running lock for keeping the CPU on to finish background tasks. 55 */ 56 RUNNINGLOCK_BACKGROUND = 1, 57 /** 58 * Running lock for controlling screen on and off by proximity sensor. 59 */ 60 RUNNINGLOCK_PROXIMITY_SCREEN_CONTROL = 2, 61}; 62 63/** 64 * @brief Enumerates running lock types. 65 * 66 * @since 4.0 67 */ 68enum RunningLockType { 69 /** 70 * Running lock for keeping background phone tasks to finish. 71 */ 72 RUNNINGLOCK_BACKGROUND_PHONE = 3, // RUNNINGLOCK_BACKGROUND | 1 << 1 = 0b00000011 73 /** 74 * Running lock for keeping background notification tasks to finish. 75 */ 76 RUNNINGLOCK_BACKGROUND_NOTIFICATION = 5, // RUNNINGLOCK_BACKGROUND | 1 << 2 = 0b00000101 77 /** 78 * Running lock for keeping background audio tasks to finish. 79 */ 80 RUNNINGLOCK_BACKGROUND_AUDIO = 9, // RUNNINGLOCK_BACKGROUND | 1 << 3 = 0b00001001 81 /** 82 * Running lock for keeping background sport tasks to finish. 83 */ 84 RUNNINGLOCK_BACKGROUND_SPORT = 17, // RUNNINGLOCK_BACKGROUND | 1 << 4 = 0b00010001 85 /** 86 * Running lock for keeping background navigation tasks to finish. 87 */ 88 RUNNINGLOCK_BACKGROUND_NAVIGATION = 33, // RUNNINGLOCK_BACKGROUND | 1 << 5 = 0b00100001 89 /** 90 * Running lock for keeping background common tasks to finish. 91 */ 92 RUNNINGLOCK_BACKGROUND_TASK = 65, // RUNNINGLOCK_BACKGROUND | 1 << 6 = 0b01000001 93 /** 94 * Reserved running lock type. 95 */ 96 RUNNINGLOCK_BUTT 97}; 98 99/** 100 * @brief Defines the running lock information. 101 * 102 * @since 4.0 103 */ 104struct RunningLockInfo { 105 /** Name of the running lock. It cannot be null or empty */ 106 String name; 107 /** Running lock type */ 108 enum RunningLockType type; // The default value is RUNNINGLOCK_BACKGROUND_TASK. 109 /** Timeout duration of the running lock, in ms. A value smaller than 0 means no timeout. */ 110 int timeoutMs; // The default value is 3000. 111 /** PID */ 112 int pid; 113 /** UID */ 114 int uid; 115}; 116/** @} */ 117