diff options
| author | Jim Miller <jaggies@google.com> | 2012-03-01 16:15:27 -0800 |
|---|---|---|
| committer | Jim Miller <jaggies@google.com> | 2012-03-01 16:15:27 -0800 |
| commit | fbc46dc3c2be5f89041d9e4d3447bc65d303d43a (patch) | |
| tree | 3ffb3162a55efdb995b2d746e42a9e0a75015fe9 /policy | |
| parent | 62f24df57a6240135cfd27c86430e1dda6c81916 (diff) | |
| download | frameworks_base-fbc46dc3c2be5f89041d9e4d3447bc65d303d43a.zip frameworks_base-fbc46dc3c2be5f89041d9e4d3447bc65d303d43a.tar.gz frameworks_base-fbc46dc3c2be5f89041d9e4d3447bc65d303d43a.tar.bz2 | |
Fix 6028595: Fix reboot loop in AccountUnlock due to null callback
This fixes a bug where the device would get into a reboot loop due to having
a null callback. The problem was that a recent change caused the callback
to be used indirectly by the constructor before being set.
The solution is to pass the callback to the KeyguardViewBase constructor
which ensures it's ready by the time we call getCallback().
Change-Id: I2598fc5338be99977980e4dea41a096fb2a7ef7e
Diffstat (limited to 'policy')
6 files changed, 20 insertions, 22 deletions
diff --git a/policy/src/com/android/internal/policy/impl/KeyguardViewBase.java b/policy/src/com/android/internal/policy/impl/KeyguardViewBase.java index f204070..39fdf92 100644 --- a/policy/src/com/android/internal/policy/impl/KeyguardViewBase.java +++ b/policy/src/com/android/internal/policy/impl/KeyguardViewBase.java @@ -72,8 +72,9 @@ public abstract class KeyguardViewBase extends FrameLayout { } }; - public KeyguardViewBase(Context context) { + public KeyguardViewBase(Context context, KeyguardViewCallback callback) { super(context); + mCallback = callback; resetBackground(); } @@ -81,11 +82,6 @@ public abstract class KeyguardViewBase extends FrameLayout { setBackgroundDrawable(mBackgroundDrawable); } - // used to inject callback - void setCallback(KeyguardViewCallback callback) { - mCallback = callback; - } - public KeyguardViewCallback getCallback() { return mCallback; } diff --git a/policy/src/com/android/internal/policy/impl/KeyguardViewManager.java b/policy/src/com/android/internal/policy/impl/KeyguardViewManager.java index 4bba71b..7100e89 100644 --- a/policy/src/com/android/internal/policy/impl/KeyguardViewManager.java +++ b/policy/src/com/android/internal/policy/impl/KeyguardViewManager.java @@ -158,9 +158,9 @@ public class KeyguardViewManager implements KeyguardWindowController { if (mKeyguardView == null) { if (DEBUG) Log.d(TAG, "keyguard view is null, creating it..."); - mKeyguardView = mKeyguardViewProperties.createKeyguardView(mContext, mUpdateMonitor, this); + mKeyguardView = mKeyguardViewProperties.createKeyguardView(mContext, mCallback, + mUpdateMonitor, this); mKeyguardView.setId(R.id.lock_screen); - mKeyguardView.setCallback(mCallback); final ViewGroup.LayoutParams lp = new FrameLayout.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, diff --git a/policy/src/com/android/internal/policy/impl/KeyguardViewProperties.java b/policy/src/com/android/internal/policy/impl/KeyguardViewProperties.java index bda08eb..51b7f1e 100644 --- a/policy/src/com/android/internal/policy/impl/KeyguardViewProperties.java +++ b/policy/src/com/android/internal/policy/impl/KeyguardViewProperties.java @@ -24,16 +24,17 @@ import android.content.Context; * of whether the keyguard instance is around or not. */ public interface KeyguardViewProperties { - + /** * Create a keyguard view. * @param context the context to use when creating the view. + * @param callback keyguard callback object for pokewakelock(), etc. * @param updateMonitor configuration may be based on this. * @param controller for talking back with the containing window. * @return the view. */ KeyguardViewBase createKeyguardView(Context context, - KeyguardUpdateMonitor updateMonitor, + KeyguardViewCallback mCallback, KeyguardUpdateMonitor updateMonitor, KeyguardWindowController controller); /** diff --git a/policy/src/com/android/internal/policy/impl/LockPatternKeyguardView.java b/policy/src/com/android/internal/policy/impl/LockPatternKeyguardView.java index 1e9784c..3ca57c6 100644 --- a/policy/src/com/android/internal/policy/impl/LockPatternKeyguardView.java +++ b/policy/src/com/android/internal/policy/impl/LockPatternKeyguardView.java @@ -291,17 +291,16 @@ public class LockPatternKeyguardView extends KeyguardViewBase implements Handler /** * @param context Used to inflate, and create views. + * @param callback Keyguard callback object for pokewakelock(), etc. * @param updateMonitor Knows the state of the world, and passed along to each * screen so they can use the knowledge, and also register for callbacks * on dynamic information. * @param lockPatternUtils Used to look up state of lock pattern. */ public LockPatternKeyguardView( - Context context, - KeyguardUpdateMonitor updateMonitor, - LockPatternUtils lockPatternUtils, - KeyguardWindowController controller) { - super(context); + Context context, KeyguardViewCallback callback, KeyguardUpdateMonitor updateMonitor, + LockPatternUtils lockPatternUtils, KeyguardWindowController controller) { + super(context, callback); mHandler = new Handler(this); mConfiguration = context.getResources().getConfiguration(); diff --git a/policy/src/com/android/internal/policy/impl/LockPatternKeyguardViewProperties.java b/policy/src/com/android/internal/policy/impl/LockPatternKeyguardViewProperties.java index 19adb3e..d7fb19a 100644 --- a/policy/src/com/android/internal/policy/impl/LockPatternKeyguardViewProperties.java +++ b/policy/src/com/android/internal/policy/impl/LockPatternKeyguardViewProperties.java @@ -43,9 +43,10 @@ public class LockPatternKeyguardViewProperties implements KeyguardViewProperties } public KeyguardViewBase createKeyguardView(Context context, + KeyguardViewCallback callback, KeyguardUpdateMonitor updateMonitor, KeyguardWindowController controller) { - return new LockPatternKeyguardView(context, updateMonitor, + return new LockPatternKeyguardView(context, callback, updateMonitor, mLockPatternUtils, controller); } diff --git a/policy/tests/src/com/android/internal/policy/impl/LockPatternKeyguardViewTest.java b/policy/tests/src/com/android/internal/policy/impl/LockPatternKeyguardViewTest.java index bdfe652..db71e2b 100644 --- a/policy/tests/src/com/android/internal/policy/impl/LockPatternKeyguardViewTest.java +++ b/policy/tests/src/com/android/internal/policy/impl/LockPatternKeyguardViewTest.java @@ -17,6 +17,7 @@ package com.android.internal.policy.impl; import android.content.Context; +import com.android.internal.policy.impl.KeyguardViewCallback; import com.android.internal.telephony.IccCard; import android.content.res.Configuration; import android.test.AndroidTestCase; @@ -133,9 +134,10 @@ public class LockPatternKeyguardViewTest extends AndroidTestCase { - private TestableLockPatternKeyguardView(Context context, KeyguardUpdateMonitor updateMonitor, + private TestableLockPatternKeyguardView(Context context, KeyguardViewCallback callback, + KeyguardUpdateMonitor updateMonitor, LockPatternUtils lockPatternUtils, KeyguardWindowController controller) { - super(context, updateMonitor, lockPatternUtils, controller); + super(context, callback, updateMonitor, lockPatternUtils, controller); } @Override @@ -198,14 +200,13 @@ public class LockPatternKeyguardViewTest extends AndroidTestCase { super.setUp(); mUpdateMonitor = new MockUpdateMonitor(getContext()); mLockPatternUtils = new MockLockPatternUtils(getContext()); + mKeyguardViewCallback = new MockKeyguardCallback(); - mLPKV = new TestableLockPatternKeyguardView(getContext(), mUpdateMonitor, - mLockPatternUtils, new KeyguardWindowController() { + mLPKV = new TestableLockPatternKeyguardView(getContext(), mKeyguardViewCallback, + mUpdateMonitor, mLockPatternUtils, new KeyguardWindowController() { public void setNeedsInput(boolean needsInput) { } }); - mKeyguardViewCallback = new MockKeyguardCallback(); - mLPKV.setCallback(mKeyguardViewCallback); } public void testStateAfterCreatedWhileScreenOff() { |
