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

Commit b026ff71 authored by Danny Baumann's avatar Danny Baumann
Browse files

Make absolutely sure the theme change receivers are only unregistered if

they were registered before.
parent 347cce98
Loading
Loading
Loading
Loading
+13 −5
Original line number Diff line number Diff line
@@ -85,7 +85,7 @@ public class AccountUnlockScreen extends RelativeLayout implements KeyguardScree
        @Override
        public void onReceive(Context context, Intent intent) {
            mUiContext = null;
            mCheckingDialog = null;
            context.unregisterReceiver(this);
        }
    };

@@ -153,7 +153,10 @@ public class AccountUnlockScreen extends RelativeLayout implements KeyguardScree

    /** {@inheritDoc} */
    public void onPause() {
        if (mUiContext != null) {
            mContext.unregisterReceiver(mThemeChangeReceiver);
            mUiContext = null;
        }
    }

    /** {@inheritDoc} */
@@ -163,7 +166,6 @@ public class AccountUnlockScreen extends RelativeLayout implements KeyguardScree
        mPassword.setText("");
        mLogin.requestFocus();
        mLockPatternUtils.updateEmergencyCallButtonState(mEmergencyCall);
        ThemeUtils.registerThemeChangeReceiver(mContext, mThemeChangeReceiver);
    }

    /** {@inheritDoc} */
@@ -328,9 +330,15 @@ public class AccountUnlockScreen extends RelativeLayout implements KeyguardScree
        }

        if (mCheckingDialog == null) {
            mUiContext = ThemeUtils.createUiContext(mContext);
            final Context context;

            final Context context = mUiContext != null ? mUiContext : mContext;
            mUiContext = ThemeUtils.createUiContext(mContext);
            if (mUiContext != null) {
                context = mUiContext;
                ThemeUtils.registerThemeChangeReceiver(mContext, mThemeChangeReceiver);
            } else {
                context = mContext;
            }

            mCheckingDialog = new ProgressDialog(context);
            mCheckingDialog.setMessage(
+14 −7
Original line number Diff line number Diff line
@@ -76,7 +76,7 @@ public class SimUnlockScreen extends LinearLayout implements KeyguardScreen, Vie
        @Override
        public void onReceive(Context context, Intent intent) {
            mUiContext = null;
            mSimUnlockProgressDialog = null;
            context.unregisterReceiver(this);
        }
    };

@@ -127,9 +127,11 @@ public class SimUnlockScreen extends LinearLayout implements KeyguardScreen, Vie

    /** {@inheritDoc} */
    public void onPause() {
        if (mUiContext != null) {
            mContext.unregisterReceiver(mThemeChangeReceiver);
            mUiContext = null;
        }
    }

    /** {@inheritDoc} */
    public void onResume() {
@@ -142,7 +144,6 @@ public class SimUnlockScreen extends LinearLayout implements KeyguardScreen, Vie
        mEnteredDigits = 0;

        mLockPatternUtils.updateEmergencyCallButtonState(mEmergencyCallButton);
        ThemeUtils.registerThemeChangeReceiver(mContext, mThemeChangeReceiver);
    }

    /** {@inheritDoc} */
@@ -212,11 +213,17 @@ public class SimUnlockScreen extends LinearLayout implements KeyguardScreen, Vie
        }

        if (mSimUnlockProgressDialog == null) {
            mUiContext = ThemeUtils.createUiContext(mContext);
            final Context context;

            final Context uiContext = mUiContext != null ? mUiContext : mContext;
            mUiContext = ThemeUtils.createUiContext(mContext);
            if (mUiContext != null) {
                context = mUiContext;
                ThemeUtils.registerThemeChangeReceiver(mContext, mThemeChangeReceiver);
            } else {
                context = mContext;
            }

            mSimUnlockProgressDialog = new ProgressDialog(uiContext);
            mSimUnlockProgressDialog = new ProgressDialog(context);
            mSimUnlockProgressDialog.setMessage(
                    mContext.getString(R.string.lockscreen_sim_unlock_progress_dialog_message));
            mSimUnlockProgressDialog.setIndeterminate(true);