summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Vlad Popa <pvlad@google.com> 2023-12-05 18:17:40 -0800
committer Vlad Popa <pvlad@google.com> 2023-12-05 18:55:44 -0800
commite78c0b99cb433dbf367f9b3a2fc1ea22d24ec7fd (patch)
tree56bcfb999aa1b4ccb331e2bdac5226f3bc7fd93f
parent46c9c412e96ab994bf25f7905a6260db3501945c (diff)
Fix leaking the CsdWarningDialog receiver
Making sure to unregister the receiver even when the notification for 5x dose is sent instead. Flag: NONE Test: adb shell cmd audio set-sound-dose-value 4.99 to trigger notification faster Bug: 293494325 Change-Id: I5bf3e03380ac03682606695357b6922b9e00f48a
-rw-r--r--packages/SystemUI/src/com/android/systemui/volume/CsdWarningDialog.java5
1 files changed, 5 insertions, 0 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/volume/CsdWarningDialog.java b/packages/SystemUI/src/com/android/systemui/volume/CsdWarningDialog.java
index d6e6f3fc56b1..bd698ab8ad5c 100644
--- a/packages/SystemUI/src/com/android/systemui/volume/CsdWarningDialog.java
+++ b/packages/SystemUI/src/com/android/systemui/volume/CsdWarningDialog.java
@@ -157,6 +157,7 @@ public class CsdWarningDialog extends SystemUIDialog
if (mCsdWarning == AudioManager.CSD_WARNING_DOSE_REPEATED_5X) {
// only show a notification in case we reached 500% of dose
show5XNotification();
+ dismissCsdDialog();
return;
}
super.show();
@@ -217,6 +218,10 @@ public class CsdWarningDialog extends SystemUIDialog
@Override
public void onDismiss(DialogInterface unused) {
+ dismissCsdDialog();
+ }
+
+ private void dismissCsdDialog() {
try {
mContext.unregisterReceiver(mReceiver);
} catch (IllegalArgumentException e) {