diff options
author | Danny Baumann <dannybaumann@web.de> | 2012-05-15 09:30:13 +0200 |
---|---|---|
committer | Ricardo Cerqueira <cyanogenmod@cerqueira.org> | 2012-05-15 11:03:57 +0100 |
commit | aa328b4ec80f2ec94321f76cb3d5eb7351f35ebb (patch) | |
tree | 6b7fb3e142234398f4d83ab461a893c657871c7a | |
parent | a750cb3e114d402079f71aefb037511e53a47085 (diff) | |
download | frameworks_base-aa328b4ec80f2ec94321f76cb3d5eb7351f35ebb.zip frameworks_base-aa328b4ec80f2ec94321f76cb3d5eb7351f35ebb.tar.gz frameworks_base-aa328b4ec80f2ec94321f76cb3d5eb7351f35ebb.tar.bz2 |
Make absolutely sure the theme change receivers are only unregistered if
they were registered before.
-rw-r--r-- | policy/src/com/android/internal/policy/impl/AccountUnlockScreen.java | 18 | ||||
-rw-r--r-- | policy/src/com/android/internal/policy/impl/SimUnlockScreen.java | 21 |
2 files changed, 27 insertions, 12 deletions
diff --git a/policy/src/com/android/internal/policy/impl/AccountUnlockScreen.java b/policy/src/com/android/internal/policy/impl/AccountUnlockScreen.java index 2e25ea6..1bbb852 100644 --- a/policy/src/com/android/internal/policy/impl/AccountUnlockScreen.java +++ b/policy/src/com/android/internal/policy/impl/AccountUnlockScreen.java @@ -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() { - mContext.unregisterReceiver(mThemeChangeReceiver); + 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( diff --git a/policy/src/com/android/internal/policy/impl/SimUnlockScreen.java b/policy/src/com/android/internal/policy/impl/SimUnlockScreen.java index 369161f..0eed2e5 100644 --- a/policy/src/com/android/internal/policy/impl/SimUnlockScreen.java +++ b/policy/src/com/android/internal/policy/impl/SimUnlockScreen.java @@ -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,8 +127,10 @@ public class SimUnlockScreen extends LinearLayout implements KeyguardScreen, Vie /** {@inheritDoc} */ public void onPause() { - mContext.unregisterReceiver(mThemeChangeReceiver); - mUiContext = null; + if (mUiContext != null) { + mContext.unregisterReceiver(mThemeChangeReceiver); + mUiContext = null; + } } /** {@inheritDoc} */ @@ -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); |