Merge "Add a new config for checking BatteryManager show/hide rule" into udc-dev

This commit is contained in:
YK Hung
2023-03-05 05:12:27 +00:00
committed by Android (Google) Code Review
4 changed files with 30 additions and 12 deletions

View File

@@ -50,8 +50,13 @@ public class BatteryManagerPreferenceController extends BasePreferenceController
@Override
public int getAvailabilityStatus() {
return mPowerUsageFeatureProvider.isBatteryManagerSupported()
&& mPowerUsageFeatureProvider.isAdaptiveChargingSupported()
if (!mPowerUsageFeatureProvider.isBatteryManagerSupported()) {
return UNSUPPORTED_ON_DEVICE;
}
if (!mContext.getResources().getBoolean(R.bool.config_battery_manager_consider_ac)) {
return AVAILABLE_UNSEARCHABLE;
}
return mPowerUsageFeatureProvider.isAdaptiveChargingSupported()
? AVAILABLE_UNSEARCHABLE : UNSUPPORTED_ON_DEVICE;
}