mirror of
https://gitee.com/openharmony/powermgr_battery_manager
synced 2024-12-29 01:54:55 +00:00
!607 fix: add IsNativePermissionGranted permission check
Merge pull request !607 from cjw123qq/0921
This commit is contained in:
commit
39f02ff8dc
@ -502,7 +502,7 @@ void BatteryService::SetLowCapacityThreshold()
|
||||
|
||||
BatteryError BatteryService::SetBatteryConfig(const std::string& sceneName, const std::string& value)
|
||||
{
|
||||
if (!Permission::IsSystem()) {
|
||||
if (!Permission::IsSystem() || !Permission::IsNativePermissionGranted("ohos.permission.POWER_OPTIMIZATION")) {
|
||||
BATTERY_HILOGI(FEATURE_BATT_INFO, "SetBatteryConfig failed, System permission intercept");
|
||||
return BatteryError::ERR_SYSTEM_API_DENIED;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user