Merge "Update AOD battery indication" into sc-v2-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
d91c7fe5cc
@@ -108,6 +108,15 @@ public class BatteryStatus {
|
||||
|| plugged == BatteryManager.BATTERY_PLUGGED_USB;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the device is plugged in wireless.
|
||||
*
|
||||
* @return true if the device is plugged in wireless
|
||||
*/
|
||||
public boolean isPluggedInWireless() {
|
||||
return plugged == BatteryManager.BATTERY_PLUGGED_WIRELESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether or not the device is charged. Note that some devices never return 100% for
|
||||
* battery level, so this allows either battery level or status to determine if the
|
||||
|
||||
@@ -138,6 +138,7 @@ public class KeyguardIndicationController {
|
||||
|
||||
private boolean mPowerPluggedIn;
|
||||
private boolean mPowerPluggedInWired;
|
||||
private boolean mPowerPluggedInWireless;
|
||||
private boolean mPowerCharged;
|
||||
private boolean mBatteryOverheated;
|
||||
private boolean mEnableBatteryDefender;
|
||||
@@ -751,10 +752,14 @@ public class KeyguardIndicationController {
|
||||
: R.string.keyguard_plugged_in;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
} else if (mPowerPluggedInWireless) {
|
||||
chargingId = hasChargingTime
|
||||
? R.string.keyguard_indication_charging_time_wireless
|
||||
: R.string.keyguard_plugged_in_wireless;
|
||||
} else {
|
||||
chargingId = hasChargingTime
|
||||
? R.string.keyguard_indication_charging_time
|
||||
: R.string.keyguard_plugged_in;
|
||||
}
|
||||
|
||||
String percentage = NumberFormat.getPercentInstance().format(mBatteryLevel / 100f);
|
||||
@@ -866,6 +871,7 @@ public class KeyguardIndicationController {
|
||||
|| status.status == BatteryManager.BATTERY_STATUS_FULL;
|
||||
boolean wasPluggedIn = mPowerPluggedIn;
|
||||
mPowerPluggedInWired = status.isPluggedInWired() && isChargingOrFull;
|
||||
mPowerPluggedInWireless = status.isPluggedInWireless() && isChargingOrFull;
|
||||
mPowerPluggedIn = status.isPluggedIn() && isChargingOrFull;
|
||||
mPowerCharged = status.isCharged();
|
||||
mChargingWattage = status.maxChargingWattage;
|
||||
|
||||
Reference in New Issue
Block a user