Record important battery usage event into SharedPreference for dump()

Fix: 268300677
Test: presubmit
Change-Id: If03106c265b984bc2608528bdf45386973e3a14f
This commit is contained in:
ykhung
2023-03-25 14:57:16 +08:00
parent e0c151f401
commit 1f3cf084c8
6 changed files with 118 additions and 3 deletions

View File

@@ -54,11 +54,13 @@ public final class BatteryUsageBroadcastReceiver extends BroadcastReceiver {
if (intent == null || intent.getAction() == null) {
return;
}
Log.d(TAG, "onReceive:" + intent.getAction());
final String action = intent.getAction();
Log.d(TAG, "onReceive:" + action);
DatabaseUtils.recordDateTime(context, action);
final String fullChargeIntentAction = FeatureFactory.getFactory(context)
.getPowerUsageFeatureProvider(context)
.getFullChargeIntentAction();
switch (intent.getAction()) {
switch (action) {
case Intent.ACTION_BATTERY_LEVEL_CHANGED:
// Only when fullChargeIntentAction is ACTION_BATTERY_LEVEL_CHANGED,
// ACTION_BATTERY_LEVEL_CHANGED will be considered as the full charge event and then