From c2378e619ff7adccaeccc3f5d42165f6a5118683 Mon Sep 17 00:00:00 2001 From: Kweku Adams Date: Wed, 18 May 2022 15:43:26 +0000 Subject: [PATCH] Note BATTERY_LEVEL_CHANGED semantics. Despite the name, BATTERY_LEVEL_CHANGED is also sent when the plug type changes. Note that in the documentation and remove the wtf when that happens. Bug: 232840504 Test: N/A Change-Id: Ib3e0f6c43ecbd5bf1841081b36f4b3eaa8b20039 --- .../java/com/android/server/tare/InternalResourceService.java | 2 +- core/java/android/content/Intent.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/apex/jobscheduler/service/java/com/android/server/tare/InternalResourceService.java b/apex/jobscheduler/service/java/com/android/server/tare/InternalResourceService.java index 2118eeb45d70a..a762fb3c08db6 100644 --- a/apex/jobscheduler/service/java/com/android/server/tare/InternalResourceService.java +++ b/apex/jobscheduler/service/java/com/android/server/tare/InternalResourceService.java @@ -379,7 +379,7 @@ public class InternalResourceService extends SystemService { if (increased) { mAgent.distributeBasicIncomeLocked(newBatteryLevel); } else if (newBatteryLevel == mCurrentBatteryLevel) { - Slog.wtf(TAG, "Battery level stayed the same"); + // The broadcast is also sent when the plug type changes... return; } mCurrentBatteryLevel = newBatteryLevel; diff --git a/core/java/android/content/Intent.java b/core/java/android/content/Intent.java index a50ff3841da9c..7a88a057fb778 100644 --- a/core/java/android/content/Intent.java +++ b/core/java/android/content/Intent.java @@ -3259,7 +3259,7 @@ public class Intent implements Parcelable, Cloneable { /** - * Broadcast Action: Sent when the current battery level changes. + * Broadcast Action: Sent when the current battery level or plug type changes. * * It has {@link android.os.BatteryManager#EXTRA_EVENTS} that carries a list of {@link Bundle} * instances representing individual battery level changes with associated