Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e78c0b99 authored by Vlad Popa's avatar Vlad Popa
Browse files

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
parent 46c9c412
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -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) {