diff --git a/api/@ohos.power.d.ts b/api/@ohos.power.d.ts index fbafb0b9dcbe67a91aa9f275ac02a9905e095af4..901dcd8fef6c223002ef2937e226ce27360a2358 100644 --- a/api/@ohos.power.d.ts +++ b/api/@ohos.power.d.ts @@ -307,6 +307,21 @@ declare namespace power { */ function refreshActivity(reason: string): void; + /** + * Set the power key filtering strategy. For details, see {@link PowerKeyFilteringStrategy}. + * @permission ohos.permission.POWER_MANAGER + * @param { PowerKeyFilteringStrategy } strategy Indicates the power key filtering strategy {@link PowerKeyFilteringStrategy} to set. + * the PowerKeyFilteringStrategy type is an enumeration class. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission + * required to call the API. + * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. + * @throws { BusinessError } 4900101 - Failed to connect to the service. + * @syscap SystemCapability.PowerManager.PowerManager.Core + * @systemapi + * @since 21 + */ + function setPowerKeyFilteringStrategy(strategy: PowerKeyFilteringStrategy): void; + /** * Power mode of a device. * @@ -356,5 +371,29 @@ declare namespace power { */ MODE_CUSTOM_POWER_SAVE = 650 } + + /** + * Filtering strategy of power key. + * + * @enum { int } + * @syscap SystemCapability.PowerManager.PowerManager.Core + * @since 21 + */ + export enum PowerKeyFilteringStrategy { + /** + * Disable long press filtering. + * + * @syscap SystemCapability.PowerManager.PowerManager.Core + * @since 21 + */ + DISABLE_LONG_PRESS_FILTERING = 0, + /** + * Long press filtering once. + * + * @syscap SystemCapability.PowerManager.PowerManager.Core + * @since 21 + */ + LONG_PRESS_FILTERING_ONCE = 1 + } } export default power; \ No newline at end of file