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