Merge "Fix inconsistent connected without charging state in the Settings" into udc-qpr-dev am: 296322ad47 am: 4b1d5b8e8e

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/24219784

Change-Id: I11be4dc1c925f0100183d842fe2d2b3a13ae2741
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
YK Hung
2023-07-28 19:21:21 +00:00
committed by Automerger Merge Worker
2 changed files with 17 additions and 1 deletions

View File

@@ -18,6 +18,7 @@ package com.android.settings.fuelgauge;
import android.content.ComponentName;
import android.content.Context;
import android.os.BatteryManager;
import android.util.Log;
import androidx.annotation.VisibleForTesting;
@@ -139,7 +140,10 @@ public class TopLevelBatteryPreferenceController extends BasePreferenceControlle
if (Utils.containsIncompatibleChargers(mContext, TAG)) {
return mContext.getString(R.string.battery_info_status_not_charging);
}
if (!info.discharging && info.chargeLabel != null) {
if (info.batteryStatus == BatteryManager.BATTERY_STATUS_NOT_CHARGING) {
// Present status only if no remaining time or status anomalous
return info.statusLabel;
} else if (!info.discharging && info.chargeLabel != null) {
return info.chargeLabel;
} else if (info.remainingLabel == null) {
return info.batteryPercentString;