harmony 鸿蒙Power Subsystem ChangeLog

  • 2023-02-03
  • 浏览 (487)

Power Subsystem ChangeLog

cl.powermgr.1 Error Information Return Method Change of APIs

The following APIs used service logic return values to indicate error information, which did not comply with the error code specifications of OpenHarmony. Therefore, they are modified in API version 9 and later.

Asynchronous API: An error message is returned via AsyncCallback or the error object of Promise.

Synchronous API: An error message is returned via an exception.

Change Impacts

The application developed based on earlier versions needs to adapt the method for returning API error information. Otherwise, the original service logic will be affected.

Key API/Component Changes

Error code processing is added for the following APIs: - getBatteryStats(callback: AsyncCallback): void - getAppPowerValue(uid: number): number - getAppPowerPercent(uid: number): number - getHardwareUnitPowerValue(type: ConsumptionType): number - getHardwareUnitPowerPercent(type: ConsumptionType): number - setValue(value: number): void - shutdown(reason: string): void; - isActive(): boolean - wakeup(detail: string): void - suspend(): void - getPowerMode(): DevicePowerMode - setPowerMode(mode: DevicePowerMode, callback: AsyncCallback<void>): void - setPowerMode(mode: DevicePowerMode): Promise<void> - hold(timeout: number): void - isHolding(): boolean - unhold(): void - isSupported(type: RunningLockType): boolean - isSupported(type: RunningLockType): boolean - create(name: string, type: RunningLockType, callback: AsyncCallback<RunningLock>): void - create(name: string, type: RunningLockType): Promise<RunningLock> - registerThermalLevelCallback(callback: Callback<ThermalLevel>): void - unregisterThermalLevelCallback(callback?: Callback<void>): void - getLevel(): ThermalLevel

Adaptation Guide

For details, see the API reference document of each API.

cl.powermgr.2 System API Change

Change Impacts

The application developed based on earlier versions needs to adapt to new API names and the new method for returning API error information. Otherwise, the original service logic will be affected.

Key API/Component Changes

Bundle Name Original API New API
@ohos.power shutdownDevice(reason: string): void shutdown(reason: string): void
@ohos.power rebootDevice(reason: string): void reboot(reason: string): void
@ohos.power wakeupDevice(detail: string): void wakeup(detail: string): void
@ohos.power suspendDevice(): void suspend(): void

Adaptation Guide

For details, see @ohos.power.

你可能感兴趣的鸿蒙文章

harmony 鸿蒙Account Subsystem ChangeLog

harmony 鸿蒙ChangeLog of JS API Changes in the Multimedia Subsystem

harmony 鸿蒙Device Manager ChangeLog

harmony 鸿蒙USB Manager ChangeLog

harmony 鸿蒙DSoftBus Subsystem ChangeLog

harmony 鸿蒙File Management Subsystem ChangeLog

harmony 鸿蒙Globalization Subsystem ChangeLog

harmony 鸿蒙Input Method Framework ChangeLog

harmony 鸿蒙Multimodal Input ChangeLog

harmony 鸿蒙Upload and Download Subsystem ChangeLog

0  赞