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

Commit 0c5d8527 authored by Roman Birg's avatar Roman Birg
Browse files

frameworks: allow LockPatternView to be rotated



When displaying this view and rotating the screen, mLockPatternUtils has
the potential to be null, but the save and restore instance state
methods depend on it to be initialized. Work around this by checking if
it's null.

Change-Id: I351bd63fefbcb92fffe20dca6a0381a20ac796ea
Signed-off-by: default avatarRoman Birg <roman@cyngn.com>
parent 82b07aa0
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -1077,7 +1077,7 @@ public class LockPatternView extends View {
    protected Parcelable onSaveInstanceState() {
        Parcelable superState = super.onSaveInstanceState();
        return new SavedState(superState,
                mLockPatternUtils.patternToString(mPattern),
                mLockPatternUtils == null ? "" : mLockPatternUtils.patternToString(mPattern),
                mPatternDisplayMode.ordinal(), mPatternSize,
                mInputEnabled, mInStealthMode, mEnableHapticFeedback, mVisibleDots, mShowErrorPath);
    }
@@ -1086,9 +1086,11 @@ public class LockPatternView extends View {
    protected void onRestoreInstanceState(Parcelable state) {
        final SavedState ss = (SavedState) state;
        super.onRestoreInstanceState(ss.getSuperState());
        if (mLockPatternUtils != null) {
            setPattern(
                    DisplayMode.Correct,
                    mLockPatternUtils.stringToPattern(ss.getSerializedPattern()));
        }
        mPatternDisplayMode = DisplayMode.values()[ss.getDisplayMode()];
        mPatternSize = ss.getPatternSize();
        mInputEnabled = ss.isInputEnabled();