Merge "Customize the remaining time label during wireless charging." into main
This commit is contained in:
committed by
Android (Google) Code Review
commit
ce51f659df
@@ -396,7 +396,11 @@ public class BatteryInfo {
|
||||
chargeTimeMs <= 0
|
||||
? null
|
||||
: getPowerRemainingChargingLabel(
|
||||
context, chargeTimeMs, info.isFastCharging, currentTimeMs);
|
||||
context,
|
||||
chargeTimeMs,
|
||||
info.isFastCharging,
|
||||
info.pluggedStatus,
|
||||
currentTimeMs);
|
||||
|
||||
info.chargeLabel =
|
||||
chargeTimeMs <= 0
|
||||
@@ -428,7 +432,21 @@ public class BatteryInfo {
|
||||
}
|
||||
|
||||
private static CharSequence getPowerRemainingChargingLabel(
|
||||
Context context, long remainingTimeMs, boolean isFastCharging, long currentTimeMs) {
|
||||
Context context,
|
||||
long remainingTimeMs,
|
||||
boolean isFastCharging,
|
||||
int pluggedStatus,
|
||||
long currentTimeMs) {
|
||||
if (pluggedStatus == BatteryManager.BATTERY_PLUGGED_WIRELESS) {
|
||||
BatterySettingsFeatureProvider provider =
|
||||
FeatureFactory.getFeatureFactory().getBatterySettingsFeatureProvider();
|
||||
final CharSequence wirelessChargingRemainingLabel =
|
||||
provider.getWirelessChargingRemainingLabel(
|
||||
context, remainingTimeMs, currentTimeMs);
|
||||
if (wirelessChargingRemainingLabel != null) {
|
||||
return wirelessChargingRemainingLabel;
|
||||
}
|
||||
}
|
||||
if (com.android.settingslib.fuelgauge.BatteryUtils.isChargingStringV2Enabled()) {
|
||||
int chargeLabelResId =
|
||||
isFastCharging
|
||||
|
||||
@@ -48,4 +48,9 @@ public interface BatterySettingsFeatureProvider {
|
||||
/** Return a label for the bottom summary during wireless charging. */
|
||||
@Nullable
|
||||
CharSequence getWirelessChargingLabel(@NonNull Context context, @NonNull BatteryInfo info);
|
||||
|
||||
/** Return a remaining time label for wireless charging. */
|
||||
@Nullable
|
||||
CharSequence getWirelessChargingRemainingLabel(
|
||||
@NonNull Context context, long remainingTimeMs, long currentTimeMs);
|
||||
}
|
||||
|
||||
@@ -60,4 +60,11 @@ public class BatterySettingsFeatureProviderImpl implements BatterySettingsFeatur
|
||||
@NonNull Context context, @NonNull BatteryInfo info) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public CharSequence getWirelessChargingRemainingLabel(
|
||||
@NonNull Context context, long remainingTimeMs, long currentTimeMs) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user