Remove EnhancedEstimates isHybird flag from trigger condition
- In some rare cases, EnhancedEstimates will not provide isHybird as true(means EnhancedEstimates can not provide data to us), it will makes low battery warning logic back to the previous trigger flow, remove isHybird condition to make sure we always use the new trigger condition. - Although BatteryStateSnapshot will be created by different EnhancedEstimates data, but we already remove the usage of remaining time as our trigger condition(which provided by EnhancedEstimates) so we are safe to always use new trigger condition with or without EnhancedEstimates data. we should think about refactor the class here in the future. - Use current battery level as notifications string content instead of a fixed value. Bug: 232663250 Bug: 232686016 Bug: 232712770 Test: atest SystemUITests Change-Id: I412be50763db39d364757ae3afc2927467451118
This commit is contained in:
@@ -292,10 +292,8 @@ public class PowerNotificationWarnings implements PowerUI.WarningsUI {
|
||||
return;
|
||||
}
|
||||
|
||||
final int warningLevel = mContext.getResources().getInteger(
|
||||
com.android.internal.R.integer.config_lowBatteryWarningLevel);
|
||||
final String percentage = NumberFormat.getPercentInstance()
|
||||
.format((double) warningLevel / 100.0);
|
||||
.format((double) mCurrentBatterySnapshot.getBatteryLevel() / 100.0);
|
||||
final String title = mContext.getString(R.string.battery_low_title);
|
||||
final String contentText = mContext.getString(
|
||||
R.string.battery_low_description, percentage);
|
||||
@@ -340,8 +338,7 @@ public class PowerNotificationWarnings implements PowerUI.WarningsUI {
|
||||
}
|
||||
|
||||
private boolean showSevereLowBatteryDialog() {
|
||||
final boolean isSevereState = !mCurrentBatterySnapshot.isHybrid() || mBucket < -1;
|
||||
return isSevereState && mUseSevereDialog;
|
||||
return mBucket < -1 && mUseSevereDialog;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -359,11 +359,7 @@ public class PowerUI extends CoreStartable implements CommandQueue.Callbacks {
|
||||
}
|
||||
|
||||
mWarnings.updateSnapshot(mCurrentBatteryStateSnapshot);
|
||||
if (mCurrentBatteryStateSnapshot.isHybrid()) {
|
||||
maybeShowHybridWarning(mCurrentBatteryStateSnapshot, mLastBatteryStateSnapshot);
|
||||
} else {
|
||||
maybeShowBatteryWarning(mCurrentBatteryStateSnapshot, mLastBatteryStateSnapshot);
|
||||
}
|
||||
maybeShowHybridWarning(mCurrentBatteryStateSnapshot, mLastBatteryStateSnapshot);
|
||||
}
|
||||
|
||||
// updates the time estimate if we don't have one or battery level has changed.
|
||||
|
||||
Reference in New Issue
Block a user