Don't hide 1% battery usage apps but show percentage "-" instead.

Bug b/242252864 will be fixed at the same time.

screen_record: https://drive.google.com/open?id=1ycEuazqQZzNWGO8E2Fh3GdgyTEd2Z9s0&authuser=0&resourcekey=0-x9BJJE6932jIv9fFoecjeQ&usp=drive_link

Bug: 262187603
Bug: 242252864
Fix: 262187603
Fix: 242252864
Test: manual
Change-Id: Id1a8b5291d66a38fb86f168d3115ae566e6ec079
This commit is contained in:
Zaiyue Xue
2022-12-12 14:16:43 +08:00
parent 5c7997be5e
commit 1bf57958d2
3 changed files with 25 additions and 11 deletions

View File

@@ -36,6 +36,8 @@ import com.android.settingslib.widget.AppPreference;
*/
public class PowerGaugePreference extends AppPreference {
private static final double PERCENTAGE_TO_SHOW_THRESHOLD = 1f;
private BatteryEntry mInfo;
private BatteryDiffEntry mBatteryDiffEntry;
private CharSequence mContentDescription;
@@ -75,7 +77,8 @@ public class PowerGaugePreference extends AppPreference {
/** Sets the percent of total. */
public void setPercent(double percentOfTotal) {
mProgress = Utils.formatPercentage(percentOfTotal, true);
mProgress = percentOfTotal < PERCENTAGE_TO_SHOW_THRESHOLD
? "-" : Utils.formatPercentage(percentOfTotal, true);
notifyChanged();
}