Add debug logs for updateBatteryStatus and TopLevelBatteryPreferenceController updating.

Bug: 271665638
Test: make RunSettingsRoboTests ROBOTEST_FILTER="com.android.settings.fuelgauge"
Change-Id: I1c9cc3cfcb54051223df2ad46947d7f0c1ebbdb0
This commit is contained in:
Ting-Kang Chang
2023-03-08 14:29:25 +08:00
parent 0f90688ede
commit ec90572f75
2 changed files with 16 additions and 0 deletions

View File

@@ -116,12 +116,21 @@ public class BatteryBroadcastReceiver extends BroadcastReceiver {
return;
}
final String action = intent.getAction();
Log.d(TAG, "updateBatteryStatus: action=" + action);
if (Intent.ACTION_BATTERY_CHANGED.equals(action)) {
final String batteryLevel = Utils.getBatteryPercentage(intent);
final String batteryStatus =
Utils.getBatteryStatus(mContext, intent, /* compactStatus= */ false);
final int batteryHealth = intent.getIntExtra(
BatteryManager.EXTRA_HEALTH, BatteryManager.BATTERY_HEALTH_UNKNOWN);
Log.d(
TAG,
"Battery changed: level="
+ batteryLevel
+ ", status="
+ batteryStatus
+ ", health="
+ batteryHealth);
if (!Utils.isBatteryPresent(intent)) {
Log.w(TAG, "Problem reading the battery meter.");
mBatteryListener.onBatteryChanged(BatteryUpdateType.BATTERY_NOT_PRESENT);