From 6586cf6dd4ff5adde7cbcf7f9b0614ca49d8ba6b Mon Sep 17 00:00:00 2001 From: Wesley Wang Date: Wed, 25 May 2022 14:13:08 +0800 Subject: [PATCH] Update low battery notification logging timing - Move LOW_BATTERY_NOTIFICATION to showLowBatteryWarning() instead of notification creating to avoid double logging when updating notification - Add delete intent to log notification dismiss event Bug: 218405244 Test: atest SystemUITests Change-Id: I1a2bbbe4166db9cba122914c8024a2389d6cd9cc --- .../com/android/systemui/power/PowerNotificationWarnings.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/SystemUI/src/com/android/systemui/power/PowerNotificationWarnings.java b/packages/SystemUI/src/com/android/systemui/power/PowerNotificationWarnings.java index 731e177425388..05e8c021e3f5b 100644 --- a/packages/SystemUI/src/com/android/systemui/power/PowerNotificationWarnings.java +++ b/packages/SystemUI/src/com/android/systemui/power/PowerNotificationWarnings.java @@ -307,6 +307,7 @@ public class PowerNotificationWarnings implements PowerUI.WarningsUI { .setContentText(contentText) .setContentTitle(title) .setOnlyAlertOnce(true) + .setDeleteIntent(pendingBroadcast(ACTION_DISMISSED_WARNING)) .setStyle(new Notification.BigTextStyle().bigText(contentText)) .setVisibility(Notification.VISIBILITY_PUBLIC); if (hasBatterySettings()) { @@ -333,7 +334,6 @@ public class PowerNotificationWarnings implements PowerUI.WarningsUI { final Notification n = nb.build(); mNoMan.cancelAsUser(TAG_BATTERY, SystemMessage.NOTE_BAD_CHARGER, UserHandle.ALL); mNoMan.notifyAsUser(TAG_BATTERY, SystemMessage.NOTE_POWER_LOW, n, UserHandle.ALL); - logEvent(BatteryWarningEvents.LowBatteryWarningEvent.LOW_BATTERY_NOTIFICATION); } private boolean showSevereLowBatteryDialog() { @@ -615,6 +615,7 @@ public class PowerNotificationWarnings implements PowerUI.WarningsUI { Slog.i(TAG, "show low battery warning: level=" + mBatteryLevel + " [" + mBucket + "] playSound=" + playSound); + logEvent(BatteryWarningEvents.LowBatteryWarningEvent.LOW_BATTERY_NOTIFICATION); mPlaySound = playSound; mWarning = true; updateNotification();