1# Power Subsystem ChangeLog 2 3## cl.powermgr.1 Error Information Return Method Change of APIs 4 5The 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. 6 7- Power consumption statistics: [@ohos.batteryStatistics](../../../application-dev/reference/apis/js-apis-batteryStatistics.md) 8 - Brightness: [@ohos.brightness](../../../application-dev/reference/apis/js-apis-brightness.md) 9 - Power manager: [@ohos.power](../../../application-dev/reference/apis/js-apis-power.md) 10 - RunningLock: [@ohos.runningLock](../../../application-dev/reference/apis/js-apis-runninglock.md) 11 - Thermal manager: [@ohos.thermal](../../../application-dev/reference/apis/js-apis-thermal.md) 12 13Asynchronous API: An error message is returned via **AsyncCallback** or the **error** object of **Promise**. 14 15Synchronous API: An error message is returned via an exception. 16 17#### Change Impacts 18 19The application developed based on earlier versions needs to adapt the method for returning API error information. Otherwise, the original service logic will be affected. 20 21#### Key API/Component Changes 22 23Error code processing is added for the following APIs: 24 - getBatteryStats(callback: AsyncCallback<Array<BatteryStatsInfo>>): void 25 - getAppPowerValue(uid: number): number 26 - getAppPowerPercent(uid: number): number 27 - getHardwareUnitPowerValue(type: ConsumptionType): number 28 - getHardwareUnitPowerPercent(type: ConsumptionType): number 29 - setValue(value: number): void 30 - shutdown(reason: string): void; 31 - isActive(): boolean 32 - wakeup(detail: string): void 33 - suspend(): void 34 - getPowerMode(): DevicePowerMode 35 - setPowerMode(mode: DevicePowerMode, callback: AsyncCallback<void>): void 36 - setPowerMode(mode: DevicePowerMode): Promise<void> 37 - hold(timeout: number): void 38 - isHolding(): boolean 39 - unhold(): void 40 - isSupported(type: RunningLockType): boolean 41 - isSupported(type: RunningLockType): boolean 42 - create(name: string, type: RunningLockType, callback: AsyncCallback<RunningLock>): void 43 - create(name: string, type: RunningLockType): Promise<RunningLock> 44 - registerThermalLevelCallback(callback: Callback<ThermalLevel>): void 45 - unregisterThermalLevelCallback(callback?: Callback<void>): void 46 - getLevel(): ThermalLevel 47 48#### Adaptation Guide 49 50For details, see the API reference document of each API. 51## cl.powermgr.2 System API Change 52 53#### Change Impacts 54 55The 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. 56 57#### Key API/Component Changes 58 59| Bundle Name | Original API | New API | 60| ----------- | ------------------------------------ | ------------------------------ | 61| @ohos.power | shutdownDevice(reason: string): void | shutdown(reason: string): void | 62| @ohos.power | rebootDevice(reason: string): void | reboot(reason: string): void | 63| @ohos.power | wakeupDevice(detail: string): void | wakeup(detail: string): void | 64| @ohos.power | suspendDevice(): void | suspend(): void | 65 66#### Adaptation Guide 67 68For details, see [@ohos.power](../../../application-dev/reference/apis/js-apis-power.md). 69