Merge "Update adaptive preference summary" into sc-v2-dev

This commit is contained in:
TreeHugger Robot
2021-10-06 10:03:55 +00:00
committed by Android (Google) Code Review
5 changed files with 21 additions and 1 deletions

View File

@@ -139,6 +139,11 @@ public interface PowerUsageFeatureProvider {
*/
boolean isChartGraphSlotsEnabled(Context context);
/**
* Checks whether adaptive charging feature is supported in this device
*/
boolean isAdaptiveChargingSupported();
/**
* Gets a intent for one time bypass charge limited to resume charging.
*/

View File

@@ -166,6 +166,11 @@ public class PowerUsageFeatureProviderImpl implements PowerUsageFeatureProvider
return false;
}
@Override
public boolean isAdaptiveChargingSupported() {
return false;
}
@Override
public Intent getResumeChargeIntent() {
return null;

View File

@@ -64,7 +64,10 @@ public class BatteryManagerPreferenceController extends BasePreferenceController
preference.setSummary(mContext.getResources().getQuantityString(
R.plurals.battery_manager_app_restricted, num, num));
} else {
preference.setSummary(R.string.battery_manager_summary);
preference.setSummary(
mPowerUsageFeatureProvider.isAdaptiveChargingSupported()
? R.string.battery_manager_summary
: R.string.battery_manager_summary_unsupported);
}
}
}