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

Commit 7d4adea7 authored by Masanori Ogino's avatar Masanori Ogino
Browse files

avoid crashing system serer process

Context#unregisterReceiver will throw IllegalArgumentException
if the receiver has already unregistered.

In GlobalAction class, when SilentModeAction is changed, it will
close the dialog with some delay. So there is a possibility
that it would unregistere again for the same receiver if a user
changes slient mode againand again. System must not crash in such
a case.

Change-Id: I33662feb48a770d39a8413901ec77ac1acd16bc7
parent cee11240
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -320,7 +320,12 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac
    /** {@inheritDoc} */
    public void onDismiss(DialogInterface dialog) {
        if (SHOW_SILENT_TOGGLE) {
            try {
                mContext.unregisterReceiver(mRingerModeReceiver);
            } catch (IllegalArgumentException ie) {
                // ignore this
                Log.w(TAG, ie);
            }
        }
    }